]> git.lyx.org Git - lyx.git/blob - src/LColor.h
Added new FINISED states FINISHED_RIGHT, FINISHED_UP, FINISHED_DOWN.
[lyx.git] / src / LColor.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *       
7  *          Copyright 1998-2001 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
29   */
30 /**
31  * \class LColor
32  *
33  * A class holding color definitions and associated names for
34  * LaTeX, X11, the GUI, and LyX internally.
35  *
36  * A color can be one of the following kinds:
37  *
38  * - A real, predefined color, such as black, white, red or green.
39  * - A logical color, such as no color, inherit, math
40  */
41  
42 class LColor // : public boost::noncopyable {
43 // made copyable for same reasons as LyXRC was made copyable. See there for
44 // explanation.
45 {
46 public:
47         /// Names of colors, including all logical colors
48         enum color {
49                 /// No particular color---clear or default
50                 none,
51                 /// The different text colors
52                 black,
53                 ///
54                 white,
55                 ///
56                 red,
57                 ///
58                 green,
59                 ///
60                 blue,
61                 ///
62                 cyan,
63                 ///
64                 magenta,
65                 ///
66                 yellow,
67
68                 // Needed interface colors
69
70                 /// Cursor color
71                 cursor,
72                 /// Background color
73                 background,
74                 /// Foreground color
75                 foreground,
76                 /// Background color of selected text
77                 selection,
78                 /// Text color in LaTeX mode
79                 latex,
80
81                 /// Text color for notes
82                 note,
83                 /// Background color of notes
84                 notebg,
85
86
87                 /// Color for the depth bars in the margin
88                 depthbar,
89                 /// Color for marking foreign language words
90                 language,
91
92                 /// Text color for command insets
93                 command,
94                 /// Background color for command insets
95                 commandbg,
96                 /// Frame color for command insets
97                 commandframe,
98
99                 /// Special chars text color
100                 special,
101
102                 /// Math inset text color
103                 math,
104                 /// Math inset background color
105                 mathbg,
106                 /// Macro math inset background color
107                 mathmacrobg,
108                 /// Math inset frame color
109                 mathframe,
110                 /// Math cursor color
111                 mathcursor,
112                 /// Math line color
113                 mathline,
114
115                 /// caption frame color
116                 captionframe,
117  
118                 /// collapsable insets text
119                 collapsable,
120                 /// collapsable insets frame
121                 collapsableframe,
122
123                 /// Inset marker background color
124                 insetbg,
125                 /// Inset marker frame color
126                 insetframe,
127
128                 /// Error box text color
129                 error,
130                 /// EOL marker color
131                 eolmarker,
132                 /// Appendix line color
133                 appendixline,
134                 /// VFill line color
135                 vfillline,
136                 /// Top and bottom line color
137                 topline,
138                 /// Table line color
139                 tabularline,
140                 /// Table line color
141                 tabularonoffline,
142                 /// Bottom area color
143                 bottomarea,
144                 /// Page break color
145                 pagebreak,
146
147                 // FIXME: why are the next four separate ??
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         /// set the given LyX color to the color defined by the X11 name given
170         void setColor(LColor::color col, string const & x11name);
171         /// set the given LyX color to the color defined by the X11 name given
172         bool setColor(string const & lyxname, string const & x11name);
173  
174         /// Get GUI name of color
175         string const getGUIName(LColor::color c) const;
176  
177         /// Get X11 name of color
178         string const getX11Name(LColor::color c) const;
179  
180         /// Get LaTeX name of color
181         string const getLaTeXName(LColor::color c) const;
182  
183         /// Get LyX name of color
184         string const getLyXName(LColor::color c) const;
185  
186         /// get the color from the GUI name
187         LColor::color getFromGUIName(string const & guiname) const;
188         /// get the color from the LyX name
189         LColor::color getFromLyXName(string const & lyxname) const;
190 private:
191         ///
192         struct information {
193                 /// the name as it appears in the GUI
194                 string guiname;
195                 /// the name used in LaTeX
196                 string latexname;
197                 /// the name for X11
198                 string x11name;
199                 /// the name for LyX
200                 string lyxname;
201         };
202
203         /// initialise a color entry
204         void fill(LColor::color col, string const & gui,
205                   string const & latex, string const & x11,
206                   string const & lyx);
207
208         ///
209         typedef std::map<LColor::color, information> InfoTab;
210         /// the table of color information
211         InfoTab infotab;
212 };
213
214 /// the current color definitions
215 extern LColor lcolor;
216 /// the system color definitions
217 extern LColor system_lcolor;
218
219 #endif