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