]> git.lyx.org Git - lyx.git/blob - src/LColor.h
qt3 fix
[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 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include <map>
19
20 #include "LString.h"
21
22 /**
23   This is a stateless class.
24
25   It has one basic purposes:
26   To serve as a color-namespace container (the Color enum).
27
28
29   */
30 /**
31  * \class LColor
32  *
33  * A class holding color definitions and associated names for
34  * LaTeX, X11, the GUI, and LyX internally.
35  *
36  * A color can be one of the following kinds:
37  *
38  * - A real, predefined color, such as black, white, red or green.
39  * - A logical color, such as no color, inherit, math
40  */
41
42 class LColor // : public boost::noncopyable {
43 // made copyable for same reasons as LyXRC was made copyable. See there for
44 // explanation.
45 {
46 public:
47         /// Names of colors, including all logical colors
48         enum color {
49                 /// No particular color---clear or default
50                 none,
51                 /// The different text colors
52                 black,
53                 ///
54                 white,
55                 ///
56                 red,
57                 ///
58                 green,
59                 ///
60                 blue,
61                 ///
62                 cyan,
63                 ///
64                 magenta,
65                 ///
66                 yellow,
67
68                 // Needed interface colors
69
70                 /// Cursor color
71                 cursor,
72                 /// Background color
73                 background,
74                 /// Foreground color
75                 foreground,
76                 /// Background color of selected text
77                 selection,
78                 /// Text color in LaTeX mode
79                 latex,
80                 /// The color used for previews
81                 preview,
82
83                 /// Text color for notes
84                 note,
85                 /// Background color of notes
86                 notebg,
87
88
89                 /// Color for the depth bars in the margin
90                 depthbar,
91                 /// Color for marking foreign language words
92                 language,
93
94                 /// Text color for command insets
95                 command,
96                 /// Background color for command insets
97                 commandbg,
98                 /// Frame color for command insets
99                 commandframe,
100
101                 /// Special chars text color
102                 special,
103
104                 /// Graphics inset background color
105                 graphicsbg,
106                 /// Math inset text color
107                 math,
108                 /// Math inset background color
109                 mathbg,
110                 /// Macro math inset background color
111                 mathmacrobg,
112                 /// Math inset frame color
113                 mathframe,
114                 /// Math cursor color
115                 mathcursor,
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 line color
139                 appendixline,
140                 /// Top and bottom line color
141                 topline,
142                 /// Table line color
143                 tabularline,
144                 /// Table line color
145                 tabularonoffline,
146                 /// Bottom area color
147                 bottomarea,
148                 /// Page break color
149                 pagebreak,
150
151                 // FIXME: why are the next four separate ??
152                 /// Color used for top of boxes
153                 top,
154                 /// Color used for bottom of boxes
155                 bottom,
156                 /// Color used for left side of boxes
157                 left,
158                 /// Color used for right side of boxes
159                 right,
160                 /// Color used for bottom background
161                 buttonbg,
162
163                 // Logical attributes
164
165                 /// Color is inherited
166                 inherit,
167                 /// For ignoring updates of a color
168                 ignore
169         };
170
171         ///
172         LColor();
173         /// set the given LyX color to the color defined by the X11 name given
174         void setColor(LColor::color col, string const & x11name);
175         /// set the given LyX color to the color defined by the X11 name given
176         bool setColor(string const & lyxname, string const & x11name);
177
178         /// Get GUI name of color
179         string const getGUIName(LColor::color c) const;
180
181         /// Get X11 name of color
182         string const getX11Name(LColor::color c) const;
183
184         /// Get LaTeX name of color
185         string const getLaTeXName(LColor::color c) const;
186
187         /// Get LyX name of color
188         string const getLyXName(LColor::color c) const;
189
190         /// get the color from the GUI name
191         LColor::color getFromGUIName(string const & guiname) const;
192         /// get the color from the LyX name
193         LColor::color getFromLyXName(string const & lyxname) const;
194 private:
195         ///
196         struct information {
197                 /// the name as it appears in the GUI
198                 string guiname;
199                 /// the name used in LaTeX
200                 string latexname;
201                 /// the name for X11
202                 string x11name;
203                 /// the name for LyX
204                 string lyxname;
205         };
206
207         /// initialise a color entry
208         void fill(LColor::color col, string const & gui,
209                   string const & latex, string const & x11,
210                   string const & lyx);
211
212         ///
213         typedef std::map<LColor::color, information> InfoTab;
214         /// the table of color information
215         InfoTab infotab;
216 };
217
218 /// the current color definitions
219 extern LColor lcolor;
220 /// the system color definitions
221 extern LColor system_lcolor;
222
223 #endif