-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStyle.cpp
executable file
·380 lines (327 loc) · 10.4 KB
/
Style.cpp
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
#include "StdAfx.h"
#include ".\Defines.h"
#include ".\style.h"
#include ".\resource.h"
using namespace Gdiplus;
#ifdef new
#undef new
#endif
/////////////////////////////////////////////////////////////////////////////
// //
// CCCCC LL AA SSSSS SSSSS //
// CC LL AAAA SS SS //
// CC LL AA AA SSSSS SSSSS //
// CC LL AAAAAAAA SS SS //
// CCCCC LLLLL AA AA SSSSS SSSSS //
// //
// //
// class Style //
// //
// Created: By: //
// 2005-03-16 - Hugo //
// //
// COMMENTS:
//
/////////////////////////////////////////////////////////////////////////////
Style::Style(void)
{
}
Style::~Style(void)
{
}
Style* Style::GetSetInstance(Style* installStyle)
{
static Style* currentStyle = NULL;
if(installStyle != NULL) {
bool installed = false;
if(currentStyle && currentStyle != installStyle) {
currentStyle->OnUninstall();
installed = true;
}
currentStyle = installStyle;
if(installed)
currentStyle->OnInstalled();
}
return currentStyle;
}
const static UINT wm_style_installed_message = ::RegisterWindowMessage(STR_WM_STYLE_UPDATED);
BOOL CALLBACK Style::_UpdateDisplayCallback(HWND wnd, LPARAM param)
{
Style* style = reinterpret_cast<Style*>(param);
::SendMessage (wnd, wm_style_installed_message, reinterpret_cast<WPARAM>(style), 0);
::InvalidateRect(wnd, NULL, TRUE);
::UpdateWindow (wnd);
return TRUE;
}
void Style::UpdateDisplay(HWND mainWindow)
{
_UpdateDisplayCallback(mainWindow, reinterpret_cast<LPARAM>(this));
::EnumChildWindows(mainWindow, _UpdateDisplayCallback, reinterpret_cast<LPARAM>(this));
}
void Style::OnInstalled()
{
}
LPCWSTR Style::GetTopImageResourceName()
{
return MAKEINTRESOURCEW(IDB_MINAKORT_TOP_LOGO);
}
Color Style::GetDarkColor()
{
return Color(0x5A,0x61,0x34);
}
Color Style::GetHighlightColor()
{
return Color(0xF0,0xF4,0xEC);
}
Brush* Style::GetDefaultBodyBrush(const CRect& bodyDimensions)
{
Color topColor (0xB8,0xC5,0x97);
Color bottomColor (0x9A,0xA9,0x75);
LinearGradientBrush* brush = new LinearGradientBrush(Point(0,0), Point(bodyDimensions.right,bodyDimensions.bottom), topColor, bottomColor);
return brush;
}
Pen* Style::GetDefaultBodyBorderPen()
{
Color borderColor = GetDarkColor();
Pen* borderPen = new Pen(borderColor, 2);
return borderPen;
}
Font* Style::GetProgressbarCaptionFont()
{
Font* captionFont = new Font(L"Trebuchet MS", 9, Gdiplus::FontStyleBold, Gdiplus::UnitPoint);
return captionFont;
}
Brush* Style::GetProgressbarAlternateCaptionBrush()
{
Color textColor (0xce,0xdb,0xc1);
return new SolidBrush(textColor);
}
Brush* Style::GetProgressbarCaptionBrush()
{
Color textColor = GetDarkColor();
return new SolidBrush(textColor);
}
Brush* Style::GetProgressbarBackgroundBrush()
{
Color backgroundColor = GetDarkColor();
return new SolidBrush(backgroundColor);
}
Color Style::GetProgressbarActiveColor()
{
return Color(0xCE, 0xDB, 0xC1);
}
Gdiplus::Brush* Style::GetProgressbarActiveBrush(const CRect& activeDimensions)
{
Color activeLeftColor = GetProgressbarActiveColor();
Color activeRightColor = GetHighlightColor();
return new LinearGradientBrush(Point(activeDimensions.left,activeDimensions.top), Point(activeDimensions.right,activeDimensions.top), activeLeftColor, activeRightColor);
}
Font* Style::GetDefaultLabelFont()
{
Font* captionFont = new Font(L"Trebuchet MS", 9, Gdiplus::FontStyleBold, Gdiplus::UnitPoint);
return captionFont;
}
Brush* Style::GetDefaultLabelBrush()
{
Color textColor = GetDarkColor();
return new SolidBrush(textColor);
}
CFont* Style::GetEditFont()
{
CFont* font = new CFont();
font->CreatePointFont(100, _T("Trebuchet MS"));
return font;
}
/////////////////////////////////////////////////////////////////////////////
// Main window:
Brush* Style::GetMainTopBrush()
{
Color topBackColor = GetHighlightColor();
return new SolidBrush(topBackColor);
}
Pen* Style::GetMainTopLine()
{
return new Pen(this->GetDarkColor(),2);
}
Font* Style::GetMainTitleFont()
{
return new Font(L"Trebuchet MS", 32, 0, UnitPoint);
}
Font* Style::GetDefaultHeaderFont()
{
return new Font(L"Georgia", 20, 0, UnitPoint);
}
COLORREF Style::GetDefaultEditBackground()
{
return GetHighlightColor().ToCOLORREF();
}
HBRUSH Style::GetDefaultEditPermanentBrush()
{
static CBrush brush(GetDefaultEditBackground());
return brush;
}
COLORREF Style::GetDefaultEditColor()
{
return this->GetDarkColor().ToCOLORREF();
}
COLORREF Style::GetDefaultEditDisabledBackground()
{
return RGB(0xE1,0xDB,0xCC);
}
COLORREF Style::GetDefaultEditDisabledColor()
{
return RGB(0x53,0x49,0x31);
}
HBRUSH Style::GetDefaultEditDisabledPermanentBrush()
{
static CBrush brush(GetDefaultEditDisabledBackground());
return brush;
}
Brush* Style::GetDetailsPreviewBackgroundBrush(const Rect& bounds)
{
return new SolidBrush(Color(0xFF,0xFF,0xFF));
}
Brush* Style::GetTipWindowBackground(const CRect& dimensions)
{
Color topColor (0xF3,0xEF,0xE9);
Color bottomColor (0xce,0xc4,0xb6);
return new LinearGradientBrush(Point(0,0), Point(dimensions.right, dimensions.bottom), topColor, bottomColor);
}
Pen* Style::GetTipWindowBorder()
{
Color borderColor (0x69,0x4B,0x1F);
return new Pen(borderColor, 2);
}
Brush* Style::GetTipWindowTextBrush()
{
Color textColor (0x34,0x2D,0x1F);
return new SolidBrush(textColor);
}
Brush* Style::GetButtonBackground(const CRect& clientRect)
{
Color topColor (0xCB,0xC1,0xAD);
Color bottomColor (0xB4,0xA4,0x83);
return new LinearGradientBrush(PointF(0,0), PointF(clientRect.right,clientRect.bottom), topColor,bottomColor);
}
Brush* Style::GetButtonTextBrush()
{
return new SolidBrush(Color(0x34,0x2D,0x1F));
}
Color Style::GetButtonBorderColor()
{
return Color(0x69,0x4B,0x1F);
}
Color Style::GetButtonBevelTopColor()
{
return Color(0xDC,0xD5,0xC7);
}
Color Style::GetButtonBevelBottomColor()
{
return Color(0x70,0x66,0x51);
}
Brush* Style::GetImagePreviewBackground(const CRect& clientRect)
{
Color backgroundTopColor (0xFD,0xFB,0xF7);
Color backgroundBottomColor (0xFC,0xF8,0xEF);
return new LinearGradientBrush(PointF(0,0), PointF(clientRect.right,clientRect.bottom), backgroundTopColor, backgroundBottomColor);
}
/////////////////////////////////////////////////////////////////////////////
// //
// CCCCC LL AA SSSSS SSSSS //
// CC LL AAAA SS SS //
// CC LL AA AA SSSSS SSSSS //
// CC LL AAAAAAAA SS SS //
// CCCCC LLLLL AA AA SSSSS SSSSS //
// //
// //
// class BlueStyle //
// //
// Created: By: //
// 2005-03-16 - Hugo //
// //
// COMMENTS:
//
/////////////////////////////////////////////////////////////////////////////
BlueStyle::BlueStyle()
{
}
BlueStyle::~BlueStyle()
{
}
LPCWSTR BlueStyle::GetTopImageResourceName()
{
return MAKEINTRESOURCEW(IDB_MINAKORT_TOP_LOGO_BLUE);
}
void BlueStyle::Install()
{
Style::GetSetInstance(GetTheBlueInstance());
}
void BlueStyle::OnUninstall()
{
}
Color BlueStyle::GetDarkColor()
{
return Color(0x29,0x3C,0x45);
}
Color BlueStyle::GetHighlightColor()
{
return Color(0xB6,0xCB,0xD6);
}
Color BlueStyle::GetProgressbarActiveColor()
{
return Color(0x94,0xB2,0xC3);
}
Brush* BlueStyle::GetDefaultBodyBrush(const CRect& bodyDimensions)
{
Color topColor (0x88,0xAA,0xD5);
Color bottomColor (0x47,0x67,0x78);
LinearGradientBrush* brush = new LinearGradientBrush(Point(0,0), Point(bodyDimensions.right,bodyDimensions.bottom), topColor, bottomColor);
return brush;
}
HBRUSH BlueStyle::GetDefaultEditPermanentBrush()
{
static CBrush brush(GetDefaultEditBackground());
return brush;
}
Brush* BlueStyle::GetTipWindowBackground(const CRect& dimensions)
{
Color topColor (0xF9,0xFA,0xFB);
Color bottomColor (0xCF,0xDC,0xDE);
return new LinearGradientBrush(Point(0,0), Point(dimensions.right, dimensions.bottom), topColor, bottomColor);
}
Pen* BlueStyle::GetTipWindowBorder()
{
return new Pen(GetDarkColor(), 2);
}
Brush* BlueStyle::GetTipWindowTextBrush()
{
return new SolidBrush(GetDarkColor());
}
Brush* BlueStyle::GetButtonBackground(const CRect& clientRect)
{
Color topColor (0x44,0x64,0x73);
Color bottomColor (0x29,0x3C,0x45);
return new LinearGradientBrush(PointF(0,0), PointF(clientRect.right,clientRect.bottom), topColor,bottomColor);
}
Brush* BlueStyle::GetButtonTextBrush()
{
return new SolidBrush(Color(0xFF,0xFF,0xFF));
}
Color BlueStyle::GetButtonBorderColor()
{
return Color(0x1B,0x26,0x2C);
}
Color BlueStyle::GetButtonBevelTopColor()
{
return Color(0x77,0x8E,0x99);
}
Color BlueStyle::GetButtonBevelBottomColor()
{
return Color(0x35,0x4E,0x59);
}
Brush* BlueStyle::GetImagePreviewBackground(const CRect& clientRect)
{
Color backgroundTopColor =this->GetDarkColor();
Color backgroundBottomColor (0x10,0x17,0x1B);
return new LinearGradientBrush(PointF(0,0), PointF(clientRect.right,clientRect.bottom), backgroundTopColor, backgroundBottomColor);
}