1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
/*
ui/palette.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
#ifndef __INCLUDED_UI_PALETTE_H__
#define __INCLUDED_UI_PALETTE_H__
#include "math/color.h"
namespace ui
{
/// color palette used by the user interface
class Palette
{
public:
/// default constructor, creates a default palette
Palette();
/// default destructor
~Palette();
/// color index
enum Color { Foreground = 0, Background = 1, Border = 2, Text = 3, Highlight = 4, Disabled = 5, Pointer = 6, Active = 7,
Debug = 8, Mission = 9, Bold = 10, Fancy = 11, Warning = 12, Error = 13
};
/* ---- mutators ------------------------------------------- */
/// set foreground color
inline void set_foreground(const math::Color &color) {
palette_foreground.assign(color);
}
/// set background color
inline void set_background(const math::Color &color) {
palette_background.assign(color);
}
/// set border color
inline void set_border(const math::Color &color) {
palette_border.assign(color);
}
/// set text color
inline void set_text(const math::Color &color) {
palette_text.assign(color);
}
/// set highlight color
inline void set_highlight(const math::Color &color) {
palette_highlight.assign(color);
}
/// set disabled color
inline void set_disabled(const math::Color &color) {
palette_disabled.assign(color);
}
/// set pointer color
inline void set_pointer(const math::Color &color) {
palette_pointer.assign(color);
}
/// set active pointer color
inline void set_active(const math::Color &color) {
palette_active.assign(color);
}
/// set debug color
inline void set_debug(const math::Color &color) {
palette_debug.assign(color);
}
/// set mission color
inline void set_mission(const math::Color &color) {
palette_mission.assign(color);
}
/// set bold text color
inline void set_bold(const math::Color &color) {
palette_bold.assign(color);
}
/// set fancy text color
inline void set_fancy(const math::Color &color) {
palette_fancy.assign(color);
}
/// set warning text color
inline void set_warning(const math::Color &color) {
palette_warning.assign(color);
}
/// set error text color
inline void set_error(const math::Color &color) {
palette_error.assign(color);
}
/* ---- inspectors ----------------------------------------- */
/// foreground color
inline const math::Color &foreground() const {
return palette_foreground;
}
/// background color
inline const math::Color &background() const {
return palette_background;
}
/// border color
inline const math::Color &border() const {
return palette_border;
}
/// text color
inline const math::Color &text() const {
return palette_text;
}
/// highlight color
inline const math::Color &highlight() const {
return palette_highlight;
}
/// disabled color
inline const math::Color &disabled() const {
return palette_disabled;
}
/// pointer color
inline const math::Color &pointer() const {
return palette_pointer;
}
/// active pointer color
inline const math::Color &active() const {
return palette_active;
}
/// debug color
inline const math::Color &debug() const {
return palette_debug;
}
/// mission color
inline const math::Color &mission() const {
return palette_mission;
}
/// bold text color
inline const math::Color &bold() const {
return palette_bold;
}
/// fancy text color
inline const math::Color &fancy() const {
return palette_fancy;
}
/// warning text color
inline const math::Color &warning() const {
return palette_warning;
}
/// error text color
inline const math::Color &error() const {
return palette_error;
}
// indexed color
const math::Color &color(Palette::Color palettecolor) const;
private:
// UI colors
math::Color palette_foreground;
math::Color palette_background;
math::Color palette_border;
math::Color palette_text;
math::Color palette_highlight;
math::Color palette_disabled;
math::Color palette_pointer;
math::Color palette_active;
math::Color palette_debug;
// HUD colors
math::Color palette_mission;
// additional text colors
math::Color palette_bold;
math::Color palette_fancy;
math::Color palette_warning;
math::Color palette_error;
};
}
#endif // __INCLUDED_UI_PALETTE_H__
|