-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStyle.h
executable file
·255 lines (209 loc) · 6.95 KB
/
Style.h
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#pragma once
#include <gdiplus.h>
/////////////////////////////////////////////////////////////////////////////
//
// class Style
//
// Created: By:
// 2005-03-16 - Hugo
//
// COMMENTS:
//
/////////////////////////////////////////////////////////////////////////////
extern const UINT wm_style_installed_message;
class Style
{
/////////////////////////////////////////////////////////////////////////////
// ctor/dtor:
protected:
Style(void);
virtual ~Style(void);
private:
static BOOL CALLBACK _UpdateDisplayCallback(HWND wnd, LPARAM param);
protected:
static Style* DefaultStyleInstance()
{
static Style theStyle;
return &theStyle;
}
protected:
static Style* GetSetInstance(Style* installStyle=NULL);
virtual void OnUninstall()
{
}
virtual void OnInstalled();
/////////////////////////////////////////////////////////////////////////////
// Methods:
public:
static Style& Instance()
{
Style * current = GetSetInstance();
if(!current)
return *DefaultStyleInstance();
return *current;
}
static void Install()
{
GetSetInstance(DefaultStyleInstance());
}
static bool IsInstalled()
{
return DefaultStyleInstance()==GetSetInstance()||NULL==GetSetInstance();
}
void UpdateDisplay(HWND mainWindow);
static void Release(Gdiplus::GdiplusBase* object)
{
delete object;
}
static void Release(Gdiplus::Brush* object)
{
delete object;
}
static void Release(Gdiplus::Pen* object)
{
delete object;
}
static void Release(CFont* font)
{
delete font;
}
virtual LPCWSTR GetTopImageResourceName();
/////////////////////////////////////////////////////////////////////////////
// standard colors
virtual Gdiplus::Color GetDarkColor();
virtual Gdiplus::Color GetHighlightColor();
/////////////////////////////////////////////////////////////////////////////
// Main window
virtual Gdiplus::Brush* GetMainTopBrush();
virtual Gdiplus::Pen* GetMainTopLine();
virtual Gdiplus::Font* GetMainTitleFont();
/////////////////////////////////////////////////////////////////////////////
// default/main
virtual Gdiplus::Brush* GetDefaultBodyBrush(const CRect& bodyDimensions);
virtual Gdiplus::Pen* GetDefaultBodyBorderPen();
virtual Gdiplus::Font* GetDefaultLabelFont();
virtual Gdiplus::Brush* GetDefaultLabelBrush();
virtual Gdiplus::Font* GetDefaultHeaderFont();
/////////////////////////////////////////////////////////////////////////////
// progress bar
virtual Gdiplus::Font* GetProgressbarCaptionFont();
virtual Gdiplus::Brush* GetProgressbarAlternateCaptionBrush();
virtual Gdiplus::Brush* GetProgressbarCaptionBrush();
virtual Gdiplus::Brush* GetProgressbarBackgroundBrush();
virtual Gdiplus::Color GetProgressbarActiveColor();
virtual Gdiplus::Brush* GetProgressbarActiveBrush(const CRect& activeDimensions);
/////////////////////////////////////////////////////////////////////////////
// standard controls
virtual CFont* GetEditFont();
virtual COLORREF GetDefaultEditBackground();
virtual HBRUSH GetDefaultEditPermanentBrush();
virtual COLORREF GetDefaultEditColor();
virtual COLORREF GetDefaultEditDisabledBackground();
virtual HBRUSH GetDefaultEditDisabledPermanentBrush();
virtual COLORREF GetDefaultEditDisabledColor();
/////////////////////////////////////////////////////////////////////////////
// Tip window
virtual Gdiplus::Brush* GetTipWindowBackground(const CRect& dimensions);
virtual Gdiplus::Pen* GetTipWindowBorder();
virtual Gdiplus::Brush* GetTipWindowTextBrush();
/////////////////////////////////////////////////////////////////////////////
// Buttons
virtual Gdiplus::Brush* GetButtonBackground(const CRect& dimensions);
virtual Gdiplus::Brush* GetButtonTextBrush();
virtual Gdiplus::Color GetButtonBorderColor();
virtual Gdiplus::Color GetButtonBevelTopColor();
virtual Gdiplus::Color GetButtonBevelBottomColor();
/////////////////////////////////////////////////////////////////////////////
// preview
virtual Gdiplus::Brush* GetDetailsPreviewBackgroundBrush(const Gdiplus::Rect& bounds);
/////////////////////////////////////////////////////////////////////////////
// Image preview
virtual Gdiplus::Brush* GetImagePreviewBackground(const CRect& dimensions);
}; // End of class Style.
/////////////////////////////////////////////////////////////////////////////
//
// class BlueStyle
//
// Created: By:
// 2005-03-16 - Hugo
//
// COMMENTS:
//
/////////////////////////////////////////////////////////////////////////////
class BlueStyle : public Style
{
/////////////////////////////////////////////////////////////////////////////
// ctor/dtor:
private:
BlueStyle();
virtual ~BlueStyle();
virtual void OnUninstall();
/////////////////////////////////////////////////////////////////////////////
// Methods:
public:
static void Install();
static bool IsInstalled()
{
return GetTheBlueInstance() == GetSetInstance();
}
static BlueStyle* GetTheBlueInstance()
{
static BlueStyle theBlue;
return &theBlue;
}
public:
virtual LPCWSTR GetTopImageResourceName();
virtual Gdiplus::Color GetDarkColor();
virtual Gdiplus::Color GetHighlightColor();
virtual Gdiplus::Brush* GetDefaultBodyBrush(const CRect& bodyDimensions);
virtual HBRUSH GetDefaultEditPermanentBrush();
virtual Gdiplus::Color GetProgressbarActiveColor();
/////////////////////////////////////////////////////////////////////////////
// Tip window
virtual Gdiplus::Brush* GetTipWindowBackground(const CRect& dimensions);
virtual Gdiplus::Pen* GetTipWindowBorder();
virtual Gdiplus::Brush* GetTipWindowTextBrush();
/////////////////////////////////////////////////////////////////////////////
// Buttons
virtual Gdiplus::Brush* GetButtonBackground(const CRect& dimensions);
virtual Gdiplus::Brush* GetButtonTextBrush();
virtual Gdiplus::Color GetButtonBorderColor();
virtual Gdiplus::Color GetButtonBevelTopColor();
virtual Gdiplus::Color GetButtonBevelBottomColor();
/////////////////////////////////////////////////////////////////////////////
// Image preview
virtual Gdiplus::Brush* GetImagePreviewBackground(const CRect& dimensions);
}; // End of class BlueStyle.
template<class T> class StyleObject
{
public:
StyleObject() {
this->object = NULL;
}
StyleObject(T* object) {
this->object = object;
}
StyleObject(const StyleObject<T>&) {
ASSERT(FALSE);
}
~StyleObject() {
Style::Release(this->object);
}
operator = (const StyleObject<T>&) {
ASSERT(FALSE);
}
operator = (T* arg) {
if(this->object == arg)
return reinterpret_cast<INT_PTR>(this->object);
Style::Release(this->object);
this->object = arg;
return reinterpret_cast<INT_PTR>(this->object);
}
T* operator -> () {
return this->object;
}
operator T*() {
return this->object;
}
T* object;
};