2 * User Interface Functions
4 * Copyright 1997 Dimitrie O. Paun
5 * Copyright 1997 Bertho A. Stultiens
10 #include "wine/winuser16.h"
12 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(graphics)
17 static const WORD wPattern_AA55[8] = { 0xaaaa, 0x5555, 0xaaaa, 0x5555,
18 0xaaaa, 0x5555, 0xaaaa, 0x5555 };
20 /* These tables are used in:
21 * UITOOLS_DrawDiagEdge()
22 * UITOOLS_DrawRectEdge()
24 static const char LTInnerNormal[] = {
26 -1, COLOR_BTNHIGHLIGHT, COLOR_BTNHIGHLIGHT, -1,
27 -1, COLOR_3DDKSHADOW, COLOR_3DDKSHADOW, -1,
31 static const char LTOuterNormal[] = {
32 -1, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1,
33 COLOR_BTNHIGHLIGHT, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1,
34 COLOR_3DDKSHADOW, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1,
35 -1, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1
38 static const char RBInnerNormal[] = {
40 -1, COLOR_BTNSHADOW, COLOR_BTNSHADOW, -1,
41 -1, COLOR_3DLIGHT, COLOR_3DLIGHT, -1,
45 static const char RBOuterNormal[] = {
46 -1, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1,
47 COLOR_BTNSHADOW, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1,
48 COLOR_3DLIGHT, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1,
49 -1, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1
52 static const char LTInnerSoft[] = {
54 -1, COLOR_3DLIGHT, COLOR_3DLIGHT, -1,
55 -1, COLOR_BTNSHADOW, COLOR_BTNSHADOW, -1,
59 static const char LTOuterSoft[] = {
60 -1, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1,
61 COLOR_3DLIGHT, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1,
62 COLOR_BTNSHADOW, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1,
63 -1, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1
66 #define RBInnerSoft RBInnerNormal /* These are the same */
67 #define RBOuterSoft RBOuterNormal
69 static const char LTRBOuterMono[] = {
70 -1, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
71 COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
72 COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
73 COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
76 static const char LTRBInnerMono[] = {
78 -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW,
79 -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW,
80 -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW,
83 static const char LTRBOuterFlat[] = {
84 -1, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW,
85 COLOR_WINDOWFRAME, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW,
86 COLOR_WINDOWFRAME, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW,
87 COLOR_WINDOWFRAME, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW,
90 static const char LTRBInnerFlat[] = {
92 -1, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
93 -1, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
94 -1, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME,
97 /***********************************************************************
98 * UITOOLS_DrawDiagEdge
100 * Same as DrawEdge invoked with BF_DIAGONAL
102 * 03-Dec-1997: Changed by Bertho Stultiens
104 * See also comments with UITOOLS_DrawRectEdge()
106 static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc,
107 UINT uType, UINT uFlags)
111 HPEN InnerPen, OuterPen;
116 int Width = rc->right - rc->left;
117 int Height= rc->bottom - rc->top;
118 int SmallDiam = Width > Height ? Height : Width;
119 BOOL retval = !( ((uType & BDR_INNER) == BDR_INNER
120 || (uType & BDR_OUTER) == BDR_OUTER)
121 && !(uFlags & (BF_FLAT|BF_MONO)) );
122 int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
123 + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
126 OuterPen = InnerPen = (HPEN)GetStockObject(NULL_PEN);
127 SavePen = (HPEN)SelectObject(hdc, InnerPen);
128 spx = spy = epx = epy = 0; /* Satisfy the compiler... */
130 /* Determine the colors of the edges */
133 InnerI = LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)];
134 OuterI = LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)];
136 else if(uFlags & BF_FLAT)
138 InnerI = LTRBInnerFlat[uType & (BDR_INNER|BDR_OUTER)];
139 OuterI = LTRBOuterFlat[uType & (BDR_INNER|BDR_OUTER)];
141 else if(uFlags & BF_SOFT)
143 if(uFlags & BF_BOTTOM)
145 InnerI = RBInnerSoft[uType & (BDR_INNER|BDR_OUTER)];
146 OuterI = RBOuterSoft[uType & (BDR_INNER|BDR_OUTER)];
150 InnerI = LTInnerSoft[uType & (BDR_INNER|BDR_OUTER)];
151 OuterI = LTOuterSoft[uType & (BDR_INNER|BDR_OUTER)];
156 if(uFlags & BF_BOTTOM)
158 InnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
159 OuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
163 InnerI = LTInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
164 OuterI = LTOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
168 if(InnerI != -1) InnerPen = GetSysColorPen(InnerI);
169 if(OuterI != -1) OuterPen = GetSysColorPen(OuterI);
171 MoveToEx(hdc, 0, 0, &SavePoint);
173 /* Don't ask me why, but this is what is visible... */
174 /* This must be possible to do much simpler, but I fail to */
175 /* see the logic in the MS implementation (sigh...). */
176 /* So, this might look a bit brute force here (and it is), but */
177 /* it gets the job done;) */
179 switch(uFlags & BF_RECT)
185 /* Left bottom endpoint */
187 spx = epx + SmallDiam;
189 spy = epy - SmallDiam;
194 /* Left top endpoint */
196 spx = epx + SmallDiam;
198 spy = epy + SmallDiam;
204 case BF_RIGHT|BF_LEFT:
205 case BF_RIGHT|BF_LEFT|BF_TOP:
206 case BF_BOTTOM|BF_TOP:
207 case BF_BOTTOM|BF_TOP|BF_LEFT:
208 case BF_BOTTOMRIGHT|BF_LEFT:
209 case BF_BOTTOMRIGHT|BF_TOP:
211 /* Right top endpoint */
213 epx = spx + SmallDiam;
215 epy = spy - SmallDiam;
219 MoveToEx(hdc, spx, spy, NULL);
220 SelectObject(hdc, OuterPen);
221 LineTo(hdc, epx, epy);
223 SelectObject(hdc, InnerPen);
225 switch(uFlags & (BF_RECT|BF_DIAGONAL))
227 case BF_DIAGONAL_ENDBOTTOMLEFT:
228 case (BF_DIAGONAL|BF_BOTTOM):
230 case (BF_DIAGONAL|BF_LEFT):
231 MoveToEx(hdc, spx-1, spy, NULL);
232 LineTo(hdc, epx, epy-1);
233 Points[0].x = spx-add;
235 Points[1].x = rc->left;
236 Points[1].y = rc->top;
238 Points[2].y = epy-1-add;
239 Points[3] = Points[2];
242 case BF_DIAGONAL_ENDBOTTOMRIGHT:
243 MoveToEx(hdc, spx-1, spy, NULL);
244 LineTo(hdc, epx, epy+1);
245 Points[0].x = spx-add;
247 Points[1].x = rc->left;
248 Points[1].y = rc->bottom-1;
250 Points[2].y = epy+1+add;
251 Points[3] = Points[2];
254 case (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT|BF_TOP):
255 case (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT|BF_TOP|BF_LEFT):
256 case BF_DIAGONAL_ENDTOPRIGHT:
257 case (BF_DIAGONAL|BF_RIGHT|BF_TOP|BF_LEFT):
258 MoveToEx(hdc, spx+1, spy, NULL);
259 LineTo(hdc, epx, epy+1);
261 Points[0].y = epy+1+add;
262 Points[1].x = rc->right-1;
263 Points[1].y = rc->top+add;
264 Points[2].x = rc->right-1;
265 Points[2].y = rc->bottom-1;
266 Points[3].x = spx+add;
270 case BF_DIAGONAL_ENDTOPLEFT:
271 MoveToEx(hdc, spx, spy-1, NULL);
272 LineTo(hdc, epx+1, epy);
273 Points[0].x = epx+1+add;
275 Points[1].x = rc->right-1;
276 Points[1].y = rc->top;
277 Points[2].x = rc->right-1;
278 Points[2].y = rc->bottom-1-add;
280 Points[3].y = spy-add;
283 case (BF_DIAGONAL|BF_TOP):
284 case (BF_DIAGONAL|BF_BOTTOM|BF_TOP):
285 case (BF_DIAGONAL|BF_BOTTOM|BF_TOP|BF_LEFT):
286 MoveToEx(hdc, spx+1, spy-1, NULL);
287 LineTo(hdc, epx, epy);
290 Points[1].x = rc->right-1;
291 Points[1].y = rc->top;
292 Points[2].x = rc->right-1;
293 Points[2].y = rc->bottom-1-add;
294 Points[3].x = spx+add;
295 Points[3].y = spy-add;
298 case (BF_DIAGONAL|BF_RIGHT):
299 case (BF_DIAGONAL|BF_RIGHT|BF_LEFT):
300 case (BF_DIAGONAL|BF_RIGHT|BF_LEFT|BF_BOTTOM):
301 MoveToEx(hdc, spx, spy, NULL);
302 LineTo(hdc, epx-1, epy+1);
305 Points[1].x = rc->left;
306 Points[1].y = rc->top+add;
307 Points[2].x = epx-1-add;
308 Points[2].y = epy+1+add;
309 Points[3] = Points[2];
313 /* Fill the interior if asked */
314 if((uFlags & BF_MIDDLE) && retval)
317 HBRUSH hb = GetSysColorBrush(uFlags & BF_MONO ? COLOR_WINDOW
320 HPEN hp = GetSysColorPen(uFlags & BF_MONO ? COLOR_WINDOW
322 hbsave = (HBRUSH)SelectObject(hdc, hb);
323 hpsave = (HPEN)SelectObject(hdc, hp);
324 Polygon(hdc, Points, 4);
325 SelectObject(hdc, hbsave);
326 SelectObject(hdc, hpsave);
329 /* Adjust rectangle if asked */
330 if(uFlags & BF_ADJUST)
332 if(uFlags & BF_LEFT) rc->left += add;
333 if(uFlags & BF_RIGHT) rc->right -= add;
334 if(uFlags & BF_TOP) rc->top += add;
335 if(uFlags & BF_BOTTOM) rc->bottom -= add;
339 SelectObject(hdc, SavePen);
340 MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL);
345 /***********************************************************************
346 * UITOOLS_DrawRectEdge
348 * Same as DrawEdge invoked without BF_DIAGONAL
350 * 23-Nov-1997: Changed by Bertho Stultiens
352 * Well, I started testing this and found out that there are a few things
353 * that weren't quite as win95. The following rewrite should reproduce
354 * win95 results completely.
355 * The colorselection is table-driven to avoid awfull if-statements.
356 * The table below show the color settings.
358 * Pen selection table for uFlags = 0
360 * uType | LTI | LTO | RBI | RBO
361 * ------+-------+-------+-------+-------
362 * 0000 | x | x | x | x
363 * 0001 | x | 22 | x | 21
364 * 0010 | x | 16 | x | 20
365 * 0011 | x | x | x | x
366 * ------+-------+-------+-------+-------
367 * 0100 | x | 20 | x | 16
368 * 0101 | 20 | 22 | 16 | 21
369 * 0110 | 20 | 16 | 16 | 20
370 * 0111 | x | x | x | x
371 * ------+-------+-------+-------+-------
372 * 1000 | x | 21 | x | 22
373 * 1001 | 21 | 22 | 22 | 21
374 * 1010 | 21 | 16 | 22 | 20
375 * 1011 | x | x | x | x
376 * ------+-------+-------+-------+-------
377 * 1100 | x | x | x | x
378 * 1101 | x | x (22)| x | x (21)
379 * 1110 | x | x (16)| x | x (20)
380 * 1111 | x | x | x | x
382 * Pen selection table for uFlags = BF_SOFT
384 * uType | LTI | LTO | RBI | RBO
385 * ------+-------+-------+-------+-------
386 * 0000 | x | x | x | x
387 * 0001 | x | 20 | x | 21
388 * 0010 | x | 21 | x | 20
389 * 0011 | x | x | x | x
390 * ------+-------+-------+-------+-------
391 * 0100 | x | 22 | x | 16
392 * 0101 | 22 | 20 | 16 | 21
393 * 0110 | 22 | 21 | 16 | 20
394 * 0111 | x | x | x | x
395 * ------+-------+-------+-------+-------
396 * 1000 | x | 16 | x | 22
397 * 1001 | 16 | 20 | 22 | 21
398 * 1010 | 16 | 21 | 22 | 20
399 * 1011 | x | x | x | x
400 * ------+-------+-------+-------+-------
401 * 1100 | x | x | x | x
402 * 1101 | x | x (20)| x | x (21)
403 * 1110 | x | x (21)| x | x (20)
404 * 1111 | x | x | x | x
406 * x = don't care; (n) = is what win95 actually uses
407 * LTI = left Top Inner line
408 * LTO = left Top Outer line
409 * RBI = Right Bottom Inner line
410 * RBO = Right Bottom Outer line
412 * 16 = COLOR_BTNSHADOW
413 * 20 = COLOR_BTNHIGHLIGHT
414 * 21 = COLOR_3DDKSHADOW
419 static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
420 UINT uType, UINT uFlags)
422 char LTInnerI, LTOuterI;
423 char RBInnerI, RBOuterI;
424 HPEN LTInnerPen, LTOuterPen;
425 HPEN RBInnerPen, RBOuterPen;
426 RECT InnerRect = *rc;
433 BOOL retval = !( ((uType & BDR_INNER) == BDR_INNER
434 || (uType & BDR_OUTER) == BDR_OUTER)
435 && !(uFlags & (BF_FLAT|BF_MONO)) );
438 LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
439 SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
441 /* Determine the colors of the edges */
444 LTInnerI = RBInnerI = LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)];
445 LTOuterI = RBOuterI = LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)];
447 else if(uFlags & BF_FLAT)
449 LTInnerI = RBInnerI = LTRBInnerFlat[uType & (BDR_INNER|BDR_OUTER)];
450 LTOuterI = RBOuterI = LTRBOuterFlat[uType & (BDR_INNER|BDR_OUTER)];
452 /* Bertho Stultiens states above that this function exactly matches win95
453 * In win98 BF_FLAT rectangels have an inner border same color as the
454 * middle (COLOR_BTNFACE). I believe it's the same for win95 but since
455 * I don't know I go with Bertho and just sets it for win98 until proven
457 * Dennis Björklund, 10 June, 99
459 if( TWEAK_WineLook == WIN98_LOOK && LTInnerI != -1 )
460 LTInnerI = RBInnerI = COLOR_BTNFACE;
462 else if(uFlags & BF_SOFT)
464 LTInnerI = LTInnerSoft[uType & (BDR_INNER|BDR_OUTER)];
465 LTOuterI = LTOuterSoft[uType & (BDR_INNER|BDR_OUTER)];
466 RBInnerI = RBInnerSoft[uType & (BDR_INNER|BDR_OUTER)];
467 RBOuterI = RBOuterSoft[uType & (BDR_INNER|BDR_OUTER)];
471 LTInnerI = LTInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
472 LTOuterI = LTOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
473 RBInnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
474 RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
477 if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT) LBpenplus = 1;
478 if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT) RTpenplus = 1;
479 if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT) RBpenplus = 1;
480 if((uFlags & BF_TOPLEFT) == BF_TOPLEFT) LTpenplus = 1;
482 if(LTInnerI != -1) LTInnerPen = GetSysColorPen(LTInnerI);
483 if(LTOuterI != -1) LTOuterPen = GetSysColorPen(LTOuterI);
484 if(RBInnerI != -1) RBInnerPen = GetSysColorPen(RBInnerI);
485 if(RBOuterI != -1) RBOuterPen = GetSysColorPen(RBOuterI);
487 MoveToEx(hdc, 0, 0, &SavePoint);
489 /* Draw the outer edge */
490 SelectObject(hdc, LTOuterPen);
493 MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
494 LineTo(hdc, InnerRect.right, InnerRect.top);
498 MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
499 LineTo(hdc, InnerRect.left, InnerRect.bottom);
501 SelectObject(hdc, RBOuterPen);
502 if(uFlags & BF_BOTTOM)
504 MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL);
505 LineTo(hdc, InnerRect.left-1, InnerRect.bottom-1);
507 if(uFlags & BF_RIGHT)
509 MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL);
510 LineTo(hdc, InnerRect.right-1, InnerRect.top-1);
513 /* Draw the inner edge */
514 SelectObject(hdc, LTInnerPen);
517 MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
518 LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
522 MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
523 LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
525 SelectObject(hdc, RBInnerPen);
526 if(uFlags & BF_BOTTOM)
528 MoveToEx(hdc, InnerRect.right-1-RBpenplus, InnerRect.bottom-2, NULL);
529 LineTo(hdc, InnerRect.left-1+LBpenplus, InnerRect.bottom-2);
531 if(uFlags & BF_RIGHT)
533 MoveToEx(hdc, InnerRect.right-2, InnerRect.bottom-1-RBpenplus, NULL);
534 LineTo(hdc, InnerRect.right-2, InnerRect.top-1+RTpenplus);
537 if( ((uFlags & BF_MIDDLE) && retval) || (uFlags & BF_ADJUST) )
539 int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
540 + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
542 if(uFlags & BF_LEFT) InnerRect.left += add;
543 if(uFlags & BF_RIGHT) InnerRect.right -= add;
544 if(uFlags & BF_TOP) InnerRect.top += add;
545 if(uFlags & BF_BOTTOM) InnerRect.bottom -= add;
547 if((uFlags & BF_MIDDLE) && retval)
549 FillRect(hdc, &InnerRect, GetSysColorBrush(uFlags & BF_MONO ?
550 COLOR_WINDOW : COLOR_BTNFACE));
553 if(uFlags & BF_ADJUST)
558 SelectObject(hdc, SavePen);
559 MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL);
564 /**********************************************************************
565 * DrawEdge16 (USER.659)
567 BOOL16 WINAPI DrawEdge16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags )
572 CONV_RECT16TO32( rc, &rect32 );
573 ret = DrawEdge( hdc, &rect32, edge, flags );
574 CONV_RECT32TO16( &rect32, rc );
578 /**********************************************************************
579 * DrawEdge (USER32.155)
581 BOOL WINAPI DrawEdge( HDC hdc, LPRECT rc, UINT edge, UINT flags )
583 TRACE("%04x %d,%d-%d,%d %04x %04x\n",
584 hdc, rc->left, rc->top, rc->right, rc->bottom, edge, flags );
586 if(flags & BF_DIAGONAL)
587 return UITOOLS95_DrawDiagEdge(hdc, rc, edge, flags);
589 return UITOOLS95_DrawRectEdge(hdc, rc, edge, flags);
593 /************************************************************************
594 * UITOOLS_MakeSquareRect
596 * Utility to create a square rectangle and returning the width
598 static int UITOOLS_MakeSquareRect(LPRECT src, LPRECT dst)
600 int Width = src->right - src->left;
601 int Height = src->bottom - src->top;
602 int SmallDiam = Width > Height ? Height : Width;
606 /* Make it a square box */
607 if(Width < Height) /* SmallDiam == Width */
609 dst->top += (Height-Width)/2;
610 dst->bottom = dst->top + SmallDiam;
612 else if(Width > Height) /* SmallDiam == Height */
614 dst->left += (Width-Height)/2;
615 dst->right = dst->left + SmallDiam;
621 static void UITOOLS_DrawCheckedRect( HDC dc, LPRECT rect )
623 if(GetSysColor(COLOR_BTNHIGHLIGHT) == RGB(255, 255, 255))
625 HBITMAP hbm = CreateBitmap(8, 8, 1, 1, wPattern_AA55);
627 HBRUSH hb = CreatePatternBrush(hbm);
630 FillRect(dc, rect, GetSysColorBrush(COLOR_BTNFACE));
631 bg = SetBkColor(dc, RGB(255, 255, 255));
632 hbsave = (HBRUSH)SelectObject(dc, hb);
633 PatBlt(dc, rect->left, rect->top, rect->right-rect->left, rect->bottom-rect->top, 0x00FA0089);
634 SelectObject(dc, hbsave);
641 FillRect(dc, rect, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
645 /************************************************************************
646 * UITOOLS_DFC_ButtonPush
648 * Draw a push button coming from DrawFrameControl()
650 * Does a pretty good job in emulating MS behavior. Some quirks are
651 * however there because MS uses a TrueType font (Marlett) to draw
654 static BOOL UITOOLS95_DFC_ButtonPush(HDC dc, LPRECT r, UINT uFlags)
659 if(uFlags & (DFCS_PUSHED | DFCS_CHECKED | DFCS_FLAT))
664 if(uFlags & DFCS_CHECKED)
666 if(uFlags & DFCS_MONO)
667 UITOOLS95_DrawRectEdge(dc, &myr, edge, BF_MONO|BF_RECT|BF_ADJUST);
669 UITOOLS95_DrawRectEdge(dc, &myr, edge, (uFlags&DFCS_FLAT)|BF_RECT|BF_SOFT|BF_ADJUST);
671 UITOOLS_DrawCheckedRect( dc, &myr );
675 if(uFlags & DFCS_MONO)
677 UITOOLS95_DrawRectEdge(dc, &myr, edge, BF_MONO|BF_RECT|BF_ADJUST);
678 FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNFACE));
682 UITOOLS95_DrawRectEdge(dc, r, edge, (uFlags&DFCS_FLAT) | BF_MIDDLE |BF_SOFT| BF_RECT);
686 /* Adjust rectangle if asked */
687 if(uFlags & DFCS_ADJUSTRECT)
699 /************************************************************************
700 * UITOOLS_DFC_ButtonChcek
702 * Draw a check/3state button coming from DrawFrameControl()
704 * Does a pretty good job in emulating MS behavior. Some quirks are
705 * however there because MS uses a TrueType font (Marlett) to draw
709 static BOOL UITOOLS95_DFC_ButtonCheck(HDC dc, LPRECT r, UINT uFlags)
712 UINT flags = BF_RECT | BF_ADJUST;
713 UITOOLS_MakeSquareRect(r, &myr);
715 if(uFlags & DFCS_FLAT) flags |= BF_FLAT;
716 else if(uFlags & DFCS_MONO) flags |= BF_MONO;
718 UITOOLS95_DrawRectEdge( dc, &myr, EDGE_SUNKEN, flags );
720 if(uFlags & (DFCS_INACTIVE|DFCS_PUSHED))
721 FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNFACE));
722 else if( (uFlags & DFCS_BUTTON3STATE) && (uFlags & DFCS_CHECKED) )
723 UITOOLS_DrawCheckedRect( dc, &myr );
726 FillRect(dc, &myr, GetSysColorBrush(COLOR_WINDOW));
729 if(uFlags & DFCS_CHECKED)
732 i = (uFlags & DFCS_INACTIVE) || (uFlags & 0xff) == DFCS_BUTTON3STATE ?
733 COLOR_BTNSHADOW : COLOR_WINDOWTEXT;
735 /* draw 7 bars, with h=3w to form the check */
737 bar.top = myr.top + 2;
738 for (k = 0; k < 7; k++) {
739 bar.left = bar.left + 1;
740 bar.top = (k < 3) ? bar.top + 1 : bar.top - 1;
741 bar.bottom = bar.top + 3;
742 bar.right = bar.left + 1;
743 FillRect(dc, &bar, GetSysColorBrush(i));
750 /************************************************************************
751 * UITOOLS_DFC_ButtonRadio
753 * Draw a radio/radioimage/radiomask button coming from DrawFrameControl()
755 * Does a pretty good job in emulating MS behavior. Some quirks are
756 * however there because MS uses a TrueType font (Marlett) to draw
759 static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
763 int SmallDiam = UITOOLS_MakeSquareRect(r, &myr);
764 int BorderShrink = SmallDiam / 16;
769 if(BorderShrink < 1) BorderShrink = 1;
771 if((uFlags & 0xff) == DFCS_BUTTONRADIOIMAGE)
773 FillRect(dc, r, (HBRUSH)GetStockObject(BLACK_BRUSH));
776 xc = myr.left + SmallDiam - SmallDiam/2;
777 yc = myr.top + SmallDiam - SmallDiam/2;
779 /* Define bounding box */
781 myr.left = xc - i+i/2;
782 myr.right = xc + i/2;
783 myr.top = yc - i+i/2;
784 myr.bottom = yc + i/2;
786 if((uFlags & 0xff) == DFCS_BUTTONRADIOMASK)
788 hbsave = (HBRUSH)SelectObject(dc, GetStockObject(BLACK_BRUSH));
789 Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
790 SelectObject(dc, hbsave);
794 if(uFlags & (DFCS_FLAT|DFCS_MONO))
796 hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_WINDOWFRAME));
797 hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_WINDOWFRAME));
798 Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
799 SelectObject(dc, hbsave);
800 SelectObject(dc, hpsave);
804 hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT));
805 hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
806 Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top);
808 SelectObject(dc, GetSysColorPen(COLOR_BTNSHADOW));
809 SelectObject(dc, GetSysColorBrush(COLOR_BTNSHADOW));
810 Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.right+1, myr.top, myr.left-1, myr.bottom);
812 myr.left += BorderShrink;
813 myr.right -= BorderShrink;
814 myr.top += BorderShrink;
815 myr.bottom -= BorderShrink;
817 SelectObject(dc, GetSysColorPen(COLOR_3DLIGHT));
818 SelectObject(dc, GetSysColorBrush(COLOR_3DLIGHT));
819 Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top);
821 SelectObject(dc, GetSysColorPen(COLOR_3DDKSHADOW));
822 SelectObject(dc, GetSysColorBrush(COLOR_3DDKSHADOW));
823 Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.right+1, myr.top, myr.left-1, myr.bottom);
824 SelectObject(dc, hbsave);
825 SelectObject(dc, hpsave);
829 myr.left = xc - i+i/2;
830 myr.right = xc + i/2;
831 myr.top = yc - i+i/2;
832 myr.bottom = yc + i/2;
833 i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE;
834 hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i));
835 hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
836 Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
837 SelectObject(dc, hbsave);
838 SelectObject(dc, hpsave);
841 if(uFlags & DFCS_CHECKED)
845 myr.left = xc - i+i/2;
846 myr.right = xc + i/2;
847 myr.top = yc - i+i/2;
848 myr.bottom = yc + i/2;
850 i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_WINDOWTEXT;
851 hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
852 hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i));
853 Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
854 SelectObject(dc, hpsave);
855 SelectObject(dc, hbsave);
858 /* FIXME: M$ has a polygon in the center at relative points: */
859 /* 0.476, 0.476 (times SmallDiam, SmallDiam) */
863 /* when the button is unchecked. The reason for it is unknown. The */
864 /* color is COLOR_BTNHIGHLIGHT, although the polygon gets painted at */
865 /* least 3 times (it looks like a clip-region when you see it happen). */
866 /* I do not really see a reason why this should be implemented. If you */
867 /* have a good reason, let me know. Maybe this is a quirk in the Marlett */
873 /***********************************************************************
874 * UITOOLS_DrawFrameButton
876 static BOOL UITOOLS95_DrawFrameButton(HDC hdc, LPRECT rc, UINT uState)
878 switch(uState & 0xff)
880 case DFCS_BUTTONPUSH:
881 return UITOOLS95_DFC_ButtonPush(hdc, rc, uState);
883 case DFCS_BUTTONCHECK:
884 case DFCS_BUTTON3STATE:
885 return UITOOLS95_DFC_ButtonCheck(hdc, rc, uState);
887 case DFCS_BUTTONRADIOIMAGE:
888 case DFCS_BUTTONRADIOMASK:
889 case DFCS_BUTTONRADIO:
890 return UITOOLS95_DFC_ButtonRadio(hdc, rc, uState);
893 WARN("Invalid button state=0x%04x\n", uState);
899 /***********************************************************************
900 * UITOOLS_DrawFrameCaption
902 * Draw caption buttons (win95), coming from DrawFrameControl()
905 static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
912 int SmallDiam = UITOOLS_MakeSquareRect(r, &myr)-2;
917 int xc = (myr.left+myr.right)/2;
918 int yc = (myr.top+myr.bottom)/2;
926 UITOOLS95_DFC_ButtonPush(dc, r, uFlags & 0xff00);
928 switch(uFlags & 0xff)
930 case DFCS_CAPTIONCLOSE:
931 edge = 328*SmallDiam/1000;
932 move = 95*SmallDiam/1000;
933 Line1[0].x = Line2[0].x = Line1[1].x = Line2[1].x = xc - edge;
934 Line1[2].y = Line2[5].y = Line1[1].y = Line2[4].y = yc - edge;
935 Line1[3].x = Line2[3].x = Line1[4].x = Line2[4].x = xc + edge;
936 Line1[5].y = Line2[2].y = Line1[4].y = Line2[1].y = yc + edge;
937 Line1[2].x = Line2[2].x = Line1[1].x + move;
938 Line1[0].y = Line2[3].y = Line1[1].y + move;
939 Line1[5].x = Line2[5].x = Line1[4].x - move;
940 Line1[3].y = Line2[0].y = Line1[4].y - move;
945 case DFCS_CAPTIONHELP:
946 /* This one breaks the flow */
947 /* FIXME: We need the Marlett font in order to get this right. */
949 hf = CreateFontA(-SmallDiam, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
950 ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
951 DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "System");
952 alignsave = SetTextAlign(dc, TA_TOP|TA_LEFT);
953 bksave = SetBkMode(dc, TRANSPARENT);
954 clrsave = GetTextColor(dc);
955 hfsave = (HFONT)SelectObject(dc, hf);
956 GetTextExtentPoint32A(dc, str, 1, &size);
958 if(uFlags & DFCS_INACTIVE)
960 SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT));
961 TextOutA(dc, xc-size.cx/2+1, yc-size.cy/2+1, str, 1);
963 SetTextColor(dc, GetSysColor(uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT));
964 TextOutA(dc, xc-size.cx/2, yc-size.cy/2, str, 1);
966 SelectObject(dc, hfsave);
967 SetTextColor(dc, clrsave);
968 SetBkMode(dc, bksave);
969 SetTextAlign(dc, alignsave);
973 case DFCS_CAPTIONMIN:
974 Line1[0].x = Line1[3].x = myr.left + 96*SmallDiam/750+2;
975 Line1[1].x = Line1[2].x = Line1[0].x + 372*SmallDiam/750;
976 Line1[0].y = Line1[1].y = myr.top + 563*SmallDiam/750+1;
977 Line1[2].y = Line1[3].y = Line1[0].y + 92*SmallDiam/750;
982 case DFCS_CAPTIONMAX:
983 edge = 47*SmallDiam/750;
984 Line1[0].x = Line1[5].x = myr.left + 57*SmallDiam/750+3;
985 Line1[0].y = Line1[1].y = myr.top + 143*SmallDiam/750+1;
986 Line1[1].x = Line1[2].x = Line1[0].x + 562*SmallDiam/750;
987 Line1[5].y = Line1[4].y = Line1[0].y + 93*SmallDiam/750;
988 Line1[2].y = Line1[3].y = Line1[0].y + 513*SmallDiam/750;
989 Line1[3].x = Line1[4].x = Line1[1].x - edge;
991 Line2[0].x = Line2[5].x = Line1[0].x;
992 Line2[3].x = Line2[4].x = Line1[1].x;
993 Line2[1].x = Line2[2].x = Line1[0].x + edge;
994 Line2[0].y = Line2[1].y = Line1[0].y;
995 Line2[4].y = Line2[5].y = Line1[2].y;
996 Line2[2].y = Line2[3].y = Line1[2].y - edge;
1001 case DFCS_CAPTIONRESTORE:
1002 /* FIXME: this one looks bad at small sizes < 15x15 :( */
1003 edge = 47*SmallDiam/750;
1004 move = 420*SmallDiam/750;
1005 Line1[0].x = Line1[9].x = myr.left + 198*SmallDiam/750+2;
1006 Line1[0].y = Line1[1].y = myr.top + 169*SmallDiam/750+1;
1007 Line1[6].y = Line1[7].y = Line1[0].y + 93*SmallDiam/750;
1008 Line1[7].x = Line1[8].x = Line1[0].x + edge;
1009 Line1[1].x = Line1[2].x = Line1[0].x + move;
1010 Line1[5].x = Line1[6].x = Line1[1].x - edge;
1011 Line1[9].y = Line1[8].y = Line1[0].y + 187*SmallDiam/750;
1012 Line1[2].y = Line1[3].y = Line1[0].y + 327*SmallDiam/750;
1013 Line1[4].y = Line1[5].y = Line1[2].y - edge;
1014 Line1[3].x = Line1[4].x = Line1[2].x - 140*SmallDiam/750;
1016 Line2[1].x = Line2[2].x = Line1[3].x;
1017 Line2[7].x = Line2[8].x = Line2[1].x - edge;
1018 Line2[0].x = Line2[9].x = Line2[3].x = Line2[4].x = Line2[1].x - move;
1019 Line2[5].x = Line2[6].x = Line2[0].x + edge;
1020 Line2[0].y = Line2[1].y = Line1[9].y;
1021 Line2[4].y = Line2[5].y = Line2[8].y = Line2[9].y = Line2[0].y + 93*SmallDiam/750;
1022 Line2[2].y = Line2[3].y = Line2[0].y + 327*SmallDiam/750;
1023 Line2[6].y = Line2[7].y = Line2[2].y - edge;
1029 WARN("Invalid caption; flags=0x%04x\n", uFlags);
1033 /* Here the drawing takes place */
1034 if(uFlags & DFCS_INACTIVE)
1036 /* If we have an inactive button, then you see a shadow */
1037 hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
1038 hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT));
1039 Polygon(dc, Line1, Line1N);
1041 Polygon(dc, Line2, Line2N);
1042 SelectObject(dc, hpsave);
1043 SelectObject(dc, hbsave);
1046 /* Correct for the shadow shift */
1047 for(i = 0; i < Line1N; i++)
1052 for(i = 0; i < Line2N; i++)
1058 /* Make the final picture */
1059 i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT;
1060 hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
1061 hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i));
1063 Polygon(dc, Line1, Line1N);
1065 Polygon(dc, Line2, Line2N);
1066 SelectObject(dc, hpsave);
1067 SelectObject(dc, hbsave);
1073 /************************************************************************
1074 * UITOOLS_DrawFrameScroll
1076 * Draw a scroll-bar control coming from DrawFrameControl()
1078 static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
1082 int SmallDiam = UITOOLS_MakeSquareRect(r, &myr) - 2;
1084 HBRUSH hbsave, hb, hb2;
1085 HPEN hpsave, hp, hp2;
1086 int tri = 290*SmallDiam/1000 - 1;
1090 * This fixes a problem with really tiny "scroll" buttons. In particular
1091 * with the updown control.
1092 * Making sure that the arrow is as least 3 pixels wide (or high).
1097 switch(uFlags & 0xff)
1099 case DFCS_SCROLLCOMBOBOX:
1100 case DFCS_SCROLLDOWN:
1101 Line[2].x = myr.left + 470*SmallDiam/1000 + 2;
1102 Line[2].y = myr.top + 687*SmallDiam/1000 + 1;
1103 Line[0].x = Line[2].x - tri;
1104 Line[1].x = Line[2].x + tri;
1105 Line[0].y = Line[1].y = Line[2].y - tri;
1109 Line[2].x = myr.left + 470*SmallDiam/1000 + 2;
1110 Line[2].y = myr.bottom - (687*SmallDiam/1000 + 1);
1111 Line[0].x = Line[2].x - tri;
1112 Line[1].x = Line[2].x + tri;
1113 Line[0].y = Line[1].y = Line[2].y + tri;
1116 case DFCS_SCROLLLEFT:
1117 Line[2].x = myr.right - (687*SmallDiam/1000 + 1);
1118 Line[2].y = myr.top + 470*SmallDiam/1000 + 2;
1119 Line[0].y = Line[2].y - tri;
1120 Line[1].y = Line[2].y + tri;
1121 Line[0].x = Line[1].x = Line[2].x + tri;
1124 case DFCS_SCROLLRIGHT:
1125 Line[2].x = myr.left + 687*SmallDiam/1000 + 1;
1126 Line[2].y = myr.top + 470*SmallDiam/1000 + 2;
1127 Line[0].y = Line[2].y - tri;
1128 Line[1].y = Line[2].y + tri;
1129 Line[0].x = Line[1].x = Line[2].x - tri;
1132 case DFCS_SCROLLSIZEGRIP:
1133 /* This one breaks the flow... */
1134 UITOOLS95_DrawRectEdge(dc, r, EDGE_BUMP, BF_MIDDLE | ((uFlags&(DFCS_MONO|DFCS_FLAT)) ? BF_MONO : 0));
1135 hpsave = (HPEN)SelectObject(dc, GetStockObject(NULL_PEN));
1136 hbsave = (HBRUSH)SelectObject(dc, GetStockObject(NULL_BRUSH));
1137 if(uFlags & (DFCS_MONO|DFCS_FLAT))
1139 hp = hp2 = GetSysColorPen(COLOR_WINDOWFRAME);
1140 hb = hb2 = GetSysColorBrush(COLOR_WINDOWFRAME);
1144 hp = GetSysColorPen(COLOR_BTNHIGHLIGHT);
1145 hp2 = GetSysColorPen(COLOR_BTNSHADOW);
1146 hb = GetSysColorBrush(COLOR_BTNHIGHLIGHT);
1147 hb2 = GetSysColorBrush(COLOR_BTNSHADOW);
1149 Line[0].x = Line[1].x = r->right-1;
1150 Line[2].y = Line[3].y = r->bottom-1;
1151 d46 = 46*SmallDiam/750;
1152 d93 = 93*SmallDiam/750;
1154 i = 586*SmallDiam/750;
1155 Line[0].y = r->bottom - i - 1;
1156 Line[3].x = r->right - i - 1;
1157 Line[1].y = Line[0].y + d46;
1158 Line[2].x = Line[3].x + d46;
1159 SelectObject(dc, hb);
1160 SelectObject(dc, hp);
1161 Polygon(dc, Line, 4);
1163 Line[1].y++; Line[2].x++;
1164 Line[0].y = Line[1].y + d93;
1165 Line[3].x = Line[2].x + d93;
1166 SelectObject(dc, hb2);
1167 SelectObject(dc, hp2);
1168 Polygon(dc, Line, 4);
1170 i = 398*SmallDiam/750;
1171 Line[0].y = r->bottom - i - 1;
1172 Line[3].x = r->right - i - 1;
1173 Line[1].y = Line[0].y + d46;
1174 Line[2].x = Line[3].x + d46;
1175 SelectObject(dc, hb);
1176 SelectObject(dc, hp);
1177 Polygon(dc, Line, 4);
1179 Line[1].y++; Line[2].x++;
1180 Line[0].y = Line[1].y + d93;
1181 Line[3].x = Line[2].x + d93;
1182 SelectObject(dc, hb2);
1183 SelectObject(dc, hp2);
1184 Polygon(dc, Line, 4);
1186 i = 210*SmallDiam/750;
1187 Line[0].y = r->bottom - i - 1;
1188 Line[3].x = r->right - i - 1;
1189 Line[1].y = Line[0].y + d46;
1190 Line[2].x = Line[3].x + d46;
1191 SelectObject(dc, hb);
1192 SelectObject(dc, hp);
1193 Polygon(dc, Line, 4);
1195 Line[1].y++; Line[2].x++;
1196 Line[0].y = Line[1].y + d93;
1197 Line[3].x = Line[2].x + d93;
1198 SelectObject(dc, hb2);
1199 SelectObject(dc, hp2);
1200 Polygon(dc, Line, 4);
1202 SelectObject(dc, hpsave);
1203 SelectObject(dc, hbsave);
1207 WARN("Invalid scroll; flags=0x%04x\n", uFlags);
1211 /* Here do the real scroll-bar controls end up */
1212 if( ! (uFlags & (0xff00 & ~DFCS_ADJUSTRECT)) )
1213 /* UITOOLS95_DFC_ButtonPush always uses BF_SOFT which we don't */
1214 /* want for the normal scroll-arrow button. */
1215 UITOOLS95_DrawRectEdge( dc, r, EDGE_RAISED, (uFlags&DFCS_ADJUSTRECT) | BF_MIDDLE | BF_RECT);
1217 UITOOLS95_DFC_ButtonPush(dc, r, (uFlags & 0xff00) );
1219 if(uFlags & DFCS_INACTIVE)
1221 hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
1222 hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT));
1223 Polygon(dc, Line, 3);
1224 SelectObject(dc, hpsave);
1225 SelectObject(dc, hbsave);
1228 if( (uFlags & DFCS_INACTIVE) || !(uFlags & DFCS_PUSHED) )
1229 for(i = 0; i < 3; i++)
1235 i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT;
1236 hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
1237 hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i));
1238 Polygon(dc, Line, 3);
1239 SelectObject(dc, hpsave);
1240 SelectObject(dc, hbsave);
1245 /************************************************************************
1246 * UITOOLS_DrawFrameMenu
1248 * Draw a menu control coming from DrawFrameControl()
1250 static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
1254 int SmallDiam = UITOOLS_MakeSquareRect(r, &myr);
1262 /* Using black and white seems to be utterly wrong, but win95 doesn't */
1263 /* use anything else. I think I tried all sys-colors to change things */
1264 /* without luck. It seems as if this behavior is inherited from the */
1265 /* win31 DFC() implementation... (you remember, B/W menus). */
1267 FillRect(dc, r, (HBRUSH)GetStockObject(WHITE_BRUSH));
1269 hbsave = (HBRUSH)SelectObject(dc, GetStockObject(BLACK_BRUSH));
1270 hpsave = (HPEN)SelectObject(dc, GetStockObject(BLACK_PEN));
1272 switch(uFlags & 0xff)
1274 case DFCS_MENUARROW:
1275 i = 187*SmallDiam/750;
1276 Points[2].x = myr.left + 468*SmallDiam/750;
1277 Points[2].y = myr.top + 352*SmallDiam/750+1;
1278 Points[0].y = Points[2].y - i;
1279 Points[1].y = Points[2].y + i;
1280 Points[0].x = Points[1].x = Points[2].x - i;
1281 Polygon(dc, Points, 3);
1284 case DFCS_MENUBULLET:
1286 ye = myr.top + SmallDiam - SmallDiam/2;
1287 xc = myr.left + SmallDiam - SmallDiam/2;
1288 yc = myr.top + SmallDiam - SmallDiam/2;
1289 i = 234*SmallDiam/750;
1291 myr.left = xc - i+i/2;
1292 myr.right = xc + i/2;
1293 myr.top = yc - i+i/2;
1294 myr.bottom = yc + i/2;
1295 Pie(dc, myr.left, myr.top, myr.right, myr.bottom, xe, ye, xe, ye);
1298 case DFCS_MENUCHECK:
1299 Points[0].x = myr.left + 253*SmallDiam/1000;
1300 Points[0].y = myr.top + 445*SmallDiam/1000;
1301 Points[1].x = myr.left + 409*SmallDiam/1000;
1302 Points[1].y = Points[0].y + (Points[1].x-Points[0].x);
1303 Points[2].x = myr.left + 690*SmallDiam/1000;
1304 Points[2].y = Points[1].y - (Points[2].x-Points[1].x);
1305 Points[3].x = Points[2].x;
1306 Points[3].y = Points[2].y + 3*SmallDiam/16;
1307 Points[4].x = Points[1].x;
1308 Points[4].y = Points[1].y + 3*SmallDiam/16;
1309 Points[5].x = Points[0].x;
1310 Points[5].y = Points[0].y + 3*SmallDiam/16;
1311 Polygon(dc, Points, 6);
1315 WARN("Invalid menu; flags=0x%04x\n", uFlags);
1320 SelectObject(dc, hpsave);
1321 SelectObject(dc, hbsave);
1326 /**********************************************************************
1327 * DrawFrameControl16 (USER.656)
1329 BOOL16 WINAPI DrawFrameControl16( HDC16 hdc, LPRECT16 rc, UINT16 uType,
1335 CONV_RECT16TO32( rc, &rect32 );
1336 ret = DrawFrameControl( hdc, &rect32, uType, uState );
1337 CONV_RECT32TO16( &rect32, rc );
1342 /**********************************************************************
1343 * DrawFrameControl (USER32.158)
1345 BOOL WINAPI DrawFrameControl( HDC hdc, LPRECT rc, UINT uType,
1348 /* Win95 doesn't support drawing in other mapping modes */
1349 if(GetMapMode(hdc) != MM_TEXT)
1355 return UITOOLS95_DrawFrameButton(hdc, rc, uState);
1357 return UITOOLS95_DrawFrameCaption(hdc, rc, uState);
1359 return UITOOLS95_DrawFrameMenu(hdc, rc, uState);
1361 return UITOOLS95_DrawFrameScroll(hdc, rc, uState);
1363 WARN("(%x,%p,%d,%x), bad type!\n",
1364 hdc,rc,uType,uState );