]> git.lyx.org Git - lyx.git/blob - src/LColor.h
rowpainter.C: remove extra metrics calls
[lyx.git] / src / LColor.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *          Copyright 1998-2001 The LyX Team
8  *
9  *======================================================*/
10
11 #ifndef LCOLOR_H
12 #define LCOLOR_H
13
14 #include "LString.h"
15
16 /**
17   This is a stateless class.
18
19   It has one basic purposes:
20   To serve as a color-namespace container (the Color enum).
21
22
23   */
24 /**
25  * \class LColor
26  *
27  * A class holding color definitions and associated names for
28  * LaTeX, X11, the GUI, and LyX internally.
29  *
30  * A color can be one of the following kinds:
31  *
32  * - A real, predefined color, such as black, white, red or green.
33  * - A logical color, such as no color, inherit, math
34  */
35
36 class LColor 
37 // made copyable for same reasons as LyXRC was made copyable. See there for
38 // explanation.
39 {
40 public:
41         /// Names of colors, including all logical colors
42         enum color {
43                 /// No particular color---clear or default
44                 none,
45                 /// The different text colors
46                 black,
47                 ///
48                 white,
49                 ///
50                 red,
51                 ///
52                 green,
53                 ///
54                 blue,
55                 ///
56                 cyan,
57                 ///
58                 magenta,
59                 ///
60                 yellow,
61
62                 // Needed interface colors
63
64                 /// Cursor color
65                 cursor,
66                 /// Background color
67                 background,
68                 /// Foreground color
69                 foreground,
70                 /// Background color of selected text
71                 selection,
72                 /// Text color in LaTeX mode
73                 latex,
74                 /// The color used for previews
75                 preview,
76
77                 /// Text color for notes
78                 note,
79                 /// Background color of notes
80                 notebg,
81                 /// Text color for comments
82                 comment,
83                 /// Background color of comments
84                 commentbg,
85                 /// Text color for greyedout inset
86                 greyedout,
87                 /// Background color of greyedout inset
88                 greyedoutbg,
89
90
91                 /// Color for the depth bars in the margin
92                 depthbar,
93                 /// Color for marking foreign language words
94                 language,
95
96                 /// Text color for command insets
97                 command,
98                 /// Background color for command insets
99                 commandbg,
100                 /// Frame color for command insets
101                 commandframe,
102
103                 /// Special chars text color
104                 special,
105
106                 /// Graphics inset background color
107                 graphicsbg,
108                 /// Math inset text color
109                 math,
110                 /// Math inset background color
111                 mathbg,
112                 /// Macro math inset background color
113                 mathmacrobg,
114                 /// Math inset frame color
115                 mathframe,
116                 /// Math line color
117                 mathline,
118
119                 /// caption frame color
120                 captionframe,
121
122                 /// collapsable insets text
123                 collapsable,
124                 /// collapsable insets frame
125                 collapsableframe,
126
127                 /// Inset marker background color
128                 insetbg,
129                 /// Inset marker frame color
130                 insetframe,
131
132                 /// Error box text color
133                 error,
134                 /// EOL marker color
135                 eolmarker,
136                 /// Added space colour
137                 added_space,
138                 /// Appendix marker color
139                 appendix,
140                 /// changebar color
141                 changebar,
142                 /// strike-out color
143                 strikeout,
144                 /// added text color
145                 newtext,
146                 /// Top and bottom line color
147                 topline,
148                 /// Table line color
149                 tabularline,
150                 /// Table line color
151                 tabularonoffline,
152                 /// Bottom area color
153                 bottomarea,
154                 /// Page break color
155                 pagebreak,
156
157                 // FIXME: why are the next four separate ??
158                 /// Color used for top of boxes
159                 top,
160                 /// Color used for bottom of boxes
161                 bottom,
162                 /// Color used for left side of boxes
163                 left,
164                 /// Color used for right side of boxes
165                 right,
166                 /// Color used for bottom background
167                 buttonbg,
168
169                 // Logical attributes
170
171                 /// Color is inherited
172                 inherit,
173                 /// For ignoring updates of a color
174                 ignore
175         };
176
177         ///
178         LColor();
179         ///
180         LColor(LColor const &);
181         ///
182         ~LColor();
183         ///
184         void operator=(LColor const &);
185         /// set the given LyX color to the color defined by the X11 name given
186         void setColor(LColor::color col, string const & x11name);
187         /// set the given LyX color to the color defined by the X11 name given
188         bool setColor(string const & lyxname, string const & x11name);
189
190         /// Get GUI name of color
191         string const getGUIName(LColor::color c) const;
192
193         /// Get X11 name of color
194         string const getX11Name(LColor::color c) const;
195
196         /// Get LaTeX name of color
197         string const getLaTeXName(LColor::color c) const;
198
199         /// Get LyX name of color
200         string const getLyXName(LColor::color c) const;
201
202         /// get the color from the GUI name
203         LColor::color getFromGUIName(string const & guiname) const;
204         /// get the color from the LyX name
205         LColor::color getFromLyXName(string const & lyxname) const;
206 private:
207         ///
208         struct Pimpl;
209         ///
210         Pimpl * pimpl_;
211 };
212
213 /// the current color definitions
214 extern LColor lcolor;
215 /// the system color definitions
216 extern LColor system_lcolor;
217
218 #endif