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