]> git.lyx.org Git - lyx.git/blob - src/LColor.h
9a7bd920cee2a9ad3275c4181e41f2a8f87aac0e
[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 using std::map;
20 using std::less;
21
22 #include "LString.h"
23
24 /**
25   This is a stateless class. 
26
27   It has one basic purposes:
28   To serve as a color-namespace container (the Color enum).
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
37 class LColor {
38 public:
39         /// Names of colors, including all logical colors
40         enum color {
41                 /// No particular color---clear or default
42                 none,
43                 /// The different text colors
44                 black,
45                 ///
46                 white,
47                 ///
48                 red,
49                 ///
50                 green,
51                 ///
52                 blue,
53                 ///
54                 cyan,
55                 ///
56                 magenta,
57                 ///
58                 yellow,
59
60                 /// Needed interface colors
61
62                 /// Background color
63                 background,
64                 /// Foreground color
65                 foreground,
66                 /// Background color of selected text
67                 selection,
68                 /// Text color in LaTeX mode
69                 latex,
70                 /// Titles color of floats
71                 floats,
72
73                 /// Text color for notes
74                 note,
75                 /// Background color of notes
76                 notebg,
77                 /// Frame color for notes
78                 noteframe,
79
80
81                 /// Text color for command insets
82                 command,
83                 /// Background color for command insets
84                 commandbg,
85                 /// Frame color for command insets
86                 commandframe,
87
88                 /// Text color for accents we can't handle nicely
89                 accent,
90                 ///
91                 accentbg,
92                 ///
93                 accentframe,
94
95                 /// Minipage line color
96                 minipageline,
97
98                 /// Special chars text color
99                 special,
100
101                 /// Math inset text color
102                 math,
103                 /// Math inset background color
104                 mathbg,
105                 /// Math inset frame color
106                 mathframe,
107                 /// Math cursor color
108                 mathcursor,
109                 /// Math line color
110                 mathline,
111
112                 /// Footnote marker text
113                 footnote,
114                 /// Footnote marker background color
115                 footnotebg,
116                 /// Footnote line color
117                 footnoteframe,
118
119                 /// ERT marker text
120                 ert,
121                 
122                 /// Text color for inset marker
123                 inset,
124                 /// Inset marker background color
125                 insetbg,
126                 /// Inset marker frame color
127                 insetframe,
128
129                 /// Error box text color
130                 error,
131                 /// EOL marker color
132                 eolmarker,
133                 /// Appendix line color
134                 appendixline,
135                 /// VFill line color
136                 vfillline,
137                 /// Top and bottom line color
138                 topline,
139                 /// Table line color
140                 tableline,
141                 /// Bottom area color
142                 bottomarea,
143                 /// Page break color
144                 pagebreak,
145
146                 /// Color used for top of boxes
147                 top,
148                 /// Color used for bottom of boxes
149                 bottom,
150                 /// Color used for left side of boxes
151                 left,
152                 /// Color used for right side of boxes
153                 right,
154                 /// Color used for bottom background
155                 buttonbg,
156
157                 /// Logical attributes
158
159                 /// Color is inherited
160                 inherit,
161                 /// For ignoring updates of a color
162                 ignore
163         };
164
165         ///
166         LColor();
167         ///
168         void setColor(LColor::color col, string const & x11name);
169         /// Get GUI name of color
170         string getGUIName(LColor::color c) const;
171
172         /// Get X11 name of color
173         string getX11Name(LColor::color c) const;
174
175         /// Get LaTeX name of color
176         string getLaTeXName(LColor::color c) const;
177
178         /// Get LyX name of color
179         string getLyXName(LColor::color c) const;
180         ///
181         LColor::color getFromGUIName(string const & guiname) const;
182         ///
183         LColor::color getFromLyXName(string const & lyxname) const;
184 private:
185         ///
186         struct information {
187                 string guiname;
188                 string latexname;
189                 string x11name;
190                 string lyxname;
191         };
192
193         ///
194         void fill(LColor::color col, string const & gui,
195                   string const & latex, string const & x11,
196                   string const & lyx);
197
198         ///
199         typedef map<LColor::color, information, less<LColor::color> > InfoTab;
200
201         InfoTab infotab;
202 };
203
204 extern LColor lcolor;
205
206 #endif