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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
|
#include "precomp__gen_ff.h"
#include "gen_ff_ipc.h"
#include "ff_ipc.h"
#include "../winamp/wa_ipc.h"
#include "wa2frontend.h"
#include <tataki/color/skinclr.h>
#include <api/wnd/wndclass/buttwnd.h>
#include <api/wndmgr/skinwnd.h>
#include <tataki/blending/blending.h>
#include <api/skin/skinparse.h>
#include <api/wnd/wndtrack.h>
#include "wa2wndembed.h"
#include "embedwndguid.h"
#include <tataki/canvas/bltcanvas.h>
#include "../nu/AutoChar.h"
#include "../nu/AutoWide.h"
ColorThemeMonitor *colorThemeMonitor = NULL;
HBITMAP CreateBitmapDIB(int w, int h, int planes, int bpp, void *data)
{
#if 0
return CreateBitmap(w, h, planes, bpp, data);
#else
void *bits=0;
BITMAPINFO bmi={0,};
bmi.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = w;
bmi.bmiHeader.biHeight = -h;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = bpp;
bmi.bmiHeader.biSizeImage = w*h*(bpp/8);
bmi.bmiHeader.biCompression=BI_RGB;
HBITMAP bm=CreateDIBSection(0,&bmi,0,&bits,NULL,0);
if (bm && bits) memcpy(bits,data,w*h*(bpp/8));
return bm;
#endif
}
HWND ff_ipc_getContentWnd(HWND w) {
HWND ret = w;
ifc_window *wnd = windowTracker->rootWndFromHwnd(w); // TODO: API_WNDMGR->
if (wnd) {
ifc_window *dp = wnd->getDesktopParent();
if (dp) {
Layout *l = static_cast<Layout *>(dp->getInterface(layoutGuid));
if (l) {
Container *c = l->getParentContainer();
if (c) {
GUID g = c->getDefaultContent();
if (g != INVALID_GUID) {
if (g == playerWndGuid)
ret = wa2.getMainWindow();
else if (g == pleditWndGuid)
ret = wa2.getWnd(IPC_GETWND_PE);
else if (g == videoWndGuid)
ret = wa2.getWnd(IPC_GETWND_VIDEO);
else {
embedWindowState *ews = embedWndGuidMgr.getEmbedWindowState(g);
if (ews)
ret = ews->me;
}
}
}
}
}
}
return ret;
}
void ff_ipc_getSkinColor(ff_skincolor *cs)
{
if (cs == NULL) return;
cs->color = RGBTOBGR(SkinColor(AutoWide(cs->colorname)));
}
#define USE_WIN32_ALPHABLEND
static void ButtonSetup(ButtonWnd &_w)
{
_w.setVirtual(0);
_w.setStartHidden(1);
_w.setParent(WASABI_API_WND->main_getRootWnd());
_w.init(WASABI_API_WND->main_getRootWnd());
_w.setCloaked(1);
_w.setVisible(1);
}
static void DoButtonBlit(ButtonWnd &_w, int w, int h, int state, const wchar_t *overlayelement, int xpos, int ypos, BltCanvas *c)
{
if (state == BUTTONSTATE_PUSHED) _w.setPushed(1);
else _w.setPushed(0);
_w.resize(0, 0, w, h);
_w.deferedInvalidate();
_w.paint(NULL, NULL);
Canvas *cv = NULL;
cv = _w.getFrameBuffer();
if (cv != NULL) {
BltCanvas *bltcanvas = static_cast<BltCanvas *>(cv); // hackish
#ifdef USE_WIN32_ALPHABLEND
bltcanvas->/*getSkinBitmap()->*/blitAlpha(c, xpos, ypos);
#else
bltcanvas->getSkinBitmap()->blitAlpha(c, xpos, ypos);
#endif
}
if (overlayelement && *overlayelement) {
AutoSkinBitmap b(overlayelement);
SkinBitmap *sb = b.getBitmap();
int shift = (state == BUTTONSTATE_PUSHED) ? 1 : 0;
sb->blitAlpha(c, xpos+(w-sb->getWidth())/2+shift, ypos+(h-sb->getHeight())/2+shift);
}
}
void blitButtonToCanvas(int w, int h, int state, const wchar_t *overlayelement, int xpos, int ypos, BltCanvas *c)
{
ButtonWnd _w;
ButtonSetup(_w);
DoButtonBlit(_w, w, h, state, overlayelement, xpos, ypos, c);
}
static HBITMAP generateButtonBitmap(int w, int h, int state, const wchar_t *overlayelement=NULL) {
BltCanvas c(w, h);
blitButtonToCanvas(w,h,state,overlayelement,0,0,&c);
SysCanvas cc;
c.blit(0, 0, &cc, 0, 0, w, h);
return CreateBitmapDIB(w, h, 1, 32, c.getBits());
}
COLORREF getWindowBackground(COLORREF *wb)
{
static String last_skin, last_theme;
static COLORREF last_windowbackground = 0x00000000;
COLORREF windowbackground = 0x00000000;
// window background (used to set the bg color for the dialog)
if (!WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.window.background"))
{
String curskin = AutoChar(WASABI_API_SKIN->getSkinName());
String curtheme = AutoChar(WASABI_API_SKIN->colortheme_getColorSet());
if (!last_skin.iscaseequal(curskin) || !last_theme.iscaseequal(curtheme)) {
last_skin = curskin;
last_theme = curtheme;
// extract the window color from an active piece of skin
SkinWnd w(L"$$$.some.purposedly.undefined.group.$$$", NULL, 0, NULL, 1, 1);
ifc_window *wnd = w.getWindow();
if (wnd != NULL) {
ifc_window *wh = wnd->findWindowByInterface(windowHolderGuid);
if (wh != NULL) {
wnd = wnd->getDesktopParent();
if (w.isNewContainer()) {
wnd->setCloaked(1);
wnd->setVisible(1);
wnd->resize(0, 0, 320, 200);
wnd->paint();
}
BltCanvas *canvas = static_cast<BltCanvas *>(wnd->getFrameBuffer());
if (!canvas) goto basetexture; // eek :-D
int x=0, y=0;
RECT r;
wh->getClientRect(&r);
x = r.left + (r.right-r.left)/2; y = r.top + (r.bottom-r.top)/2;
COLORREF *bits = (COLORREF *)canvas->getBits();
int w, h;
canvas->getDim(&w, &h, NULL);
if (w == 0 || h == 0)
windowbackground = 0; // black by default
else
windowbackground = bits[y*w+x];
}
}
w.destroy();
if (windowbackground == 0x00000000) {
basetexture:
// try for wasabi.basetexture ...
int _w, _h, _x, _y;
ARGB32 *b = WASABI_API_SKIN->imgldr_requestSkinBitmap(L"wasabi.basetexture", NULL, &_x, &_y, NULL, NULL, &_w, &_h, 1);
if (b != NULL) {
windowbackground = b[_w*_y+_x];
WASABI_API_SKIN->imgldr_releaseSkinBitmap(b);
} else {
// no idea... we'll just set the default windows color
windowbackground = GetSysColor(COLOR_WINDOWFRAME);
}
}
last_windowbackground = windowbackground;
} else {
windowbackground = last_windowbackground;
}
if (wb) *wb=windowbackground;
return windowbackground;
} else {
COLORREF c = RGBTOBGR(SkinColor(L"wasabi.window.background"));
if (wb) *wb = c;
return c;
}
}
inline int lumidiff(int a, int b) {
int r1 = (a & 0xFF0000) >> 16;
int r2 = (b & 0xFF0000) >> 16;
int g1 = (a & 0xFF00) >> 8;
int g2 = (b & 0xFF00) >> 8;
int b1 = a & 0xFF;
int b2 = b & 0xFF;
return MIN((ABS(r1-r2), ABS(g1-g2)), ABS(b1-b2));
}
HBITMAP ff_genwa2skinbitmap()
{
int interpolate = 0;
if (SkinParser::getSkinVersion()*10 < 10) interpolate = 1;
BltCanvas c(132, 75);
COLORREF windowbackground = 0;
COLORREF wbg=getWindowBackground(&windowbackground);
COLORREF *ptr=(COLORREF *)c.getBits();
c.fillBits(wbg);
// set up bg color for the picky pixel parser heh
int x;
for (x = 47; x < 132; x ++) ptr[x]=ptr[x+132]=RGB(0,198,255);
ButtonWnd _w;
ButtonSetup(_w);
DoButtonBlit(_w, 47,15,0,NULL,0,0,&c);
DoButtonBlit(_w, 47,15,1,NULL,0,15,&c);
DoButtonBlit(_w, 14,14,0,L"wasabi.button.label.arrow.up",0,31,&c);
DoButtonBlit(_w, 14,14,0,L"wasabi.button.label.arrow.down",14,31,&c);
DoButtonBlit(_w, 14,14,1,L"wasabi.button.label.arrow.up",28,31,&c);
DoButtonBlit(_w, 14,14,1,L"wasabi.button.label.arrow.down",42,31,&c);
DoButtonBlit(_w, 14,14,0,L"wasabi.button.label.arrow.left",0,45,&c);
DoButtonBlit(_w, 14,14,0,L"wasabi.button.label.arrow.right",14,45,&c);
DoButtonBlit(_w, 14,14,1,L"wasabi.button.label.arrow.left",28,45,&c);
DoButtonBlit(_w, 14,14,1,L"wasabi.button.label.arrow.right",42,45,&c);
DoButtonBlit(_w, 14,28,0,L"wasabi.scrollbar.vertical.grip",56,31,&c);
DoButtonBlit(_w, 14,28,1,L"wasabi.scrollbar.vertical.grip",70,31,&c);
DoButtonBlit(_w, 28,14,0,L"wasabi.scrollbar.horizontal.grip",84,31,&c);
DoButtonBlit(_w, 28,14,1,L"wasabi.scrollbar.horizontal.grip",84,45,&c);
// item background (background to edits, listviews etc)
if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.background"))
ptr[48] = RGBTOBGR(SkinColor(L"wasabi.list.background"));
else
ptr[48] = WASABI_API_SKIN->skin_getBitmapColor(L"wasabi.list.background"); // RGBTOBGR(SkinColor(L"wasabi.edit.background"));
COLORREF listbkg = ptr[48];
// item foreground (text color of edit/listview, etc)
if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text"))
ptr[50] = RGBTOBGR(SkinColor(L"wasabi.list.text"));
else {
int c = RGBTOBGR(SkinColor(L"wasabi.edit.text"));
ptr[50] = c;
}
if (interpolate) {
int c = ptr[50];
c = lumidiff(c, listbkg) < 0x1F ? Blenders::BLEND_AVG(ptr[50], 0xFF7F7F7F) : c;
c = lumidiff(c, listbkg) < 0x1F ? Blenders::BLEND_AVG(ptr[50], 0xFF101010) : c;
ptr[50] = c | 0xFF000000;
}
ptr[52] = wbg;
ptr[54] = RGBTOBGR(SkinColor(SKINCOLOR_BUTTON_TEXT));
// window text color
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.window.text"))
ptr[56] = RGBTOBGR(SkinColor(L"wasabi.window.text"));
else {
ptr[56] = RGBTOBGR(SkinColor(SKINCOLOR_LIST_ITEMTEXT)); //"wasabi.textbar.text");//
}
// color of dividers and sunken borders
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.border.sunken"))
ptr[58] = RGBTOBGR(SkinColor(L"wasabi.border.sunken"));
else {
int a = MAX((windowbackground & 0xFF0000) >> 16, MAX((windowbackground & 0xFF00) >> 8, windowbackground & 0xFF));
ptr[58] = Blenders::BLEND_AVG(windowbackground, a > 0xE0 ? 0xFF000000: 0xFFFFFFFF);
}
// listview header background color
COLORREF col = RGBTOBGR(SkinColor(SKINCOLOR_LIST_COLUMNBKG));
if (interpolate) {
int a = MAX((col & 0xFF0000) >> 16, MAX((col & 0xFF00) >> 8, col & 0xFF));
col = a < 0x1F ? Blenders::BLEND_AVG(windowbackground, 0xFF000000) : col;
}
ptr[62] = col;
// listview header text color
ptr[64] = RGBTOBGR(SkinColor(SKINCOLOR_LIST_COLUMNTEXT));
// listview header frame top color
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.column.frame.top"))
ptr[66] = RGBTOBGR(SkinColor(L"wasabi.list.column.frame.top"));
else
ptr[66] = Blenders::BLEND_AVG(col, 0xFFFFFFFF);//listview header frame top color
// listview header frame middle color
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.column.frame.middle"))
ptr[68] = RGBTOBGR(SkinColor(L"wasabi.list.column.frame.middle"));
else
ptr[68] = Blenders::BLEND_AVG(col, 0xFF2F2F2F);
// listview header frame bottom color
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.column.frame.bottom"))
ptr[70] = RGBTOBGR(SkinColor(L"wasabi.list.column.frame.bottom"));
else
ptr[70] = Blenders::BLEND_AVG(col, 0xFF000000);
// listview header empty color
COLORREF empty;
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.column.empty"))
empty = RGBTOBGR(SkinColor(L"wasabi.list.column.empty"));
else
empty = Blenders::BLEND_AVG(col, 0xFF000000);
ptr[72] = empty;
// scrollbar foreground color
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.scrollbar.foreground"))
ptr[74] = RGBTOBGR(SkinColor(L"wasabi.scrollbar.foreground"));
else
ptr[74] = empty;
// scrollbar background color
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.scrollbar.background"))
ptr[76] = RGBTOBGR(SkinColor(L"wasabi.scrollbar.background"));
else
ptr[76] = empty;
// inverse scrollbar foreground color
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.scrollbar.foreground.inverted"))
ptr[78] = RGBTOBGR(SkinColor(L"wasabi.scrollbar.foreground.inverted"));
else
ptr[78] = col;
// inverse scrollbar background color
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.scrollbar.background.inverted"))
ptr[80] = RGBTOBGR(SkinColor(L"wasabi.scrollbar.background.inverted"));
else
ptr[80] = empty;
// scrollbar dead area color
ptr[82] = windowbackground;
// listview/treeview selection bar text color
COLORREF selfg;
if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text.selected"))
selfg = RGBTOBGR(SkinColor(L"wasabi.list.text.selected"));
else
if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text"))
selfg = RGBTOBGR(SkinColor(L"wasabi.list.text"));
else
selfg = SkinColor(L"wasabi.edit.text");
ptr[84] = selfg;
// listview/treeview selection bar back color
COLORREF selbg;
if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text.selected.background"))
selbg = RGBTOBGR(SkinColor(L"wasabi.list.text.selected.background"));
else {
if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.item.selected"))
selbg = RGBTOBGR(SkinColor(L"wasabi.list.item.selected"));
else
selbg = RGBTOBGR(SkinColor(SKINCOLOR_TREE_SELITEMBKG));
selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(windowbackground, 0xFF7F7F7F) : selbg;
selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(listbkg, 0xFF7F7F7F) : selbg;
selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(windowbackground, 0xFFF0F0F0) : selbg;
selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(listbkg, 0xFFF0F0F0) : selbg;
selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(col, 0xFFF0F0F0) : selbg;
selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(col, 0xFF101010) : selbg;
selbg = lumidiff(selbg, selfg) < 0x1F ? Blenders::BLEND_AVG(selbg, 0xFF101010) : selbg;
selbg = lumidiff(selbg, selfg) < 0x1F ? Blenders::BLEND_AVG(selbg, 0xFFF0F0F0) : selbg;
}
ptr[86] = ptr[60] = (selbg | 0xFF000000);
// listview/treeview selection bar text color (inactive)
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text.selected.inactive"))
ptr[88] = RGBTOBGR(SkinColor(L"wasabi.list.text.selected.inactive"));
else
ptr[88] = selfg;
// listview/treeview selection bar back color (inactive)
if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text.selected.background.inactive"))
ptr[90] = RGBTOBGR(SkinColor(L"wasabi.list.text.selected.background.inactive"));
else
ptr[90] = Blenders::BLEND_ADJ1(selbg, 0xFF000000, 210);
// alternate item background
if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.background.alternate"))
ptr[92] = RGBTOBGR(SkinColor(L"wasabi.list.background.alternate"));
else
ptr[92] = ptr[48];
// alternate item foreground
if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text.alternate"))
{
ptr[50] = RGBTOBGR(SkinColor(L"wasabi.list.text.alternate"));
if (interpolate) {
int c = ptr[94];
c = lumidiff(c, listbkg) < 0x1F ? Blenders::BLEND_AVG(ptr[94], 0xFF7F7F7F) : c;
c = lumidiff(c, listbkg) < 0x1F ? Blenders::BLEND_AVG(ptr[94], 0xFF101010) : c;
ptr[94] = c | 0xFF000000;
}
}
else {
ptr[94] = ptr[50];
}
return CreateBitmapDIB(132, 75, 1, 32, c.getBits());
}
void ff_ipc_genSkinBitmap(ff_skinbitmap *sb) {
if (sb == NULL) return;
switch (sb->id) {
case SKINBITMAP_BUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state);
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBARVBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state, L"wasabi.scrollbar.vertical.grip");
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBARHBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state, L"wasabi.scrollbar.horizontal.grip");
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBARUPBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state, L"wasabi.button.label.arrow.up");
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBARDOWNBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state, L"wasabi.button.label.arrow.down");
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBARLEFTBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state, L"wasabi.button.label.arrow.left");
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBAR_FF_UPBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.vertical.left.pressed":
((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.vertical.left.hover":
L"wasabi.scrollbar.vertical.left")));
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBAR_FF_DOWNBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.vertical.right.pressed":
((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.vertical.right.hover":
L"wasabi.scrollbar.vertical.right")));
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBAR_FF_LEFTBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.horizontal.left.pressed":
((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.horizontal.left.hover":
L"wasabi.scrollbar.horizontal.left")));
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBAR_FF_RIGHTBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.horizontal.right.pressed":
((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.horizontal.right.hover":
L"wasabi.scrollbar.horizontal.right")));
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBAR_FF_BARHBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.horizontal.button.pressed":
((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.horizontal.button.hover":
L"wasabi.scrollbar.horizontal.button")));
sb->bitmap = bmp;
break;
}
case SKINBITMAP_SCROLLBAR_FF_BARVBUTTON: {
HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.vertical.button.pressed":
((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.vertical.button.hover":
L"wasabi.scrollbar.vertical.button.pressed")));
sb->bitmap = bmp;
break;
}
}
#if 0 // debug
HDC ddc = GetDC(NULL);
HDC sdc = CreateCompatibleDC(ddc);
SelectObject(sdc, sb->bitmap);
BitBlt(ddc, 100, 100, sb->w, sb->h, sdc, 0, 0, SRCCOPY);
DeleteObject(sdc);
ReleaseDC(NULL, ddc);
#endif
}
ColorThemeMonitor::ColorThemeMonitor() {
WASABI_API_SYSCB->syscb_registerCallback(this);
}
ColorThemeMonitor::~ColorThemeMonitor() {
WASABI_API_SYSCB->syscb_deregisterCallback(this);
}
int ColorThemeMonitor::skincb_onColorThemeChanged( const wchar_t *colortheme )
{
SendMessageW( wa2.getMainWindow(), WM_WA_IPC, (WPARAM) colortheme, IPC_FF_ONCOLORTHEMECHANGED );
return 1;
}
|