]> git.lyx.org Git - lyx.git/blob - src/LColor.h
5242f418fe1c07c0b324646c229ec5c5709b27e0
[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                 /// Text color for command insets
80                 command,
81                 /// Background color for command insets
82                 commandbg,
83                 /// Frame color for command insets
84                 commandframe,
85
86                 /// Text color for accents we can't handle nicely
87                 accent,
88                 ///
89                 accentbg,
90                 ///
91                 accentframe,
92
93                 /// Minipage line color
94                 minipageline,
95
96                 /// Special chars text color
97                 special,
98
99                 /// Math inset text color
100                 math,
101                 /// Math inset background color
102                 mathbg,
103                 /// Math inset frame color
104                 mathframe,
105                 /// Math cursor color
106                 mathcursor,
107                 /// Math line color
108                 mathline,
109
110                 /// Footnote marker text
111                 footnote,
112                 /// Footnote marker background color
113                 footnotebg,
114                 /// Footnote line color
115                 footnoteframe,
116
117                 /// ERT marker text
118                 ert,
119                 
120                 /// Text color for inset marker
121                 inset,
122                 /// Inset marker background color
123                 insetbg,
124                 /// Inset marker frame color
125                 insetframe,
126
127                 /// Error box text color
128                 error,
129                 /// EOL marker color
130                 eolmarker,
131                 /// Appendix line color
132                 appendixline,
133                 /// VFill line color
134                 vfillline,
135                 /// Top and bottom line color
136                 topline,
137                 /// Table line color
138                 tableline,
139                 /// Bottom area color
140                 bottomarea,
141                 /// Page break color
142                 pagebreak,
143
144                 /// Color used for top of boxes
145                 top,
146                 /// Color used for bottom of boxes
147                 bottom,
148                 /// Color used for left side of boxes
149                 left,
150                 /// Color used for right side of boxes
151                 right,
152                 /// Color used for bottom background
153                 buttonbg,
154
155                 /// Logical attributes
156
157                 /// Color is inherited
158                 inherit,
159                 /// For ignoring updates of a color
160                 ignore
161         };
162
163         ///
164         LColor();
165         ///
166         void setColor(LColor::color col, string const & x11name);
167         /// Get GUI name of color
168         string getGUIName(LColor::color c) const;
169
170         /// Get X11 name of color
171         string getX11Name(LColor::color c) const;
172
173         /// Get LaTeX name of color
174         string getLaTeXName(LColor::color c) const;
175
176         /// Get LyX name of color
177         string getLyXName(LColor::color c) const;
178         ///
179         LColor::color getFromGUIName(string const & guiname) const;
180         ///
181         LColor::color getFromLyXName(string const & lyxname) const;
182 private:
183         ///
184         struct information {
185                 string guiname;
186                 string latexname;
187                 string x11name;
188                 string lyxname;
189         };
190
191         ///
192         void fill(LColor::color col, string const & gui,
193                   string const & latex, string const & x11,
194                   string const & lyx);
195
196         ///
197         typedef std::map<LColor::color, information> InfoTab;
198
199         InfoTab infotab;
200 };
201
202 extern LColor lcolor;
203
204 #endif