[CMAKE]
[reactos.git] / dll / cpl / desk / draw.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Display Control Panel
4 * FILE: lib/cpl/desk/draw.c
5 * PURPOSE: Providing drawing functions
6 *
7 * PROGRAMMERS: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
8 */
9
10 #include "desk.h"
11 #include "theme.h"
12 #include "draw.h"
13
14 #define MENU_BAR_ITEMS_SPACE (12)
15
16 /******************************************************************************/
17
18 static const signed char LTInnerNormal[] = {
19 -1, -1, -1, -1,
20 -1, COLOR_BTNHIGHLIGHT, COLOR_BTNHIGHLIGHT, -1,
21 -1, COLOR_3DDKSHADOW, COLOR_3DDKSHADOW, -1,
22 -1, -1, -1, -1
23 };
24
25 static const signed char LTOuterNormal[] = {
26 -1, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1,
27 COLOR_BTNHIGHLIGHT, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1,
28 COLOR_3DDKSHADOW, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1,
29 -1, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1
30 };
31
32 static const signed char RBInnerNormal[] = {
33 -1, -1, -1, -1,
34 -1, COLOR_BTNSHADOW, COLOR_BTNSHADOW, -1,
35 -1, COLOR_3DLIGHT, COLOR_3DLIGHT, -1,
36 -1, -1, -1, -1
37 };
38
39 static const signed char RBOuterNormal[] = {
40 -1, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1,
41 COLOR_BTNSHADOW, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1,
42 COLOR_3DLIGHT, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1,
43 -1, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1
44 };
45
46 static const signed char LTRBOuterMono[] = {
47 -1, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
48 COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
49 COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
50 COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
51 };
52
53 static const signed char LTRBInnerMono[] = {
54 -1, -1, -1, -1,
55 -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW,
56 -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW,
57 -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW,
58 };
59
60 static BOOL
61 MyIntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, THEME *theme)
62 {
63 signed char LTInnerI, LTOuterI;
64 signed char RBInnerI, RBOuterI;
65 HPEN LTInnerPen, LTOuterPen;
66 HPEN RBInnerPen, RBOuterPen;
67 RECT InnerRect = *rc;
68 POINT SavePoint;
69 HPEN SavePen;
70 int LBpenplus = 0;
71 int LTpenplus = 0;
72 int RTpenplus = 0;
73 int RBpenplus = 0;
74 /* Init some vars */
75 LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
76 SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
77
78 /* Determine the colors of the edges */
79 LTInnerI = LTInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
80 LTOuterI = LTOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
81 RBInnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
82 RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
83
84 if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT)
85 LBpenplus = 1;
86 if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT)
87 RTpenplus = 1;
88 if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT)
89 RBpenplus = 1;
90 if((uFlags & BF_TOPLEFT) == BF_TOPLEFT)
91 LTpenplus = 1;
92
93 if(LTInnerI != -1)
94 LTInnerPen = GetStockObject(DC_PEN);
95 if(LTOuterI != -1)
96 LTOuterPen = GetStockObject(DC_PEN);
97 if(RBInnerI != -1)
98 RBInnerPen = GetStockObject(DC_PEN);
99 if(RBOuterI != -1)
100 RBOuterPen = GetStockObject(DC_PEN);
101 {
102 HBRUSH hbr;
103 hbr = CreateSolidBrush(theme->crColor[COLOR_BTNFACE]);
104 FillRect(hdc, &InnerRect, hbr);
105 DeleteObject(hbr);
106 }
107 MoveToEx(hdc, 0, 0, &SavePoint);
108
109 /* Draw the outer edge */
110 SelectObject(hdc, LTOuterPen);
111 SetDCPenColor(hdc, theme->crColor[LTOuterI]);
112 if(uFlags & BF_TOP)
113 {
114 MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
115 LineTo(hdc, InnerRect.right, InnerRect.top);
116 }
117 if(uFlags & BF_LEFT)
118 {
119 MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
120 LineTo(hdc, InnerRect.left, InnerRect.bottom);
121 }
122 SelectObject(hdc, RBOuterPen);
123 SetDCPenColor(hdc, theme->crColor[RBOuterI]);
124 if(uFlags & BF_BOTTOM)
125 {
126 MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
127 LineTo(hdc, InnerRect.right, InnerRect.bottom-1);
128 }
129 if(uFlags & BF_RIGHT)
130 {
131 MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL);
132 LineTo(hdc, InnerRect.right-1, InnerRect.bottom);
133 }
134
135 /* Draw the inner edge */
136 SelectObject(hdc, LTInnerPen);
137 SetDCPenColor(hdc, theme->crColor[LTInnerI]);
138 if(uFlags & BF_TOP)
139 {
140 MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
141 LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
142 }
143 if(uFlags & BF_LEFT)
144 {
145 MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
146 LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
147 }
148 SelectObject(hdc, RBInnerPen);
149 SetDCPenColor(hdc, theme->crColor[RBInnerI]);
150 if(uFlags & BF_BOTTOM)
151 {
152 MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
153 LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2);
154 }
155 if(uFlags & BF_RIGHT)
156 {
157 MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL);
158 LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus);
159 }
160
161 if (uFlags & BF_ADJUST)
162 {
163 int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
164 + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
165
166 if(uFlags & BF_LEFT)
167 InnerRect.left += add;
168 if(uFlags & BF_RIGHT)
169 InnerRect.right -= add;
170 if(uFlags & BF_TOP)
171 InnerRect.top += add;
172 if(uFlags & BF_BOTTOM)
173 InnerRect.bottom -= add;
174
175 if(uFlags & BF_ADJUST)
176 *rc = InnerRect;
177 }
178
179 /* Cleanup */
180 SelectObject(hdc, SavePen);
181 MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL);
182 return TRUE;
183 }
184
185 static BOOL
186 MyDrawFrameButton(HDC hdc, LPRECT rc, UINT uState, THEME *theme)
187 {
188 UINT edge;
189 if(uState & (DFCS_PUSHED | DFCS_CHECKED | DFCS_FLAT))
190 edge = EDGE_SUNKEN;
191 else
192 edge = EDGE_RAISED;
193 return MyIntDrawRectEdge(hdc, rc, edge, (uState & DFCS_FLAT) | BF_RECT | BF_SOFT, theme);
194 }
195
196 static int
197 MyMakeSquareRect(LPRECT src, LPRECT dst)
198 {
199 int Width = src->right - src->left;
200 int Height = src->bottom - src->top;
201 int SmallDiam = Width > Height ? Height : Width;
202
203 *dst = *src;
204
205 /* Make it a square box */
206 if (Width < Height) /* SmallDiam == Width */
207 {
208 dst->top += (Height-Width)/2;
209 dst->bottom = dst->top + SmallDiam;
210 }
211 else if(Width > Height) /* SmallDiam == Height */
212 {
213 dst->left += (Width-Height)/2;
214 dst->right = dst->left + SmallDiam;
215 }
216
217 return SmallDiam;
218 }
219
220 static BOOL
221 MyDrawFrameCaption(HDC dc, LPRECT r, UINT uFlags, THEME *theme)
222 {
223 LOGFONT lf;
224 HFONT hFont, hOldFont;
225 COLORREF clrsave;
226 RECT myr;
227 INT bkmode;
228 TCHAR Symbol;
229 switch(uFlags & 0xff)
230 {
231 case DFCS_CAPTIONCLOSE:
232 Symbol = 'r';
233 break;
234 case DFCS_CAPTIONHELP:
235 Symbol = 's';
236 break;
237 case DFCS_CAPTIONMIN:
238 Symbol = '0';
239 break;
240 case DFCS_CAPTIONMAX:
241 Symbol = '1';
242 break;
243 case DFCS_CAPTIONRESTORE:
244 Symbol = '2';
245 break;
246 }
247 MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT, theme);
248 ZeroMemory(&lf, sizeof(LOGFONT));
249 MyMakeSquareRect(r, &myr);
250 myr.left += 1;
251 myr.top += 1;
252 myr.right -= 1;
253 myr.bottom -= 1;
254 if(uFlags & DFCS_PUSHED)
255 OffsetRect(&myr,1,1);
256 lf.lfHeight = myr.bottom - myr.top;
257 lf.lfWidth = 0;
258 lf.lfWeight = FW_NORMAL;
259 lf.lfCharSet = DEFAULT_CHARSET;
260 lstrcpy(lf.lfFaceName, TEXT("Marlett"));
261 hFont = CreateFontIndirect(&lf);
262 /* save font and text color */
263 hOldFont = SelectObject(dc, hFont);
264 clrsave = GetTextColor(dc);
265 bkmode = GetBkMode(dc);
266 /* set color and drawing mode */
267 SetBkMode(dc, TRANSPARENT);
268 if(uFlags & DFCS_INACTIVE)
269 {
270 /* draw shadow */
271 SetTextColor(dc, theme->crColor[COLOR_BTNHIGHLIGHT]);
272 TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
273 }
274 SetTextColor(dc, theme->crColor[(uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT]);
275 /* draw selected symbol */
276 TextOut(dc, myr.left, myr.top, &Symbol, 1);
277 /* restore previous settings */
278 SetTextColor(dc, clrsave);
279 SelectObject(dc, hOldFont);
280 SetBkMode(dc, bkmode);
281 DeleteObject(hFont);
282 return TRUE;
283 }
284
285 /******************************************************************************/
286
287 static BOOL
288 MyDrawFrameScroll(HDC dc, LPRECT r, UINT uFlags, THEME *theme)
289 {
290 LOGFONT lf;
291 HFONT hFont, hOldFont;
292 COLORREF clrsave;
293 RECT myr;
294 INT bkmode;
295 TCHAR Symbol;
296 switch(uFlags & 0xff)
297 {
298 case DFCS_SCROLLCOMBOBOX:
299 case DFCS_SCROLLDOWN:
300 Symbol = '6';
301 break;
302
303 case DFCS_SCROLLUP:
304 Symbol = '5';
305 break;
306
307 case DFCS_SCROLLLEFT:
308 Symbol = '3';
309 break;
310
311 case DFCS_SCROLLRIGHT:
312 Symbol = '4';
313 break;
314 }
315 MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT, theme);
316 ZeroMemory(&lf, sizeof(LOGFONT));
317 MyMakeSquareRect(r, &myr);
318 myr.left += 1;
319 myr.top += 1;
320 myr.right -= 1;
321 myr.bottom -= 1;
322 if(uFlags & DFCS_PUSHED)
323 OffsetRect(&myr,1,1);
324 lf.lfHeight = myr.bottom - myr.top;
325 lf.lfWidth = 0;
326 lf.lfWeight = FW_NORMAL;
327 lf.lfCharSet = DEFAULT_CHARSET;
328 lstrcpy(lf.lfFaceName, TEXT("Marlett"));
329 hFont = CreateFontIndirect(&lf);
330 /* save font and text color */
331 hOldFont = SelectObject(dc, hFont);
332 clrsave = GetTextColor(dc);
333 bkmode = GetBkMode(dc);
334 /* set color and drawing mode */
335 SetBkMode(dc, TRANSPARENT);
336 if(uFlags & DFCS_INACTIVE)
337 {
338 /* draw shadow */
339 SetTextColor(dc, theme->crColor[COLOR_BTNHIGHLIGHT]);
340 TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
341 }
342 SetTextColor(dc, theme->crColor[(uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT]);
343 /* draw selected symbol */
344 TextOut(dc, myr.left, myr.top, &Symbol, 1);
345 /* restore previous settings */
346 SetTextColor(dc, clrsave);
347 SelectObject(dc, hOldFont);
348 SetBkMode(dc, bkmode);
349 DeleteObject(hFont);
350 return TRUE;
351 }
352
353 BOOL
354 MyDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState, THEME *theme)
355 {
356 switch(uType)
357 {
358 case DFC_BUTTON:
359 return MyDrawFrameButton(hDC, rc, uState, theme);
360 case DFC_CAPTION:
361 return MyDrawFrameCaption(hDC, rc, uState, theme);
362 case DFC_SCROLL:
363 return MyDrawFrameScroll(hDC, rc, uState, theme);
364 }
365 return FALSE;
366 }
367
368 BOOL
369 MyDrawEdge(HDC hDC, LPRECT rc, UINT edge, UINT flags, THEME *theme)
370 {
371 return MyIntDrawRectEdge(hDC, rc, edge, flags, theme);
372 }
373
374 VOID
375 MyDrawCaptionButtons(HDC hdc, LPRECT lpRect, BOOL bMinMax, int x, THEME *theme)
376 {
377 RECT rc3;
378 RECT rc4;
379 RECT rc5;
380
381 rc3.left = lpRect->right - 2 - x;
382 rc3.top = lpRect->top + 2;
383 rc3.right = lpRect->right - 2;
384 rc3.bottom = lpRect->bottom - 2;
385
386 MyDrawFrameControl(hdc, &rc3, DFC_CAPTION, DFCS_CAPTIONCLOSE, theme);
387
388 if (bMinMax)
389 {
390 rc4.left = rc3.left - x - 2;
391 rc4.top = rc3.top;
392 rc4.right = rc3.right - x - 2;
393 rc4.bottom = rc3.bottom;
394
395 MyDrawFrameControl(hdc, &rc4, DFC_CAPTION, DFCS_CAPTIONMAX, theme);
396
397 rc5.left = rc4.left - x;
398 rc5.top = rc4.top;
399 rc5.right = rc4.right - x;
400 rc5.bottom = rc4.bottom;
401
402 MyDrawFrameControl(hdc, &rc5, DFC_CAPTION, DFCS_CAPTIONMIN, theme);
403 }
404 }
405
406 VOID
407 MyDrawScrollbar(HDC hdc, LPRECT rc, HBRUSH hbrScrollbar, THEME *theme)
408 {
409 RECT rcTop;
410 RECT rcBottom;
411 RECT rcMiddle;
412 int width;
413
414 width = rc->right - rc->left;
415
416 rcTop.left = rc->left;
417 rcTop.right = rc->right;
418 rcTop.top = rc->top;
419 rcTop.bottom = rc->top + width;
420
421 rcMiddle.left = rc->left;
422 rcMiddle.right = rc->right;
423 rcMiddle.top = rc->top + width;
424 rcMiddle.bottom = rc->bottom - width;
425
426 rcBottom.left = rc->left;
427 rcBottom.right = rc->right;
428 rcBottom.top = rc->bottom - width;
429 rcBottom.bottom = rc->bottom;
430
431 MyDrawFrameControl(hdc, &rcTop, DFC_SCROLL, DFCS_SCROLLUP, theme);
432 MyDrawFrameControl(hdc, &rcBottom, DFC_SCROLL, DFCS_SCROLLDOWN, theme);
433
434 FillRect(hdc, &rcMiddle, hbrScrollbar);
435 }
436
437 /******************************************************************************/
438
439 BOOL
440 MyDrawCaptionTemp(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR str, UINT uFlags, THEME *theme)
441 {
442 ULONG Height;
443 UINT VCenter, Padding;
444 LONG ButtonWidth;
445 HBRUSH hbr;
446 HGDIOBJ hFontOld;
447 RECT rc;
448
449 Height = theme->Size[SIZE_CAPTION_Y] - 1;
450 VCenter = (rect->bottom - rect->top) / 2;
451 Padding = VCenter - (Height / 2);
452
453 ButtonWidth = theme->Size[SIZE_SIZE_X] - 2;
454
455 if (uFlags & DC_GRADIENT)
456 {
457 GRADIENT_RECT gcap = {0, 1};
458 TRIVERTEX vert[2];
459 COLORREF Colors[2];
460
461 Colors[0] = theme->crColor[((uFlags & DC_ACTIVE) ?
462 COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)];
463 Colors[1] = theme->crColor[((uFlags & DC_ACTIVE) ?
464 COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION)];
465
466 vert[0].x = rect->left;
467 vert[0].y = rect->top;
468 vert[0].Red = (WORD)Colors[0]<<8;
469 vert[0].Green = (WORD)Colors[0] & 0xFF00;
470 vert[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00;
471 vert[0].Alpha = 0;
472
473 vert[1].x = rect->right;
474 vert[1].y = rect->bottom;
475 vert[1].Red = (WORD)Colors[1]<<8;
476 vert[1].Green = (WORD)Colors[1] & 0xFF00;
477 vert[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00;
478 vert[1].Alpha = 0;
479
480 GradientFill(hdc, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_H);
481 }
482 else
483 {
484 if (uFlags & DC_ACTIVE)
485 hbr = CreateSolidBrush(theme->crColor[COLOR_ACTIVECAPTION]);
486 else
487 hbr = CreateSolidBrush(theme->crColor[COLOR_INACTIVECAPTION]);
488 FillRect(hdc, rect, hbr);
489 DeleteObject(hbr);
490 }
491
492 hFontOld = SelectObject(hdc, hFont);
493 SetBkMode(hdc, TRANSPARENT);
494 if (uFlags & DC_ACTIVE)
495 SetTextColor(hdc, theme->crColor[COLOR_CAPTIONTEXT]);
496 else
497 SetTextColor(hdc, theme->crColor[COLOR_INACTIVECAPTIONTEXT]);
498 rc.left = rect->left + 2;
499 rc.top = rect->top;
500 rc.right = rect->right;
501 rc.bottom = rect->bottom;
502 DrawTextW(hdc, str, -1, &rc, DT_SINGLELINE | DT_VCENTER);
503 SelectObject(hdc, hFontOld);
504 return TRUE;
505 }
506
507 /******************************************************************************/
508
509 DWORD
510 MyDrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font, THEME *theme)
511 {
512 HBRUSH hbr;
513 HPEN hPen;
514 HGDIOBJ hPenOld, hFontOld;
515 BOOL flat_menu;
516 INT i, bkgnd, x;
517 RECT rect;
518 WCHAR Text[128];
519 UINT uFormat = DT_CENTER | DT_VCENTER | DT_SINGLELINE;
520
521 flat_menu = theme->bFlatMenus;
522
523 if (flat_menu)
524 hbr = CreateSolidBrush(theme->crColor[COLOR_MENUBAR]);
525 else
526 hbr = CreateSolidBrush(theme->crColor[COLOR_MENU]);
527 FillRect(DC, Rect, hbr);
528 DeleteObject(hbr);
529
530 hPen = CreatePen(PS_SOLID, 0, theme->crColor[COLOR_3DFACE]);
531 hPenOld = SelectObject(DC, hPen);
532 MoveToEx(DC, Rect->left, Rect->bottom - 1, NULL);
533 LineTo(DC, Rect->right, Rect->bottom - 1);
534 SelectObject(DC, hPenOld);
535 DeleteObject(hPen);
536
537 bkgnd = (flat_menu ? COLOR_MENUBAR : COLOR_MENU);
538 x = Rect->left;
539 hFontOld = SelectObject(DC, Font);
540 for(i = 0; i < 3; i++)
541 {
542 GetMenuStringW(Menu, i, Text, 128, MF_BYPOSITION);
543
544 rect.left = rect.right = x;
545 rect.top = Rect->top;
546 rect.bottom = Rect->bottom;
547 DrawTextW(DC, Text, -1, &rect, DT_SINGLELINE | DT_CALCRECT);
548 rect.bottom = Rect->bottom;
549 rect.right += MENU_BAR_ITEMS_SPACE;
550 x += rect.right - rect.left;
551
552 if (i == 2)
553 {
554 if (flat_menu)
555 {
556 SetTextColor(DC, theme->crColor[COLOR_HIGHLIGHTTEXT]);
557 SetBkColor(DC, theme->crColor[COLOR_HIGHLIGHT]);
558
559 InflateRect (&rect, -1, -1);
560 hbr = CreateSolidBrush(theme->crColor[COLOR_MENUHILIGHT]);
561 FillRect(DC, &rect, hbr);
562 DeleteObject(hbr);
563
564 InflateRect (&rect, 1, 1);
565 hbr = CreateSolidBrush(theme->crColor[COLOR_HIGHLIGHT]);
566 FrameRect(DC, &rect, hbr);
567 DeleteObject(hbr);
568 }
569 else
570 {
571 SetTextColor(DC, theme->crColor[COLOR_MENUTEXT]);
572 SetBkColor(DC, theme->crColor[COLOR_MENU]);
573 DrawEdge(DC, &rect, BDR_SUNKENOUTER, BF_RECT);
574 }
575 }
576 else
577 {
578 if (i == 1)
579 SetTextColor(DC, theme->crColor[COLOR_GRAYTEXT]);
580 else
581 SetTextColor(DC, theme->crColor[COLOR_MENUTEXT]);
582
583 SetBkColor(DC, theme->crColor[bkgnd]);
584 hbr = CreateSolidBrush(theme->crColor[bkgnd]);
585 FillRect(DC, &rect, hbr);
586 DeleteObject(hbr);
587 }
588
589 SetBkMode(DC, TRANSPARENT);
590
591 rect.left += MENU_BAR_ITEMS_SPACE / 2;
592 rect.right -= MENU_BAR_ITEMS_SPACE / 2;
593
594 if (i == 1)
595 {
596 ++rect.left; ++rect.top; ++rect.right; ++rect.bottom;
597 SetTextColor(DC, RGB(0xff, 0xff, 0xff));
598 DrawTextW(DC, Text, -1, &rect, uFormat);
599 --rect.left; --rect.top; --rect.right; --rect.bottom;
600 SetTextColor(DC, RGB(0x80, 0x80, 0x80));
601 }
602 DrawTextW(DC, Text, -1, &rect, uFormat);
603 }
604 SelectObject(DC, hFontOld);
605
606 return TRUE;
607 }