]> git.lyx.org Git - lyx.git/blob - src/LColor.h
another pesky \#warning snuck in
[lyx.git] / src / LColor.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *       
7  *          Copyright 1998-2000 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 #include <boost/utility.hpp>
22
23 /**
24   This is a stateless class. 
25
26   It has one basic purposes:
27   To serve as a color-namespace container (the Color enum).
28   
29   A color can be one of the following kinds:
30
31   - A real, predefined color, such as black, white, red or green.
32   - A logical color, such as no color, inherit, math
33
34   */
35 class LColor //: public noncopyable {
36 // made copyable for same reasons as LyXRC was made copyable. See there for
37 // explanation.
38 {
39 public:
40         /// Names of colors, including all logical colors
41         enum color {
42                 /// No particular color---clear or default
43                 none,
44                 /// The different text colors
45                 black,
46                 ///
47                 white,
48                 ///
49                 red,
50                 ///
51                 green,
52                 ///
53                 blue,
54                 ///
55                 cyan,
56                 ///
57                 magenta,
58                 ///
59                 yellow,
60
61                 // Needed interface colors
62
63                 /// Cursor color
64                 cursor,
65                 /// Background color
66                 background,
67                 /// Foreground color
68                 foreground,
69                 /// Background color of selected text
70                 selection,
71                 /// Text color in LaTeX mode
72                 latex,
73                 /// Titles color of floats
74                 floats,
75
76                 /// Text color for notes
77                 note,
78                 /// Background color of notes
79                 notebg,
80                 /// Frame color for notes
81                 noteframe,
82
83
84                 /// Color for the depth bars in the margin
85                 depthbar,
86                 /// Color for marking foreign language words
87                 language,
88
89                 /// Text color for command insets
90                 command,
91                 /// Background color for command insets
92                 commandbg,
93                 /// Frame color for command insets
94                 commandframe,
95
96                 /// Text color for accents we can't handle nicely
97                 accent,
98                 ///
99                 accentbg,
100                 ///
101                 accentframe,
102
103                 /// Minipage line color
104                 minipageline,
105
106                 /// Special chars text color
107                 special,
108
109                 /// Math inset text color
110                 math,
111                 /// Math inset background color
112                 mathbg,
113                 /// Math inset frame color
114                 mathframe,
115                 /// Math cursor color
116                 mathcursor,
117                 /// Math line color
118                 mathline,
119
120                 /// Footnote marker text
121                 footnote,
122                 /// Footnote marker background color
123                 footnotebg,
124                 /// Footnote line color
125                 footnoteframe,
126
127                 /// ERT marker text
128                 ert,
129                 
130                 /// Text color for inset marker
131                 inset,
132                 /// Inset marker background color
133                 insetbg,
134                 /// Inset marker frame color
135                 insetframe,
136
137                 /// Error box text color
138                 error,
139                 /// EOL marker color
140                 eolmarker,
141                 /// Appendix line color
142                 appendixline,
143                 /// VFill line color
144                 vfillline,
145                 /// Top and bottom line color
146                 topline,
147                 /// Table line color
148                 tableline,
149                 /// Table line color
150                 tabularline,
151                 /// Table line color
152                 tabularonoffline,
153                 /// Bottom area color
154                 bottomarea,
155                 /// Page break color
156                 pagebreak,
157
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         void setColor(LColor::color col, string const & x11name);
181         ///
182         bool setColor(string const & lyxname, string const & x11name);
183         /// Get GUI name of color
184         string const getGUIName(LColor::color c) const;
185
186         /// Get X11 name of color
187         string const getX11Name(LColor::color c) const;
188
189         /// Get LaTeX name of color
190         string const getLaTeXName(LColor::color c) const;
191
192         /// Get LyX name of color
193         string const getLyXName(LColor::color c) const;
194         ///
195         LColor::color getFromGUIName(string const & guiname) const;
196         ///
197         LColor::color getFromLyXName(string const & lyxname) const;
198 private:
199         ///
200         struct information {
201                 ///
202                 string guiname;
203                 ///
204                 string latexname;
205                 ///
206                 string x11name;
207                 ///
208                 string lyxname;
209         };
210
211         ///
212         void fill(LColor::color col, string const & gui,
213                   string const & latex, string const & x11,
214                   string const & lyx);
215
216         ///
217         typedef std::map<LColor::color, information> InfoTab;
218         ///
219         InfoTab infotab;
220 };
221
222 ///
223 extern LColor lcolor;
224 ///
225 extern LColor system_lcolor;
226
227 #endif