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