ReactOS 0.4.16-dev-88-ga65b6ae
button.c
Go to the documentation of this file.
1/* File: button.c -- Button type widgets
2 *
3 * Copyright (C) 1993 Johannes Ruscheinski
4 * Copyright (C) 1993 David Metcalfe
5 * Copyright (C) 1994 Alexandre Julliard
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 *
21 * NOTES
22 *
23 * This code was audited for completeness against the documented features
24 * of Comctl32.dll version 6.0 on Oct. 3, 2004, by Dimitrie O. Paun.
25 *
26 * Unless otherwise noted, we believe this code to be complete, as per
27 * the specification mentioned above.
28 * If you discover missing features, or bugs, please note them below.
29 *
30 * TODO
31 * Styles
32 * - BS_NOTIFY: is it complete?
33 * - BS_RIGHTBUTTON: same as BS_LEFTTEXT
34 *
35 * Messages
36 * - WM_CHAR: Checks a (manual or automatic) check box on '+' or '=', clears it on '-' key.
37 * - WM_SETFOCUS: For (manual or automatic) radio buttons, send the parent window BN_CLICKED
38 * - WM_NCCREATE: Turns any BS_OWNERDRAW button into a BS_PUSHBUTTON button.
39 * - WM_SYSKEYUP
40 * - BCM_GETIDEALSIZE
41 * - BCM_GETIMAGELIST
42 * - BCM_GETTEXTMARGIN
43 * - BCM_SETIMAGELIST
44 * - BCM_SETTEXTMARGIN
45 *
46 * Notifications
47 * - BCN_HOTITEMCHANGE
48 * - BN_DISABLE
49 * - BN_PUSHED/BN_HILITE
50 * + BN_KILLFOCUS: is it OK?
51 * - BN_PAINT
52 * + BN_SETFOCUS: is it OK?
53 * - BN_UNPUSHED/BN_UNHILITE
54 * - NM_CUSTOMDRAW
55 *
56 * Structures/Macros/Definitions
57 * - BUTTON_IMAGELIST
58 * - NMBCHOTITEM
59 * - Button_GetIdealSize
60 * - Button_GetImageList
61 * - Button_GetTextMargin
62 * - Button_SetImageList
63 * - Button_SetTextMargin
64 */
65
66#include <user32.h>
67
69
70/* GetWindowLong offsets for window extra information */
71#define STATE_GWL_OFFSET 0
72#define BUTTON_HFONT_GWL_OFFSET (sizeof(LONG))
73#define HIMAGE_GWL_OFFSET (BUTTON_HFONT_GWL_OFFSET+sizeof(HFONT))
74#define BUTTON_UISTATE_GWL_OFFSET (HIMAGE_GWL_OFFSET+sizeof(HFONT))
75#define NB_EXTRA_BYTES (BUTTON_UISTATE_GWL_OFFSET+sizeof(LONG_PTR))
76
77/* undocumented flags */
78#define BUTTON_NSTATES 0x0F
79#define BUTTON_BTNPRESSED 0x40
80#define BUTTON_UNKNOWN2 0x20
81#define BUTTON_UNKNOWN3 0x10
82#ifdef __REACTOS__
83#define BUTTON_BMCLICK 0x100 // ReactOS Need to up to wine!
84#endif
85
86#define BUTTON_NOTIFY_PARENT(hWnd, code) \
87 do { /* Notify parent which has created this button control */ \
88 TRACE("notification " #code " sent to hwnd=%p\n", GetParent(hWnd)); \
89 SendMessageW(GetParent(hWnd), WM_COMMAND, \
90 MAKEWPARAM(GetWindowLongPtrW((hWnd),GWLP_ID), (code)), \
91 (LPARAM)(hWnd)); \
92 } while(0)
93
95static void PB_Paint( HWND hwnd, HDC hDC, UINT action );
96static void CB_Paint( HWND hwnd, HDC hDC, UINT action );
97static void GB_Paint( HWND hwnd, HDC hDC, UINT action );
98static void UB_Paint( HWND hwnd, HDC hDC, UINT action );
99static void OB_Paint( HWND hwnd, HDC hDC, UINT action );
101
102#define MAX_BTN_TYPE 16
103
105{
106 BST_UNCHECKED, /* BS_PUSHBUTTON */
107 BST_UNCHECKED, /* BS_DEFPUSHBUTTON */
108 BST_CHECKED, /* BS_CHECKBOX */
109 BST_CHECKED, /* BS_AUTOCHECKBOX */
110 BST_CHECKED, /* BS_RADIOBUTTON */
111 BST_INDETERMINATE, /* BS_3STATE */
112 BST_INDETERMINATE, /* BS_AUTO3STATE */
113 BST_UNCHECKED, /* BS_GROUPBOX */
114 BST_UNCHECKED, /* BS_USERBUTTON */
115 BST_CHECKED, /* BS_AUTORADIOBUTTON */
116 BST_UNCHECKED, /* BS_PUSHBOX */
117 BST_UNCHECKED /* BS_OWNERDRAW */
118};
119
121
123{
124 PB_Paint, /* BS_PUSHBUTTON */
125 PB_Paint, /* BS_DEFPUSHBUTTON */
126 CB_Paint, /* BS_CHECKBOX */
127 CB_Paint, /* BS_AUTOCHECKBOX */
128 CB_Paint, /* BS_RADIOBUTTON */
129 CB_Paint, /* BS_3STATE */
130 CB_Paint, /* BS_AUTO3STATE */
131 GB_Paint, /* BS_GROUPBOX */
132 UB_Paint, /* BS_USERBUTTON */
133 CB_Paint, /* BS_AUTORADIOBUTTON */
134 NULL, /* BS_PUSHBOX */
135 OB_Paint /* BS_OWNERDRAW */
136};
137
138/*********************************************************************
139 * button class descriptor
140 */
141static const WCHAR buttonW[] = {'B','u','t','t','o','n',0};
143{
144 buttonW, /* name */
146#ifdef __REACTOS__
147 ButtonWndProcA, /* procA */
148 ButtonWndProcW, /* procW */
149#else
150 WINPROC_BUTTON, /* proc */
151#endif
152 NB_EXTRA_BYTES, /* extra */
153 IDC_ARROW, /* cursor */
154 0 /* brush */
155};
156
157
159{
161}
162
163static inline void set_button_state( HWND hwnd, LONG state )
164{
166}
167
168#ifdef __REACTOS__
169
170static __inline void set_ui_state( HWND hwnd, LONG flags )
171{
173}
174
175static __inline LONG get_ui_state( HWND hwnd )
176{
178}
179
180#endif /* __REACTOS__ */
181
183{
185}
186
187static inline void set_button_font( HWND hwnd, HFONT font )
188{
190}
191
192static inline UINT get_button_type( LONG window_style )
193{
194 return (window_style & BS_TYPEMASK);
195}
196
197/* paint a button of any type */
198static inline void paint_button( HWND hwnd, LONG style, UINT action )
199{
201 {
202 HDC hdc = GetDC( hwnd );
204 ReleaseDC( hwnd, hdc );
205 }
206}
207
208/* retrieve the button text; returned buffer must be freed by caller */
210{
211 INT len = 512;
212 WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) );
214 return buffer;
215}
216
217#ifdef __REACTOS__
218/* Retrieve the UI state for the control */
219static BOOL button_update_uistate(HWND hwnd, BOOL unicode)
220{
221 LONG flags, prevflags;
222
223 if (unicode)
224 flags = DefWindowProcW(hwnd, WM_QUERYUISTATE, 0, 0);
225 else
226 flags = DefWindowProcA(hwnd, WM_QUERYUISTATE, 0, 0);
227
228 prevflags = get_ui_state(hwnd);
229
230 if (prevflags != flags)
231 {
232 set_ui_state(hwnd, flags);
233 return TRUE;
234 }
235
236 return FALSE;
237}
238#endif
239
240/***********************************************************************
241 * ButtonWndProc_common
242 */
244 WPARAM wParam, LPARAM lParam, BOOL unicode )
245{
246 RECT rect;
247 POINT pt;
249 UINT btn_type = get_button_type( style );
250 LONG state;
251 HANDLE oldHbitmap;
252#ifdef __REACTOS__
253 PWND pWnd;
254
255 pWnd = ValidateHwnd(hWnd);
256 if (pWnd)
257 {
258 if (!pWnd->fnid)
259 {
261 }
262 else
263 {
264 if (pWnd->fnid != FNID_BUTTON)
265 {
266 ERR("Wrong window class for Button! fnId 0x%x\n",pWnd->fnid);
267 return 0;
268 }
269 }
270 }
271 else
272 return 0;
273#else
274 if (!IsWindow( hWnd )) return 0;
275#endif
276
277 pt.x = (short)LOWORD(lParam);
278 pt.y = (short)HIWORD(lParam);
279
280 switch (uMsg)
281 {
282 case WM_GETDLGCODE:
283 switch(btn_type)
284 {
285 case BS_USERBUTTON:
288 case BS_RADIOBUTTON:
290 case BS_GROUPBOX: return DLGC_STATIC;
291 default: return DLGC_BUTTON;
292 }
293
294 case WM_ENABLE:
295 paint_button( hWnd, btn_type, ODA_DRAWENTIRE );
296 break;
297
298 case WM_CREATE:
299 if (btn_type >= MAX_BTN_TYPE)
300 return -1; /* abort */
301
302 /* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
303 if (btn_type == BS_USERBUTTON )
304 {
305 style = (style & ~BS_TYPEMASK) | BS_PUSHBUTTON;
306#ifdef __REACTOS__
308#else
309 WIN_SetStyle( hWnd, style, BS_TYPEMASK & ~style );
310#endif
311 }
313#ifdef __REACTOS__
314 button_update_uistate( hWnd, unicode );
315#endif
316 return 0;
317
318#ifdef __REACTOS__
319 case WM_NCDESTROY:
321 case WM_DESTROY:
322 break;
323#endif
324
325 case WM_ERASEBKGND:
326 if (btn_type == BS_OWNERDRAW)
327 {
328 HDC hdc = (HDC)wParam;
329 RECT rc;
330 HBRUSH hBrush;
332 if (!parent) parent = hWnd;
333#ifdef __REACTOS__
335#else
336 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hdc, (LPARAM)hWnd);
337 if (!hBrush) /* did the app forget to call defwindowproc ? */
338 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN,
339 (WPARAM)hdc, (LPARAM)hWnd);
340#endif
341 GetClientRect(hWnd, &rc);
342 FillRect(hdc, &rc, hBrush);
343 }
344 return 1;
345
346 case WM_PRINTCLIENT:
347 case WM_PAINT:
348 {
349 PAINTSTRUCT ps;
350 HDC hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
351 if (btnPaintFunc[btn_type])
352 {
353 int nOldMode = SetBkMode( hdc, OPAQUE );
354 (btnPaintFunc[btn_type])( hWnd, hdc, ODA_DRAWENTIRE );
355 SetBkMode(hdc, nOldMode); /* reset painting mode */
356 }
357 if ( !wParam ) EndPaint( hWnd, &ps );
358 break;
359 }
360
361 case WM_KEYDOWN:
362 if (wParam == VK_SPACE)
363 {
366 SetCapture( hWnd );
367 }
368 break;
369
370 case WM_LBUTTONDBLCLK:
371 if(style & BS_NOTIFY ||
372 btn_type == BS_RADIOBUTTON ||
373 btn_type == BS_USERBUTTON ||
374 btn_type == BS_OWNERDRAW)
375 {
377 break;
378 }
379 /* fall through */
380 case WM_LBUTTONDOWN:
381 SetCapture( hWnd );
382 SetFocus( hWnd );
385 break;
386
387 case WM_KEYUP:
388 if (wParam != VK_SPACE)
389 break;
390 /* fall through */
391 case WM_LBUTTONUP:
392#ifdef __REACTOS__
393 {
394 BOOL TellParent = FALSE;
395#endif
397 if (!(state & BUTTON_BTNPRESSED)) break;
400 if (!(state & BST_PUSHED))
401 {
403 break;
404 }
407 if (uMsg == WM_KEYUP || PtInRect( &rect, pt ))
408 {
410 switch(btn_type)
411 {
412 case BS_AUTOCHECKBOX:
414 break;
417 break;
418 case BS_AUTO3STATE:
420 (state & BST_INDETERMINATE) ? 0 : ((state & 3) + 1), 0 );
421 break;
422 }
423#ifdef __REACTOS__
424 TellParent = TRUE; // <---- Fix CORE-10194, Notify parent after capture is released.
425#else
428#endif
429 }
430#ifndef __REACTOS__
431 else
432 {
434 }
435#else
437 if (TellParent) BUTTON_NOTIFY_PARENT(hWnd, BN_CLICKED);
438 }
439#endif
440 break;
441
443 TRACE("WM_CAPTURECHANGED %p\n", hWnd);
444 if (hWnd == (HWND)lParam) break;
447 {
451 }
452 break;
453
454 case WM_MOUSEMOVE:
455 if ((wParam & MK_LBUTTON) && GetCapture() == hWnd)
456 {
459 }
460 break;
461
462 case WM_SETTEXT:
463 {
464 /* Clear an old text here as Windows does */
465//
466// ReactOS Note :
467// wine Bug: http://bugs.winehq.org/show_bug.cgi?id=25790
468// Patch: http://source.winehq.org/patches/data/70889
469// By: Alexander LAW, Replicate Windows behavior of WM_SETTEXT handler regarding WM_CTLCOLOR*
470//
471#ifdef __REACTOS__
472 if (style & WS_VISIBLE)
473#else
475#endif
476 {
477 HDC hdc = GetDC(hWnd);
478 HBRUSH hbrush;
479 RECT client, rc;
481 UINT message = (btn_type == BS_PUSHBUTTON ||
482 btn_type == BS_DEFPUSHBUTTON ||
483 btn_type == BS_PUSHLIKE ||
484 btn_type == BS_USERBUTTON ||
485 btn_type == BS_OWNERDRAW) ?
487
488 if (!parent) parent = hWnd;
489#ifdef __REACTOS__
491#else
493 (WPARAM)hdc, (LPARAM)hWnd);
494 if (!hbrush) /* did the app forget to call DefWindowProc ? */
496 (WPARAM)hdc, (LPARAM)hWnd);
497#endif
498
500 rc = client;
501 /* FIXME: check other BS_* handlers */
502 if (btn_type == BS_GROUPBOX)
503 InflateRect(&rc, -7, 1); /* GB_Paint does this */
505 /* Clip by client rect bounds */
506 if (rc.right > client.right) rc.right = client.right;
507 if (rc.bottom > client.bottom) rc.bottom = client.bottom;
508 FillRect(hdc, &rc, hbrush);
510 }
511
512 if (unicode) DefWindowProcW( hWnd, WM_SETTEXT, wParam, lParam );
514 if (btn_type == BS_GROUPBOX) /* Yes, only for BS_GROUPBOX */
516 else
517 paint_button( hWnd, btn_type, ODA_DRAWENTIRE );
518 return 1; /* success. FIXME: check text length */
519 }
520
521 case WM_SETFONT:
524 break;
525
526 case WM_GETFONT:
527 return (LRESULT)get_button_font( hWnd );
528
529 case WM_SETFOCUS:
530 TRACE("WM_SETFOCUS %p\n",hWnd);
532 paint_button( hWnd, btn_type, ODA_FOCUS );
533 if (style & BS_NOTIFY)
535#ifdef __REACTOS__
536 if (((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON)) &&
538 {
540 }
541#endif
542 break;
543
544 case WM_KILLFOCUS:
545 TRACE("WM_KILLFOCUS %p\n",hWnd);
548 paint_button( hWnd, btn_type, ODA_FOCUS );
549
550 if ((state & BUTTON_BTNPRESSED) && GetCapture() == hWnd)
552 if (style & BS_NOTIFY)
554
556 break;
557
560 break;
561
562 case BM_SETSTYLE:
563 btn_type = wParam & BS_TYPEMASK;
564 style = (style & ~BS_TYPEMASK) | btn_type;
565#ifdef __REACTOS__
567#else
568 WIN_SetStyle( hWnd, style, BS_TYPEMASK & ~style );
569#endif
570
571 /* Only redraw if lParam flag is set.*/
572 if (lParam)
574
575 break;
576
577 case BM_CLICK:
578#ifdef __REACTOS__
580 if (state & BUTTON_BMCLICK)
581 break;
582 set_button_state(hWnd, state | BUTTON_BMCLICK); // Tracked in STATE_GWL_OFFSET.
583#endif
586#ifdef __REACTOS__
588 if (!(state & BUTTON_BMCLICK)) break;
589 state &= ~BUTTON_BMCLICK;
591#endif
592 break;
593
594 case BM_SETIMAGE:
595 /* Check that image format matches button style */
596 switch (style & (BS_BITMAP|BS_ICON))
597 {
598 case BS_BITMAP:
599 if (wParam != IMAGE_BITMAP) return 0;
600 break;
601 case BS_ICON:
602 if (wParam != IMAGE_ICON) return 0;
603 break;
604 default:
605 return 0;
606 }
609 return (LRESULT)oldHbitmap;
610
611 case BM_GETIMAGE:
613
614 case BM_GETCHECK:
615 return get_button_state( hWnd ) & 3;
616
617 case BM_SETCHECK:
618 if (wParam > maxCheckState[btn_type]) wParam = maxCheckState[btn_type];
620 if ((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON))
621 {
622#ifdef __REACTOS__
623 if (wParam) style |= WS_TABSTOP;
624 else style &= ~WS_TABSTOP;
626#else
627 if (wParam) WIN_SetStyle( hWnd, WS_TABSTOP, 0 );
628 else WIN_SetStyle( hWnd, 0, WS_TABSTOP );
629#endif
630 }
631 if ((state & 3) != wParam)
632 {
633 set_button_state( hWnd, (state & ~3) | wParam );
634 paint_button( hWnd, btn_type, ODA_SELECT );
635 }
636 break;
637
638 case BM_GETSTATE:
639 return get_button_state( hWnd );
640
641 case BM_SETSTATE:
643 if (wParam)
645 else
647
648 paint_button( hWnd, btn_type, ODA_SELECT );
649 break;
650
651#ifdef __REACTOS__
652 case WM_UPDATEUISTATE:
653 if (unicode)
655 else
657
658 if (button_update_uistate(hWnd, unicode))
659 paint_button( hWnd, btn_type, ODA_DRAWENTIRE );
660 break;
661#endif
662
663 case WM_NCHITTEST:
664 if(btn_type == BS_GROUPBOX) return HTTRANSPARENT;
665 /* fall through */
666 default:
667 return unicode ? DefWindowProcW(hWnd, uMsg, wParam, lParam) :
669 }
670 return 0;
671}
672
673#ifdef __REACTOS__
674
675/***********************************************************************
676 * ButtonWndProcW
677 * The button window procedure. This is just a wrapper which locks
678 * the passed HWND and calls the real window procedure (with a WND*
679 * pointer pointing to the locked windowstructure).
680 */
682{
683 if (!IsWindow(hWnd)) return 0;
684 return ButtonWndProc_common(hWnd, uMsg, wParam, lParam, TRUE);
685}
686
687/***********************************************************************
688 * ButtonWndProcA
689 */
691{
692 if (!IsWindow(hWnd)) return 0;
694}
695
696#endif /* __REACTOS__ */
697
698/**********************************************************************
699 * Convert button styles to flags used by DrawText.
700 */
701static UINT BUTTON_BStoDT( DWORD style, DWORD ex_style )
702{
703 UINT dtStyle = DT_NOCLIP; /* We use SelectClipRgn to limit output */
704
705 /* "Convert" pushlike buttons to pushbuttons */
706 if (style & BS_PUSHLIKE)
707 style &= ~BS_TYPEMASK;
708
709 if (!(style & BS_MULTILINE))
710 dtStyle |= DT_SINGLELINE;
711 else
712 dtStyle |= DT_WORDBREAK;
713
714 switch (style & BS_CENTER)
715 {
716 case BS_LEFT: /* DT_LEFT is 0 */ break;
717 case BS_RIGHT: dtStyle |= DT_RIGHT; break;
718 case BS_CENTER: dtStyle |= DT_CENTER; break;
719 default:
720 /* Pushbutton's text is centered by default */
722 /* all other flavours have left aligned text */
723 }
724
725 if (ex_style & WS_EX_RIGHT) dtStyle = DT_RIGHT | (dtStyle & ~(DT_LEFT | DT_CENTER));
726
727 /* DrawText ignores vertical alignment for multiline text,
728 * but we use these flags to align label manually.
729 */
731 {
732 switch (style & BS_VCENTER)
733 {
734 case BS_TOP: /* DT_TOP is 0 */ break;
735 case BS_BOTTOM: dtStyle |= DT_BOTTOM; break;
736 case BS_VCENTER: /* fall through */
737 default: dtStyle |= DT_VCENTER; break;
738 }
739 }
740 else
741 /* GroupBox's text is always single line and is top aligned. */
742 dtStyle |= DT_SINGLELINE;
743
744 return dtStyle;
745}
746
747/**********************************************************************
748 * BUTTON_CalcLabelRect
749 *
750 * Calculates label's rectangle depending on button style.
751 *
752 * Returns flags to be passed to DrawText.
753 * Calculated rectangle doesn't take into account button state
754 * (pushed, etc.). If there is nothing to draw (no text/image) output
755 * rectangle is empty, and return value is (UINT)-1.
756 */
758{
760 LONG ex_style = GetWindowLongPtrW( hwnd, GWL_EXSTYLE );
761 WCHAR *text;
762 ICONINFO iconInfo;
763 BITMAP bm;
764 UINT dtStyle = BUTTON_BStoDT( style, ex_style );
765 RECT r = *rc;
766 INT n;
767
768 /* Calculate label rectangle according to label type */
769 switch (style & (BS_ICON|BS_BITMAP))
770 {
771 case BS_TEXT:
772 {
773 HFONT hFont, hPrevFont = 0;
774
775 if (!(text = get_button_text( hwnd ))) goto empty_rect;
776 if (!text[0])
777 {
779 goto empty_rect;
780 }
781
782 if ((hFont = get_button_font( hwnd ))) hPrevFont = SelectObject( hdc, hFont );
783#ifdef __REACTOS__
784 DrawTextW(hdc, text, -1, &r, ((dtStyle | DT_CALCRECT) & ~(DT_VCENTER | DT_BOTTOM)));
785#else
786 DrawTextW(hdc, text, -1, &r, dtStyle | DT_CALCRECT);
787#endif
788 if (hPrevFont) SelectObject( hdc, hPrevFont );
790#ifdef __REACTOS__
791 if (get_ui_state(hwnd) & UISF_HIDEACCEL)
792 dtStyle |= DT_HIDEPREFIX;
793#endif
794 break;
795 }
796
797 case BS_ICON:
799 goto empty_rect;
800
801 GetObjectW (iconInfo.hbmColor, sizeof(BITMAP), &bm);
802
803 r.right = r.left + bm.bmWidth;
804 r.bottom = r.top + bm.bmHeight;
805
806 DeleteObject(iconInfo.hbmColor);
807 DeleteObject(iconInfo.hbmMask);
808 break;
809
810 case BS_BITMAP:
812 goto empty_rect;
813
814 r.right = r.left + bm.bmWidth;
815 r.bottom = r.top + bm.bmHeight;
816 break;
817
818 default:
819 empty_rect:
820 rc->right = r.left;
821 rc->bottom = r.top;
822 return (UINT)-1;
823 }
824
825 /* Position label inside bounding rectangle according to
826 * alignment flags. (calculated rect is always left-top aligned).
827 * If label is aligned to any side - shift label in opposite
828 * direction to leave extra space for focus rectangle.
829 */
830 switch (dtStyle & (DT_CENTER|DT_RIGHT))
831 {
832 case DT_LEFT: r.left++; r.right++; break;
833 case DT_CENTER: n = r.right - r.left;
834 r.left = rc->left + ((rc->right - rc->left) - n) / 2;
835 r.right = r.left + n; break;
836 case DT_RIGHT: n = r.right - r.left;
837 r.right = rc->right - 1;
838 r.left = r.right - n;
839 break;
840 }
841
842 switch (dtStyle & (DT_VCENTER|DT_BOTTOM))
843 {
844 case DT_TOP: r.top++; r.bottom++; break;
845 case DT_VCENTER: n = r.bottom - r.top;
846#ifdef __REACTOS__
847 r.top = rc->top + ((rc->bottom - 1 - rc->top) - n) / 2;
848#else
849 r.top = rc->top + ((rc->bottom - rc->top) - n) / 2;
850#endif
851 r.bottom = r.top + n; break;
852 case DT_BOTTOM: n = r.bottom - r.top;
853 r.bottom = rc->bottom - 1;
854 r.top = r.bottom - n;
855 break;
856 }
857
858 *rc = r;
859 return dtStyle;
860}
861
862
863/**********************************************************************
864 * BUTTON_DrawTextCallback
865 *
866 * Callback function used by DrawStateW function.
867 */
869{
870 RECT rc;
871
872 SetRect(&rc, 0, 0, cx, cy);
873 DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp);
874 return TRUE;
875}
876
877
878/**********************************************************************
879 * BUTTON_DrawLabel
880 *
881 * Common function for drawing button label.
882 */
883static void BUTTON_DrawLabel(HWND hwnd, HDC hdc, UINT dtFlags, const RECT *rc)
884{
885 DRAWSTATEPROC lpOutputProc = NULL;
886 LPARAM lp;
887 WPARAM wp = 0;
888 HBRUSH hbr = 0;
892 WCHAR *text = NULL;
893
894 /* FIXME: To draw disabled label in Win31 look-and-feel, we probably
895 * must use DSS_MONO flag and COLOR_GRAYTEXT brush (or maybe DSS_UNION).
896 * I don't have Win31 on hand to verify that, so I leave it as is.
897 */
898
900 {
902 flags |= DSS_MONO;
903 }
904
905 switch (style & (BS_ICON|BS_BITMAP))
906 {
907 case BS_TEXT:
908 /* DST_COMPLEX -- is 0 */
909 lpOutputProc = BUTTON_DrawTextCallback;
910 if (!(text = get_button_text( hwnd ))) return;
911 lp = (LPARAM)text;
912 wp = (WPARAM)dtFlags;
913
914#ifdef __REACTOS__
915 if (dtFlags & DT_HIDEPREFIX)
917#endif
918 break;
919
920 case BS_ICON:
921 flags |= DST_ICON;
923 break;
924
925 case BS_BITMAP:
926 flags |= DST_BITMAP;
928 break;
929
930 default:
931 return;
932 }
933
934 DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top,
935 rc->right - rc->left, rc->bottom - rc->top, flags);
937}
938
939/**********************************************************************
940 * Push Button Functions
941 */
943{
944 RECT rc, r;
945 UINT dtFlags, uState;
946 HPEN hOldPen;
947 HBRUSH hOldBrush;
948 INT oldBkMode;
949 COLORREF oldTxtColor;
950 HFONT hFont;
953 BOOL pushedState = (state & BST_PUSHED);
954 HWND parent;
955 HRGN hrgn;
956
957 GetClientRect( hwnd, &rc );
958
959 /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
962 if (!parent) parent = hwnd;
963#ifdef __REACTOS__
965#else
967#endif
968
969 hrgn = set_control_clipping( hDC, &rc );
970#ifdef __REACTOS__
971 hOldPen = SelectObject(hDC, GetStockObject(DC_PEN));
973#else
974 hOldPen = SelectObject(hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
975#endif
977 oldBkMode = SetBkMode(hDC, TRANSPARENT);
978
980 {
981 if (action != ODA_FOCUS)
982 Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
983 InflateRect( &rc, -1, -1 );
984 }
985
986 /* completely skip the drawing if only focus has changed */
987 if (action == ODA_FOCUS) goto draw_focus;
988
989 uState = DFCS_BUTTONPUSH;
990
991 if (style & BS_FLAT)
992 uState |= DFCS_MONO;
993 else if (pushedState)
994 {
996 uState |= DFCS_FLAT;
997 else
998 uState |= DFCS_PUSHED;
999 }
1000
1002 uState |= DFCS_CHECKED;
1003
1004 DrawFrameControl( hDC, &rc, DFC_BUTTON, uState );
1005
1006 /* draw button label */
1007 r = rc;
1008 dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &r);
1009
1010 if (dtFlags == (UINT)-1L)
1011 goto cleanup;
1012
1013 if (pushedState)
1014 OffsetRect(&r, 1, 1);
1015
1016 oldTxtColor = SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) );
1017
1018 BUTTON_DrawLabel(hwnd, hDC, dtFlags, &r);
1019
1020 SetTextColor( hDC, oldTxtColor );
1021
1022draw_focus:
1023 if (action == ODA_FOCUS || (state & BST_FOCUS))
1024 {
1025#ifdef __REACTOS__
1026 if (!(get_ui_state(hwnd) & UISF_HIDEFOCUS))
1027 {
1028#endif
1029 InflateRect( &rc, -2, -2 );
1030 DrawFocusRect( hDC, &rc );
1031#ifdef __REACTOS__
1032 }
1033#endif
1034 }
1035
1036 cleanup:
1037 SelectObject( hDC, hOldPen );
1038 SelectObject( hDC, hOldBrush );
1039 SetBkMode(hDC, oldBkMode);
1041 if (hrgn) DeleteObject( hrgn );
1042}
1043
1044/**********************************************************************
1045 * Check Box & Radio Button Functions
1046 */
1047
1049{
1050 RECT rbox, rtext, client;
1051 HBRUSH hBrush;
1052 int delta, text_offset, checkBoxWidth, checkBoxHeight;
1053 UINT dtFlags;
1054 HFONT hFont;
1057 LONG ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
1058 HWND parent;
1059 HRGN hrgn;
1060
1061 if (style & BS_PUSHLIKE)
1062 {
1063 PB_Paint( hwnd, hDC, action );
1064 return;
1065 }
1066
1068 rbox = rtext = client;
1069
1070 checkBoxWidth = 12 * GetDeviceCaps( hDC, LOGPIXELSX ) / 96 + 1;
1071 checkBoxHeight = 12 * GetDeviceCaps( hDC, LOGPIXELSY ) / 96 + 1;
1072
1074 GetCharWidthW( hDC, '0', '0', &text_offset );
1075 text_offset /= 2;
1076
1078 if (!parent) parent = hwnd;
1079#ifdef __REACTOS__
1081#else
1082 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
1083 (WPARAM)hDC, (LPARAM)hwnd);
1084 if (!hBrush) /* did the app forget to call defwindowproc ? */
1085 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
1086 (WPARAM)hDC, (LPARAM)hwnd );
1087#endif
1089
1090 if (style & BS_LEFTTEXT || ex_style & WS_EX_RIGHT)
1091 {
1092 /* magic +4 is what CTL3D expects */
1093
1094 rtext.right -= checkBoxWidth + text_offset;;
1095 rbox.left = rbox.right - checkBoxWidth;
1096 }
1097 else
1098 {
1099 rtext.left += checkBoxWidth + text_offset;;
1100 rbox.right = checkBoxWidth;
1101 }
1102
1103 /* Since WM_ERASEBKGND does nothing, first prepare background */
1104 if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
1105 if (action == ODA_DRAWENTIRE) FillRect( hDC, &client, hBrush );
1106
1107 /* Draw label */
1108 client = rtext;
1109 dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &rtext);
1110
1111 /* Only adjust rbox when rtext is valid */
1112 if (dtFlags != (UINT)-1L)
1113 {
1114 rbox.top = rtext.top;
1115 rbox.bottom = rtext.bottom;
1116 }
1117
1118 /* Draw the check-box bitmap */
1120 {
1121 UINT flags;
1122
1126 else flags = DFCS_BUTTONCHECK;
1127
1130
1132
1133 /* rbox must have the correct height */
1134 delta = rbox.bottom - rbox.top - checkBoxHeight;
1135
1136 if (style & BS_TOP) {
1137 if (delta > 0) {
1138 rbox.bottom = rbox.top + checkBoxHeight;
1139 } else {
1140 rbox.top -= -delta/2 + 1;
1141 rbox.bottom = rbox.top + checkBoxHeight;
1142 }
1143 } else if (style & BS_BOTTOM) {
1144 if (delta > 0) {
1145 rbox.top = rbox.bottom - checkBoxHeight;
1146 } else {
1147 rbox.bottom += -delta/2 + 1;
1148 rbox.top = rbox.bottom - checkBoxHeight;
1149 }
1150 } else { /* Default */
1151 if (delta > 0) {
1152 int ofs = (delta / 2);
1153 rbox.bottom -= ofs + 1;
1154 rbox.top = rbox.bottom - checkBoxHeight;
1155 } else if (delta < 0) {
1156 int ofs = (-delta / 2);
1157 rbox.top -= ofs + 1;
1158 rbox.bottom = rbox.top + checkBoxHeight;
1159 }
1160 }
1161
1163 }
1164
1165 if (dtFlags == (UINT)-1L) /* Noting to draw */
1166 return;
1167
1168 if (action == ODA_DRAWENTIRE)
1169 BUTTON_DrawLabel(hwnd, hDC, dtFlags, &rtext);
1170
1171 /* ... and focus */
1172 if (action == ODA_FOCUS || (state & BST_FOCUS))
1173 {
1174#ifdef __REACTOS__
1175 if (!(get_ui_state(hwnd) & UISF_HIDEFOCUS))
1176 {
1177#endif
1178 rtext.left--;
1179 rtext.right++;
1180 IntersectRect(&rtext, &rtext, &client);
1181 DrawFocusRect( hDC, &rtext );
1182#ifdef __REACTOS__
1183 }
1184#endif
1185 }
1187 if (hrgn) DeleteObject( hrgn );
1188}
1189
1190
1191/**********************************************************************
1192 * BUTTON_CheckAutoRadioButton
1193 *
1194 * hwnd is checked, uncheck every other auto radio button in group
1195 */
1197{
1198 HWND parent, sibling, start;
1199
1201 /* make sure that starting control is not disabled or invisible */
1202 start = sibling = hwnd;
1203 do
1204 {
1205 if (!sibling) break;
1206#ifdef __REACTOS__
1208#else
1209 if (SendMessageW( sibling, WM_GETDLGCODE, 0, 0 ) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
1210#endif
1211 SendMessageW( sibling, BM_SETCHECK, sibling == hwnd ? BST_CHECKED : BST_UNCHECKED, 0 );
1212 sibling = GetNextDlgGroupItem( parent, sibling, FALSE );
1213 } while (sibling != start);
1214}
1215
1216
1217/**********************************************************************
1218 * Group Box Functions
1219 */
1220
1222{
1223 RECT rc, rcFrame;
1224 HBRUSH hbr;
1225 HFONT hFont;
1226 UINT dtFlags;
1229 HWND parent;
1230 HRGN hrgn;
1231
1233 /* GroupBox acts like static control, so it sends CTLCOLORSTATIC */
1235 if (!parent) parent = hwnd;
1236#ifdef __REACTOS__
1238#else
1240 if (!hbr) /* did the app forget to call defwindowproc ? */
1242 (WPARAM)hDC, (LPARAM)hwnd);
1243#endif
1244 GetClientRect( hwnd, &rc);
1245 rcFrame = rc;
1246 hrgn = set_control_clipping( hDC, &rc );
1247
1249 rcFrame.top += (tm.tmHeight / 2) - 1;
1250 DrawEdge (hDC, &rcFrame, EDGE_ETCHED, BF_RECT | ((style & BS_FLAT) ? BF_FLAT : 0));
1251
1252 InflateRect(&rc, -7, 1);
1253 dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &rc);
1254
1255 if (dtFlags != (UINT)-1L)
1256 {
1257 /* Because buttons have CS_PARENTDC class style, there is a chance
1258 * that label will be drawn out of client rect.
1259 * But Windows doesn't clip label's rect, so do I.
1260 */
1261
1262 /* There is 1-pixel margin at the left, right, and bottom */
1263 rc.left--; rc.right++; rc.bottom++;
1264 FillRect(hDC, &rc, hbr);
1265 rc.left++; rc.right--; rc.bottom--;
1266
1267 BUTTON_DrawLabel(hwnd, hDC, dtFlags, &rc);
1268 }
1270 if (hrgn) DeleteObject( hrgn );
1271}
1272
1273
1274/**********************************************************************
1275 * User Button Functions
1276 */
1277
1279{
1280 RECT rc;
1281 HBRUSH hBrush;
1282 HFONT hFont;
1284 HWND parent;
1285
1286 GetClientRect( hwnd, &rc);
1287
1289
1291 if (!parent) parent = hwnd;
1292#ifdef __REACTOS__
1294#else
1295 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd);
1296 if (!hBrush) /* did the app forget to call defwindowproc ? */
1297 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN,
1298 (WPARAM)hDC, (LPARAM)hwnd);
1299#endif
1300
1301 FillRect( hDC, &rc, hBrush );
1302 if (action == ODA_FOCUS || (state & BST_FOCUS))
1303#ifdef __REACTOS__
1304 {
1305 if (!(get_ui_state(hwnd) & UISF_HIDEFOCUS))
1306#endif
1307 DrawFocusRect( hDC, &rc );
1308#ifdef __REACTOS__
1309 }
1310#endif
1311
1312 switch (action)
1313 {
1314 case ODA_FOCUS:
1316 break;
1317
1318 case ODA_SELECT:
1320 break;
1321
1322 default:
1324 break;
1325 }
1326}
1327
1328
1329/**********************************************************************
1330 * Ownerdrawn Button Functions
1331 */
1332
1334{
1336 DRAWITEMSTRUCT dis;
1338 HWND parent;
1339 HFONT hFont, hPrevFont = 0;
1340 HRGN hrgn;
1341
1342 dis.CtlType = ODT_BUTTON;
1343 dis.CtlID = id;
1344 dis.itemID = 0;
1345 dis.itemAction = action;
1346 dis.itemState = ((state & BST_FOCUS) ? ODS_FOCUS : 0) |
1347 ((state & BST_PUSHED) ? ODS_SELECTED : 0) |
1349 dis.hwndItem = hwnd;
1350 dis.hDC = hDC;
1351 dis.itemData = 0;
1352 GetClientRect( hwnd, &dis.rcItem );
1353
1354 if ((hFont = get_button_font( hwnd ))) hPrevFont = SelectObject( hDC, hFont );
1356 if (!parent) parent = hwnd;
1357#ifdef __REACTOS__
1359#else
1361#endif
1362
1364
1366 if (hPrevFont) SelectObject(hDC, hPrevFont);
1368 if (hrgn) DeleteObject( hrgn );
1369}
static HDC hDC
Definition: 3dtext.c:33
static HRGN hrgn
static HBRUSH hbrush
Arabic default style
Definition: afstyles.h:94
static int state
Definition: maze.c:121
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
HFONT hFont
Definition: main.c:53
#define ERR(fmt,...)
Definition: precomp.h:57
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
LRESULT WINAPI ButtonWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI ButtonWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:242
#define BUTTON_NSTATES
Definition: button.c:77
static void BUTTON_DrawLabel(const BUTTON_INFO *infoPtr, HDC hdc, UINT dtFlags, const RECT *rc)
Definition: button.c:1425
static BOOL CALLBACK BUTTON_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy)
Definition: button.c:1410
static void GB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1780
#define BUTTON_NOTIFY_PARENT(hWnd, code)
Definition: button.c:85
static void CB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1616
static const pfPaint btnPaintFunc[MAX_BTN_TYPE]
Definition: button.c:157
static UINT BUTTON_CalcLabelRect(const BUTTON_INFO *infoPtr, HDC hdc, RECT *rc)
Definition: button.c:1278
static void paint_button(BUTTON_INFO *infoPtr, LONG style, UINT action)
Definition: button.c:221
static UINT BUTTON_BStoDT(DWORD style, DWORD ex_style)
Definition: button.c:273
#define BUTTON_BTNPRESSED
Definition: button.c:78
static UINT get_button_type(LONG window_style)
Definition: button.c:214
static void PB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1493
static WCHAR * get_button_text(const BUTTON_INFO *infoPtr)
Definition: button.c:233
static const WORD maxCheckState[MAX_BTN_TYPE]
Definition: button.c:125
static void UB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1832
#define MAX_BTN_TYPE
Definition: button.c:123
static void OB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1874
static void BUTTON_CheckAutoRadioButton(HWND hwnd)
Definition: button.c:1749
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
static void cleanup(void)
Definition: main.c:1335
const WCHAR * action
Definition: action.c:7509
const WCHAR * text
Definition: package.c:1794
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
r parent
Definition: btrfs.c:3010
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
pKey DeleteObject()
GLuint start
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
GLuint id
Definition: glext.h:5910
#define FNID_DESTROY
Definition: ntuser.h:898
#define FNID_BUTTON
Definition: ntuser.h:866
DWORD NTAPI NtUserAlterWindowStyle(HWND hWnd, DWORD Index, LONG NewValue)
Definition: window.c:4091
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4334
HDC hdc
Definition: main.c:9
static WPARAM
Definition: button.c:42
static HBITMAP
Definition: button.c:44
DWORD button
Definition: button.c:166
static HDC
Definition: imagelist.c:88
static HICON
Definition: imagelist.c:80
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
Definition: mk_font.cpp:20
unsigned int UINT
Definition: ndis.h:50
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define LOWORD(l)
Definition: pedump.c:82
#define BS_AUTORADIOBUTTON
Definition: pedump.c:660
#define BS_USERBUTTON
Definition: pedump.c:659
#define BS_LEFTTEXT
Definition: pedump.c:662
#define WS_TABSTOP
Definition: pedump.c:634
#define WS_VISIBLE
Definition: pedump.c:620
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
long LONG
Definition: pedump.c:60
#define BS_GROUPBOX
Definition: pedump.c:658
#define BS_OWNERDRAW
Definition: pedump.c:661
#define WS_DISABLED
Definition: pedump.c:621
#define BS_AUTO3STATE
Definition: pedump.c:657
#define BS_RADIOBUTTON
Definition: pedump.c:655
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
#define WM_PRINTCLIENT
Definition: richedit.h:70
static FILE * client
Definition: client.c:41
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
Definition: bl.h:1331
HBITMAP hbmColor
Definition: winuser.h:3130
HBITMAP hbmMask
Definition: winuser.h:3129
Definition: ntuser.h:694
DWORD fnid
Definition: ntuser.h:709
Definition: tftpd.h:60
ULONG_PTR itemData
Definition: winuser.h:3096
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
Definition: time.h:68
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
COLORREF WINAPI SetDCPenColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:941
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:154
#define STATE_GWL_OFFSET
Definition: button.c:71
static void set_button_state(HWND hwnd, LONG state)
Definition: button.c:163
static void set_button_font(HWND hwnd, HFONT font)
Definition: button.c:187
static const WCHAR buttonW[]
Definition: button.c:141
void(* pfButtonPaint)(HWND hwnd, HDC hdc, UINT action)
Definition: button.c:120
LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: button.c:243
#define BUTTON_HFONT_GWL_OFFSET
Definition: button.c:72
const struct builtin_class_descr BUTTON_builtin_class
Definition: button.c:142
static HFONT get_button_font(HWND hwnd)
Definition: button.c:182
static LONG get_button_state(HWND hwnd)
Definition: button.c:158
#define HIMAGE_GWL_OFFSET
Definition: button.c:73
#define BUTTON_UISTATE_GWL_OFFSET
Definition: button.c:74
#define NB_EXTRA_BYTES
Definition: button.c:75
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
DWORD COLORREF
Definition: windef.h:300
#define WINAPI
Definition: msvc.h:6
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
BOOL WINAPI GetCharWidthW(_In_ HDC hdc, _In_ UINT iFirst, _In_ UINT iLast, _Out_writes_(iLast+1 - iFirst) LPINT lpBuffer)
#define LOGPIXELSY
Definition: wingdi.h:719
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define TRANSPARENT
Definition: wingdi.h:950
#define OPAQUE
Definition: wingdi.h:949
#define LOGPIXELSX
Definition: wingdi.h:718
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define WM_PAINT
Definition: winuser.h:1623
#define ODS_DISABLED
Definition: winuser.h:2550
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define BST_INDETERMINATE
Definition: winuser.h:198
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_ERASEBKGND
Definition: winuser.h:1628
#define CS_VREDRAW
Definition: winuser.h:658
DWORD WINAPI GetSysColor(_In_ int)
#define BS_BITMAP
Definition: winuser.h:258
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1775
#define ODS_SELECTED
Definition: winuser.h:2548
#define BM_GETSTATE
Definition: winuser.h:1923
#define COLOR_BTNTEXT
Definition: winuser.h:936
#define IMAGE_BITMAP
Definition: winuser.h:211
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define WM_ENABLE
Definition: winuser.h:1618
#define WM_KEYUP
Definition: winuser.h:1719
#define COLOR_GRAYTEXT
Definition: winuser.h:935
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define COLOR_WINDOWFRAME
Definition: winuser.h:922
#define DT_CENTER
Definition: winuser.h:527
#define ODA_DRAWENTIRE
Definition: winuser.h:2545
#define BS_RIGHT
Definition: winuser.h:274
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DLGC_BUTTON
Definition: winuser.h:2623
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_UNCHECKED
Definition: winuser.h:199
#define BN_DOUBLECLICKED
Definition: winuser.h:1931
#define IMAGE_ICON
Definition: winuser.h:212
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
#define BN_SETFOCUS
Definition: winuser.h:1936
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2089
#define WM_CAPTURECHANGED
Definition: winuser.h:1811
#define DSS_DISABLED
Definition: winuser.h:519
#define WM_CREATE
Definition: winuser.h:1611
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_FLAT
Definition: winuser.h:510
#define BS_ICON
Definition: winuser.h:264
#define VK_SPACE
Definition: winuser.h:2222
#define BS_PUSHLIKE
Definition: winuser.h:272
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define BM_SETSTATE
Definition: winuser.h:1926
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1781
#define BS_TYPEMASK
Definition: winuser.h:270
#define DFCS_BUTTONCHECK
Definition: winuser.h:496
#define CS_HREDRAW
Definition: winuser.h:653
#define ODA_FOCUS
Definition: winuser.h:2547
#define DFCS_INACTIVE
Definition: winuser.h:502
#define DLGC_UNDEFPUSHBUTTON
Definition: winuser.h:2619
#define IDC_ARROW
Definition: winuser.h:687
#define WM_NCHITTEST
Definition: winuser.h:1689
#define DFC_BUTTON
Definition: winuser.h:476
#define BS_BOTTOM
Definition: winuser.h:259
#define BN_KILLFOCUS
Definition: winuser.h:1933
#define WM_SETFOCUS
Definition: winuser.h:1616
#define EDGE_ETCHED
Definition: winuser.h:452
#define BN_HILITE
Definition: winuser.h:1932
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define DT_NOCLIP
Definition: winuser.h:536
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define BS_NOTIFY
Definition: winuser.h:268
#define DST_ICON
Definition: winuser.h:515
#define CS_DBLCLKS
Definition: winuser.h:651
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1629
#define DLGC_DEFPUSHBUTTON
Definition: winuser.h:2618
#define WM_GETFONT
Definition: winuser.h:1654
#define BF_FLAT
Definition: winuser.h:471
#define WM_DRAWITEM
Definition: winuser.h:1648
#define BM_SETCHECK
Definition: winuser.h:1924
#define BS_MULTILINE
Definition: winuser.h:267
#define BM_SETIMAGE
Definition: winuser.h:1925
#define BN_UNHILITE
Definition: winuser.h:1937
#define WM_CTLCOLORBTN
Definition: winuser.h:1772
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define WM_SETTEXT
Definition: winuser.h:1620
#define DFCS_MONO
Definition: winuser.h:511
HWND WINAPI GetNextDlgGroupItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
#define DFCS_BUTTON3STATE
Definition: winuser.h:500
#define DT_LEFT
Definition: winuser.h:534
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DT_TOP
Definition: winuser.h:542
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define DLGC_RADIOBUTTON
Definition: winuser.h:2620
#define BS_FLAT
Definition: winuser.h:280
#define BS_LEFT
Definition: winuser.h:265
#define WM_SETFONT
Definition: winuser.h:1653
#define BM_CLICK
Definition: winuser.h:1920
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define DST_BITMAP
Definition: winuser.h:516
#define DT_WORDBREAK
Definition: winuser.h:544
#define BST_PUSHED
Definition: winuser.h:201
#define BM_GETIMAGE
Definition: winuser.h:1922
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define DFCS_BUTTONRADIO
Definition: winuser.h:499
#define BM_SETSTYLE
Definition: winuser.h:1927
#define BST_FOCUS
Definition: winuser.h:200
#define BS_VCENTER
Definition: winuser.h:279
HDC WINAPI GetDC(_In_opt_ HWND)
#define BS_TOP
Definition: winuser.h:277
#define DLGC_STATIC
Definition: winuser.h:2622
#define WM_LBUTTONUP
Definition: winuser.h:1780
#define BS_TEXT
Definition: winuser.h:276
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define DT_VCENTER
Definition: winuser.h:543
HWND WINAPI GetParent(_In_ HWND)
#define DT_BOTTOM
Definition: winuser.h:525
#define WM_NCDESTROY
Definition: winuser.h:1687
#define ODA_SELECT
Definition: winuser.h:2546
#define HTTRANSPARENT
Definition: winuser.h:2476
#define DSS_NORMAL
Definition: winuser.h:517
#define GWLP_ID
Definition: winuser.h:863
#define DSS_HIDEPREFIX
Definition: winuser.h:522
#define MK_LBUTTON
Definition: winuser.h:2370
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define BN_CLICKED
Definition: winuser.h:1928
#define WM_DESTROY
Definition: winuser.h:1612
#define DFCS_CHECKED
Definition: winuser.h:504
#define ODT_BUTTON
Definition: winuser.h:2543
#define WM_KEYDOWN
Definition: winuser.h:1718
#define DT_RIGHT
Definition: winuser.h:538
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define BS_CENTER
Definition: winuser.h:260
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define DT_CALCRECT
Definition: winuser.h:526
#define DT_HIDEPREFIX
Definition: winuser.h:547
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
INT WINAPI InternalGetWindowText(_In_ HWND hWnd, _Out_writes_to_(cchMaxCount, return+1) LPWSTR pString, _In_ int cchMaxCount)
#define SetWindowLongPtrW
Definition: winuser.h:5358
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define BF_RECT
Definition: winuser.h:462
BOOL WINAPI DrawStateW(_In_ HDC, _In_opt_ HBRUSH, _In_opt_ DRAWSTATEPROC, _In_ LPARAM, _In_ WPARAM, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define GWL_STYLE
Definition: winuser.h:855
#define BN_PAINT
Definition: winuser.h:1934
#define CS_PARENTDC
Definition: winuser.h:656
BOOL(CALLBACK * DRAWSTATEPROC)(HDC, LPARAM, WPARAM, int, int)
Definition: winuser.h:2910
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define DFCS_PUSHED
Definition: winuser.h:503
#define WM_KILLFOCUS
Definition: winuser.h:1617
#define ODS_FOCUS
Definition: winuser.h:2552
#define WM_GETDLGCODE
Definition: winuser.h:1692
#define DSS_MONO
Definition: winuser.h:521
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197
#define COLOR_BTNFACE
Definition: winuser.h:931
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define BM_GETCHECK
Definition: winuser.h:1921
#define WS_EX_RIGHT
Definition: winuser.h:400
#define GWL_EXSTYLE
Definition: winuser.h:854
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185