1
0

ff_ipc.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. #include "precomp__gen_ff.h"
  2. #include "gen_ff_ipc.h"
  3. #include "ff_ipc.h"
  4. #include "../winamp/wa_ipc.h"
  5. #include "wa2frontend.h"
  6. #include <tataki/color/skinclr.h>
  7. #include <api/wnd/wndclass/buttwnd.h>
  8. #include <api/wndmgr/skinwnd.h>
  9. #include <tataki/blending/blending.h>
  10. #include <api/skin/skinparse.h>
  11. #include <api/wnd/wndtrack.h>
  12. #include "wa2wndembed.h"
  13. #include "embedwndguid.h"
  14. #include <tataki/canvas/bltcanvas.h>
  15. #include "../nu/AutoChar.h"
  16. #include "../nu/AutoWide.h"
  17. ColorThemeMonitor *colorThemeMonitor = NULL;
  18. HBITMAP CreateBitmapDIB(int w, int h, int planes, int bpp, void *data)
  19. {
  20. #if 0
  21. return CreateBitmap(w, h, planes, bpp, data);
  22. #else
  23. void *bits=0;
  24. BITMAPINFO bmi={0,};
  25. bmi.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
  26. bmi.bmiHeader.biWidth = w;
  27. bmi.bmiHeader.biHeight = -h;
  28. bmi.bmiHeader.biPlanes = 1;
  29. bmi.bmiHeader.biBitCount = bpp;
  30. bmi.bmiHeader.biSizeImage = w*h*(bpp/8);
  31. bmi.bmiHeader.biCompression=BI_RGB;
  32. HBITMAP bm=CreateDIBSection(0,&bmi,0,&bits,NULL,0);
  33. if (bm && bits) memcpy(bits,data,w*h*(bpp/8));
  34. return bm;
  35. #endif
  36. }
  37. HWND ff_ipc_getContentWnd(HWND w) {
  38. HWND ret = w;
  39. ifc_window *wnd = windowTracker->rootWndFromHwnd(w); // TODO: API_WNDMGR->
  40. if (wnd) {
  41. ifc_window *dp = wnd->getDesktopParent();
  42. if (dp) {
  43. Layout *l = static_cast<Layout *>(dp->getInterface(layoutGuid));
  44. if (l) {
  45. Container *c = l->getParentContainer();
  46. if (c) {
  47. GUID g = c->getDefaultContent();
  48. if (g != INVALID_GUID) {
  49. if (g == playerWndGuid)
  50. ret = wa2.getMainWindow();
  51. else if (g == pleditWndGuid)
  52. ret = wa2.getWnd(IPC_GETWND_PE);
  53. else if (g == videoWndGuid)
  54. ret = wa2.getWnd(IPC_GETWND_VIDEO);
  55. else {
  56. embedWindowState *ews = embedWndGuidMgr.getEmbedWindowState(g);
  57. if (ews)
  58. ret = ews->me;
  59. }
  60. }
  61. }
  62. }
  63. }
  64. }
  65. return ret;
  66. }
  67. void ff_ipc_getSkinColor(ff_skincolor *cs)
  68. {
  69. if (cs == NULL) return;
  70. cs->color = RGBTOBGR(SkinColor(AutoWide(cs->colorname)));
  71. }
  72. #define USE_WIN32_ALPHABLEND
  73. static void ButtonSetup(ButtonWnd &_w)
  74. {
  75. _w.setVirtual(0);
  76. _w.setStartHidden(1);
  77. _w.setParent(WASABI_API_WND->main_getRootWnd());
  78. _w.init(WASABI_API_WND->main_getRootWnd());
  79. _w.setCloaked(1);
  80. _w.setVisible(1);
  81. }
  82. static void DoButtonBlit(ButtonWnd &_w, int w, int h, int state, const wchar_t *overlayelement, int xpos, int ypos, BltCanvas *c)
  83. {
  84. if (state == BUTTONSTATE_PUSHED) _w.setPushed(1);
  85. else _w.setPushed(0);
  86. _w.resize(0, 0, w, h);
  87. _w.deferedInvalidate();
  88. _w.paint(NULL, NULL);
  89. Canvas *cv = NULL;
  90. cv = _w.getFrameBuffer();
  91. if (cv != NULL) {
  92. BltCanvas *bltcanvas = static_cast<BltCanvas *>(cv); // hackish
  93. #ifdef USE_WIN32_ALPHABLEND
  94. bltcanvas->/*getSkinBitmap()->*/blitAlpha(c, xpos, ypos);
  95. #else
  96. bltcanvas->getSkinBitmap()->blitAlpha(c, xpos, ypos);
  97. #endif
  98. }
  99. if (overlayelement && *overlayelement) {
  100. AutoSkinBitmap b(overlayelement);
  101. SkinBitmap *sb = b.getBitmap();
  102. int shift = (state == BUTTONSTATE_PUSHED) ? 1 : 0;
  103. sb->blitAlpha(c, xpos+(w-sb->getWidth())/2+shift, ypos+(h-sb->getHeight())/2+shift);
  104. }
  105. }
  106. void blitButtonToCanvas(int w, int h, int state, const wchar_t *overlayelement, int xpos, int ypos, BltCanvas *c)
  107. {
  108. ButtonWnd _w;
  109. ButtonSetup(_w);
  110. DoButtonBlit(_w, w, h, state, overlayelement, xpos, ypos, c);
  111. }
  112. static HBITMAP generateButtonBitmap(int w, int h, int state, const wchar_t *overlayelement=NULL) {
  113. BltCanvas c(w, h);
  114. blitButtonToCanvas(w,h,state,overlayelement,0,0,&c);
  115. SysCanvas cc;
  116. c.blit(0, 0, &cc, 0, 0, w, h);
  117. return CreateBitmapDIB(w, h, 1, 32, c.getBits());
  118. }
  119. COLORREF getWindowBackground(COLORREF *wb)
  120. {
  121. static String last_skin, last_theme;
  122. static COLORREF last_windowbackground = 0x00000000;
  123. COLORREF windowbackground = 0x00000000;
  124. // window background (used to set the bg color for the dialog)
  125. if (!WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.window.background"))
  126. {
  127. String curskin = AutoChar(WASABI_API_SKIN->getSkinName());
  128. String curtheme = AutoChar(WASABI_API_SKIN->colortheme_getColorSet());
  129. if (!last_skin.iscaseequal(curskin) || !last_theme.iscaseequal(curtheme)) {
  130. last_skin = curskin;
  131. last_theme = curtheme;
  132. // extract the window color from an active piece of skin
  133. SkinWnd w(L"$$$.some.purposedly.undefined.group.$$$", NULL, 0, NULL, 1, 1);
  134. ifc_window *wnd = w.getWindow();
  135. if (wnd != NULL) {
  136. ifc_window *wh = wnd->findWindowByInterface(windowHolderGuid);
  137. if (wh != NULL) {
  138. wnd = wnd->getDesktopParent();
  139. if (w.isNewContainer()) {
  140. wnd->setCloaked(1);
  141. wnd->setVisible(1);
  142. wnd->resize(0, 0, 320, 200);
  143. wnd->paint();
  144. }
  145. BltCanvas *canvas = static_cast<BltCanvas *>(wnd->getFrameBuffer());
  146. if (!canvas) goto basetexture; // eek :-D
  147. int x=0, y=0;
  148. RECT r;
  149. wh->getClientRect(&r);
  150. x = r.left + (r.right-r.left)/2; y = r.top + (r.bottom-r.top)/2;
  151. COLORREF *bits = (COLORREF *)canvas->getBits();
  152. int w, h;
  153. canvas->getDim(&w, &h, NULL);
  154. if (w == 0 || h == 0)
  155. windowbackground = 0; // black by default
  156. else
  157. windowbackground = bits[y*w+x];
  158. }
  159. }
  160. w.destroy();
  161. if (windowbackground == 0x00000000) {
  162. basetexture:
  163. // try for wasabi.basetexture ...
  164. int _w, _h, _x, _y;
  165. ARGB32 *b = WASABI_API_SKIN->imgldr_requestSkinBitmap(L"wasabi.basetexture", NULL, &_x, &_y, NULL, NULL, &_w, &_h, 1);
  166. if (b != NULL) {
  167. windowbackground = b[_w*_y+_x];
  168. WASABI_API_SKIN->imgldr_releaseSkinBitmap(b);
  169. } else {
  170. // no idea... we'll just set the default windows color
  171. windowbackground = GetSysColor(COLOR_WINDOWFRAME);
  172. }
  173. }
  174. last_windowbackground = windowbackground;
  175. } else {
  176. windowbackground = last_windowbackground;
  177. }
  178. if (wb) *wb=windowbackground;
  179. return windowbackground;
  180. } else {
  181. COLORREF c = RGBTOBGR(SkinColor(L"wasabi.window.background"));
  182. if (wb) *wb = c;
  183. return c;
  184. }
  185. }
  186. inline int lumidiff(int a, int b) {
  187. int r1 = (a & 0xFF0000) >> 16;
  188. int r2 = (b & 0xFF0000) >> 16;
  189. int g1 = (a & 0xFF00) >> 8;
  190. int g2 = (b & 0xFF00) >> 8;
  191. int b1 = a & 0xFF;
  192. int b2 = b & 0xFF;
  193. return MIN((ABS(r1-r2), ABS(g1-g2)), ABS(b1-b2));
  194. }
  195. HBITMAP ff_genwa2skinbitmap()
  196. {
  197. int interpolate = 0;
  198. if (SkinParser::getSkinVersion()*10 < 10) interpolate = 1;
  199. BltCanvas c(132, 75);
  200. COLORREF windowbackground = 0;
  201. COLORREF wbg=getWindowBackground(&windowbackground);
  202. COLORREF *ptr=(COLORREF *)c.getBits();
  203. c.fillBits(wbg);
  204. // set up bg color for the picky pixel parser heh
  205. int x;
  206. for (x = 47; x < 132; x ++) ptr[x]=ptr[x+132]=RGB(0,198,255);
  207. ButtonWnd _w;
  208. ButtonSetup(_w);
  209. DoButtonBlit(_w, 47,15,0,NULL,0,0,&c);
  210. DoButtonBlit(_w, 47,15,1,NULL,0,15,&c);
  211. DoButtonBlit(_w, 14,14,0,L"wasabi.button.label.arrow.up",0,31,&c);
  212. DoButtonBlit(_w, 14,14,0,L"wasabi.button.label.arrow.down",14,31,&c);
  213. DoButtonBlit(_w, 14,14,1,L"wasabi.button.label.arrow.up",28,31,&c);
  214. DoButtonBlit(_w, 14,14,1,L"wasabi.button.label.arrow.down",42,31,&c);
  215. DoButtonBlit(_w, 14,14,0,L"wasabi.button.label.arrow.left",0,45,&c);
  216. DoButtonBlit(_w, 14,14,0,L"wasabi.button.label.arrow.right",14,45,&c);
  217. DoButtonBlit(_w, 14,14,1,L"wasabi.button.label.arrow.left",28,45,&c);
  218. DoButtonBlit(_w, 14,14,1,L"wasabi.button.label.arrow.right",42,45,&c);
  219. DoButtonBlit(_w, 14,28,0,L"wasabi.scrollbar.vertical.grip",56,31,&c);
  220. DoButtonBlit(_w, 14,28,1,L"wasabi.scrollbar.vertical.grip",70,31,&c);
  221. DoButtonBlit(_w, 28,14,0,L"wasabi.scrollbar.horizontal.grip",84,31,&c);
  222. DoButtonBlit(_w, 28,14,1,L"wasabi.scrollbar.horizontal.grip",84,45,&c);
  223. // item background (background to edits, listviews etc)
  224. if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.background"))
  225. ptr[48] = RGBTOBGR(SkinColor(L"wasabi.list.background"));
  226. else
  227. ptr[48] = WASABI_API_SKIN->skin_getBitmapColor(L"wasabi.list.background"); // RGBTOBGR(SkinColor(L"wasabi.edit.background"));
  228. COLORREF listbkg = ptr[48];
  229. // item foreground (text color of edit/listview, etc)
  230. if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text"))
  231. ptr[50] = RGBTOBGR(SkinColor(L"wasabi.list.text"));
  232. else {
  233. int c = RGBTOBGR(SkinColor(L"wasabi.edit.text"));
  234. ptr[50] = c;
  235. }
  236. if (interpolate) {
  237. int c = ptr[50];
  238. c = lumidiff(c, listbkg) < 0x1F ? Blenders::BLEND_AVG(ptr[50], 0xFF7F7F7F) : c;
  239. c = lumidiff(c, listbkg) < 0x1F ? Blenders::BLEND_AVG(ptr[50], 0xFF101010) : c;
  240. ptr[50] = c | 0xFF000000;
  241. }
  242. ptr[52] = wbg;
  243. ptr[54] = RGBTOBGR(SkinColor(SKINCOLOR_BUTTON_TEXT));
  244. // window text color
  245. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.window.text"))
  246. ptr[56] = RGBTOBGR(SkinColor(L"wasabi.window.text"));
  247. else {
  248. ptr[56] = RGBTOBGR(SkinColor(SKINCOLOR_LIST_ITEMTEXT)); //"wasabi.textbar.text");//
  249. }
  250. // color of dividers and sunken borders
  251. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.border.sunken"))
  252. ptr[58] = RGBTOBGR(SkinColor(L"wasabi.border.sunken"));
  253. else {
  254. int a = MAX((windowbackground & 0xFF0000) >> 16, MAX((windowbackground & 0xFF00) >> 8, windowbackground & 0xFF));
  255. ptr[58] = Blenders::BLEND_AVG(windowbackground, a > 0xE0 ? 0xFF000000: 0xFFFFFFFF);
  256. }
  257. // listview header background color
  258. COLORREF col = RGBTOBGR(SkinColor(SKINCOLOR_LIST_COLUMNBKG));
  259. if (interpolate) {
  260. int a = MAX((col & 0xFF0000) >> 16, MAX((col & 0xFF00) >> 8, col & 0xFF));
  261. col = a < 0x1F ? Blenders::BLEND_AVG(windowbackground, 0xFF000000) : col;
  262. }
  263. ptr[62] = col;
  264. // listview header text color
  265. ptr[64] = RGBTOBGR(SkinColor(SKINCOLOR_LIST_COLUMNTEXT));
  266. // listview header frame top color
  267. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.column.frame.top"))
  268. ptr[66] = RGBTOBGR(SkinColor(L"wasabi.list.column.frame.top"));
  269. else
  270. ptr[66] = Blenders::BLEND_AVG(col, 0xFFFFFFFF);//listview header frame top color
  271. // listview header frame middle color
  272. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.column.frame.middle"))
  273. ptr[68] = RGBTOBGR(SkinColor(L"wasabi.list.column.frame.middle"));
  274. else
  275. ptr[68] = Blenders::BLEND_AVG(col, 0xFF2F2F2F);
  276. // listview header frame bottom color
  277. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.column.frame.bottom"))
  278. ptr[70] = RGBTOBGR(SkinColor(L"wasabi.list.column.frame.bottom"));
  279. else
  280. ptr[70] = Blenders::BLEND_AVG(col, 0xFF000000);
  281. // listview header empty color
  282. COLORREF empty;
  283. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.column.empty"))
  284. empty = RGBTOBGR(SkinColor(L"wasabi.list.column.empty"));
  285. else
  286. empty = Blenders::BLEND_AVG(col, 0xFF000000);
  287. ptr[72] = empty;
  288. // scrollbar foreground color
  289. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.scrollbar.foreground"))
  290. ptr[74] = RGBTOBGR(SkinColor(L"wasabi.scrollbar.foreground"));
  291. else
  292. ptr[74] = empty;
  293. // scrollbar background color
  294. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.scrollbar.background"))
  295. ptr[76] = RGBTOBGR(SkinColor(L"wasabi.scrollbar.background"));
  296. else
  297. ptr[76] = empty;
  298. // inverse scrollbar foreground color
  299. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.scrollbar.foreground.inverted"))
  300. ptr[78] = RGBTOBGR(SkinColor(L"wasabi.scrollbar.foreground.inverted"));
  301. else
  302. ptr[78] = col;
  303. // inverse scrollbar background color
  304. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.scrollbar.background.inverted"))
  305. ptr[80] = RGBTOBGR(SkinColor(L"wasabi.scrollbar.background.inverted"));
  306. else
  307. ptr[80] = empty;
  308. // scrollbar dead area color
  309. ptr[82] = windowbackground;
  310. // listview/treeview selection bar text color
  311. COLORREF selfg;
  312. if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text.selected"))
  313. selfg = RGBTOBGR(SkinColor(L"wasabi.list.text.selected"));
  314. else
  315. if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text"))
  316. selfg = RGBTOBGR(SkinColor(L"wasabi.list.text"));
  317. else
  318. selfg = SkinColor(L"wasabi.edit.text");
  319. ptr[84] = selfg;
  320. // listview/treeview selection bar back color
  321. COLORREF selbg;
  322. if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text.selected.background"))
  323. selbg = RGBTOBGR(SkinColor(L"wasabi.list.text.selected.background"));
  324. else {
  325. if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.item.selected"))
  326. selbg = RGBTOBGR(SkinColor(L"wasabi.list.item.selected"));
  327. else
  328. selbg = RGBTOBGR(SkinColor(SKINCOLOR_TREE_SELITEMBKG));
  329. selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(windowbackground, 0xFF7F7F7F) : selbg;
  330. selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(listbkg, 0xFF7F7F7F) : selbg;
  331. selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(windowbackground, 0xFFF0F0F0) : selbg;
  332. selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(listbkg, 0xFFF0F0F0) : selbg;
  333. selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(col, 0xFFF0F0F0) : selbg;
  334. selbg = lumidiff(selbg, listbkg) < 0x2F ? Blenders::BLEND_AVG(col, 0xFF101010) : selbg;
  335. selbg = lumidiff(selbg, selfg) < 0x1F ? Blenders::BLEND_AVG(selbg, 0xFF101010) : selbg;
  336. selbg = lumidiff(selbg, selfg) < 0x1F ? Blenders::BLEND_AVG(selbg, 0xFFF0F0F0) : selbg;
  337. }
  338. ptr[86] = ptr[60] = (selbg | 0xFF000000);
  339. // listview/treeview selection bar text color (inactive)
  340. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text.selected.inactive"))
  341. ptr[88] = RGBTOBGR(SkinColor(L"wasabi.list.text.selected.inactive"));
  342. else
  343. ptr[88] = selfg;
  344. // listview/treeview selection bar back color (inactive)
  345. if (!interpolate && WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text.selected.background.inactive"))
  346. ptr[90] = RGBTOBGR(SkinColor(L"wasabi.list.text.selected.background.inactive"));
  347. else
  348. ptr[90] = Blenders::BLEND_ADJ1(selbg, 0xFF000000, 210);
  349. // alternate item background
  350. if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.background.alternate"))
  351. ptr[92] = RGBTOBGR(SkinColor(L"wasabi.list.background.alternate"));
  352. else
  353. ptr[92] = ptr[48];
  354. // alternate item foreground
  355. if (WASABI_API_SKIN->skin_getColorElementRef(L"wasabi.list.text.alternate"))
  356. {
  357. ptr[50] = RGBTOBGR(SkinColor(L"wasabi.list.text.alternate"));
  358. if (interpolate) {
  359. int c = ptr[94];
  360. c = lumidiff(c, listbkg) < 0x1F ? Blenders::BLEND_AVG(ptr[94], 0xFF7F7F7F) : c;
  361. c = lumidiff(c, listbkg) < 0x1F ? Blenders::BLEND_AVG(ptr[94], 0xFF101010) : c;
  362. ptr[94] = c | 0xFF000000;
  363. }
  364. }
  365. else {
  366. ptr[94] = ptr[50];
  367. }
  368. return CreateBitmapDIB(132, 75, 1, 32, c.getBits());
  369. }
  370. void ff_ipc_genSkinBitmap(ff_skinbitmap *sb) {
  371. if (sb == NULL) return;
  372. switch (sb->id) {
  373. case SKINBITMAP_BUTTON: {
  374. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state);
  375. sb->bitmap = bmp;
  376. break;
  377. }
  378. case SKINBITMAP_SCROLLBARVBUTTON: {
  379. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state, L"wasabi.scrollbar.vertical.grip");
  380. sb->bitmap = bmp;
  381. break;
  382. }
  383. case SKINBITMAP_SCROLLBARHBUTTON: {
  384. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state, L"wasabi.scrollbar.horizontal.grip");
  385. sb->bitmap = bmp;
  386. break;
  387. }
  388. case SKINBITMAP_SCROLLBARUPBUTTON: {
  389. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state, L"wasabi.button.label.arrow.up");
  390. sb->bitmap = bmp;
  391. break;
  392. }
  393. case SKINBITMAP_SCROLLBARDOWNBUTTON: {
  394. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state, L"wasabi.button.label.arrow.down");
  395. sb->bitmap = bmp;
  396. break;
  397. }
  398. case SKINBITMAP_SCROLLBARLEFTBUTTON: {
  399. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, sb->state, L"wasabi.button.label.arrow.left");
  400. sb->bitmap = bmp;
  401. break;
  402. }
  403. case SKINBITMAP_SCROLLBAR_FF_UPBUTTON: {
  404. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
  405. ((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.vertical.left.pressed":
  406. ((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.vertical.left.hover":
  407. L"wasabi.scrollbar.vertical.left")));
  408. sb->bitmap = bmp;
  409. break;
  410. }
  411. case SKINBITMAP_SCROLLBAR_FF_DOWNBUTTON: {
  412. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
  413. ((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.vertical.right.pressed":
  414. ((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.vertical.right.hover":
  415. L"wasabi.scrollbar.vertical.right")));
  416. sb->bitmap = bmp;
  417. break;
  418. }
  419. case SKINBITMAP_SCROLLBAR_FF_LEFTBUTTON: {
  420. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
  421. ((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.horizontal.left.pressed":
  422. ((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.horizontal.left.hover":
  423. L"wasabi.scrollbar.horizontal.left")));
  424. sb->bitmap = bmp;
  425. break;
  426. }
  427. case SKINBITMAP_SCROLLBAR_FF_RIGHTBUTTON: {
  428. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
  429. ((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.horizontal.right.pressed":
  430. ((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.horizontal.right.hover":
  431. L"wasabi.scrollbar.horizontal.right")));
  432. sb->bitmap = bmp;
  433. break;
  434. }
  435. case SKINBITMAP_SCROLLBAR_FF_BARHBUTTON: {
  436. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
  437. ((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.horizontal.button.pressed":
  438. ((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.horizontal.button.hover":
  439. L"wasabi.scrollbar.horizontal.button")));
  440. sb->bitmap = bmp;
  441. break;
  442. }
  443. case SKINBITMAP_SCROLLBAR_FF_BARVBUTTON: {
  444. HBITMAP bmp = generateButtonBitmap(sb->w, sb->h, SCROLLBARSTATE_NORMAL,
  445. ((sb->state==SCROLLBARSTATE_PRESSED)?L"wasabi.scrollbar.vertical.button.pressed":
  446. ((sb->state==SCROLLBARSTATE_HOVER)?L"wasabi.scrollbar.vertical.button.hover":
  447. L"wasabi.scrollbar.vertical.button.pressed")));
  448. sb->bitmap = bmp;
  449. break;
  450. }
  451. }
  452. #if 0 // debug
  453. HDC ddc = GetDC(NULL);
  454. HDC sdc = CreateCompatibleDC(ddc);
  455. SelectObject(sdc, sb->bitmap);
  456. BitBlt(ddc, 100, 100, sb->w, sb->h, sdc, 0, 0, SRCCOPY);
  457. DeleteObject(sdc);
  458. ReleaseDC(NULL, ddc);
  459. #endif
  460. }
  461. ColorThemeMonitor::ColorThemeMonitor() {
  462. WASABI_API_SYSCB->syscb_registerCallback(this);
  463. }
  464. ColorThemeMonitor::~ColorThemeMonitor() {
  465. WASABI_API_SYSCB->syscb_deregisterCallback(this);
  466. }
  467. int ColorThemeMonitor::skincb_onColorThemeChanged( const wchar_t *colortheme )
  468. {
  469. SendMessageW( wa2.getMainWindow(), WM_WA_IPC, (WPARAM) colortheme, IPC_FF_ONCOLORTHEMECHANGED );
  470. return 1;
  471. }