Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1 | /* File: button.c -- Button type widgets |
Alexandre Julliard | f41aeca | 1993-09-14 16:47:10 +0000 | [diff] [blame] | 2 | * |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 3 | * Copyright (C) 1993 Johannes Ruscheinski |
| 4 | * Copyright (C) 1993 David Metcalfe |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 5 | * Copyright (C) 1994 Alexandre Julliard |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 6 | */ |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 7 | |
Jeff Garzik | c3e1f72 | 1999-02-19 15:42:11 +0000 | [diff] [blame] | 8 | #include <string.h> |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 9 | #include <stdlib.h> /* for abs() */ |
Alexandre Julliard | f41aeca | 1993-09-14 16:47:10 +0000 | [diff] [blame] | 10 | #include "win.h" |
Patrik Stridvall | 6cc47d4 | 2000-03-08 18:26:56 +0000 | [diff] [blame] | 11 | #include "winbase.h" |
Jeremy White | d3e22d9 | 2000-02-10 19:03:02 +0000 | [diff] [blame] | 12 | #include "windef.h" |
| 13 | #include "wingdi.h" |
Michael Veksler | ca1bc86 | 1999-01-01 18:57:33 +0000 | [diff] [blame] | 14 | #include "wine/winuser16.h" |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 15 | #include "controls.h" |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 16 | #include "tweak.h" |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 17 | |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 18 | /* Note: under MS-Windows, state is a BYTE and this structure is |
| 19 | * only 3 bytes long. I don't think there are programs out there |
| 20 | * broken enough to rely on this :-) |
| 21 | */ |
| 22 | typedef struct |
| 23 | { |
| 24 | WORD state; /* Current state */ |
| 25 | HFONT16 hFont; /* Button font (or 0 for system font) */ |
| 26 | HANDLE hImage; /* Handle to the image or the icon */ |
| 27 | } BUTTONINFO; |
| 28 | |
| 29 | /* Button state values */ |
| 30 | #define BUTTON_UNCHECKED 0x00 |
| 31 | #define BUTTON_CHECKED 0x01 |
| 32 | #define BUTTON_3STATE 0x02 |
| 33 | #define BUTTON_HIGHLIGHTED 0x04 |
| 34 | #define BUTTON_HASFOCUS 0x08 |
| 35 | #define BUTTON_NSTATES 0x0F |
| 36 | /* undocumented flags */ |
| 37 | #define BUTTON_BTNPRESSED 0x40 |
| 38 | #define BUTTON_UNKNOWN2 0x20 |
| 39 | #define BUTTON_UNKNOWN3 0x10 |
| 40 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 41 | static void PB_Paint( WND *wndPtr, HDC hDC, WORD action ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 42 | static void CB_Paint( WND *wndPtr, HDC hDC, WORD action ); |
| 43 | static void GB_Paint( WND *wndPtr, HDC hDC, WORD action ); |
| 44 | static void UB_Paint( WND *wndPtr, HDC hDC, WORD action ); |
| 45 | static void OB_Paint( WND *wndPtr, HDC hDC, WORD action ); |
Alexandre Julliard | 8664b89 | 1996-04-05 14:58:24 +0000 | [diff] [blame] | 46 | static void BUTTON_CheckAutoRadioButton( WND *wndPtr ); |
Francis Beaudet | 9b4748b | 1999-07-18 15:29:43 +0000 | [diff] [blame] | 47 | static void BUTTON_DrawPushButton( WND *wndPtr, HDC hDC, WORD action, BOOL pushedState); |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 48 | static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); |
| 49 | static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 50 | |
Alexandre Julliard | e399fc3 | 1993-11-24 17:08:56 +0000 | [diff] [blame] | 51 | #define MAX_BTN_TYPE 12 |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 52 | |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 53 | static const WORD maxCheckState[MAX_BTN_TYPE] = |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 54 | { |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 55 | BUTTON_UNCHECKED, /* BS_PUSHBUTTON */ |
| 56 | BUTTON_UNCHECKED, /* BS_DEFPUSHBUTTON */ |
| 57 | BUTTON_CHECKED, /* BS_CHECKBOX */ |
| 58 | BUTTON_CHECKED, /* BS_AUTOCHECKBOX */ |
| 59 | BUTTON_CHECKED, /* BS_RADIOBUTTON */ |
| 60 | BUTTON_3STATE, /* BS_3STATE */ |
| 61 | BUTTON_3STATE, /* BS_AUTO3STATE */ |
| 62 | BUTTON_UNCHECKED, /* BS_GROUPBOX */ |
| 63 | BUTTON_UNCHECKED, /* BS_USERBUTTON */ |
| 64 | BUTTON_CHECKED, /* BS_AUTORADIOBUTTON */ |
| 65 | BUTTON_UNCHECKED, /* Not defined */ |
| 66 | BUTTON_UNCHECKED /* BS_OWNERDRAW */ |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 69 | typedef void (*pfPaint)( WND *wndPtr, HDC hdc, WORD action ); |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 70 | |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 71 | static const pfPaint btnPaintFunc[MAX_BTN_TYPE] = |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 72 | { |
| 73 | PB_Paint, /* BS_PUSHBUTTON */ |
| 74 | PB_Paint, /* BS_DEFPUSHBUTTON */ |
| 75 | CB_Paint, /* BS_CHECKBOX */ |
| 76 | CB_Paint, /* BS_AUTOCHECKBOX */ |
| 77 | CB_Paint, /* BS_RADIOBUTTON */ |
| 78 | CB_Paint, /* BS_3STATE */ |
| 79 | CB_Paint, /* BS_AUTO3STATE */ |
| 80 | GB_Paint, /* BS_GROUPBOX */ |
| 81 | UB_Paint, /* BS_USERBUTTON */ |
| 82 | CB_Paint, /* BS_AUTORADIOBUTTON */ |
| 83 | NULL, /* Not defined */ |
| 84 | OB_Paint /* BS_OWNERDRAW */ |
| 85 | }; |
| 86 | |
Alexandre Julliard | 8664b89 | 1996-04-05 14:58:24 +0000 | [diff] [blame] | 87 | #define PAINT_BUTTON(wndPtr,style,action) \ |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 88 | if (btnPaintFunc[style]) { \ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 89 | HDC hdc = GetDC( (wndPtr)->hwndSelf ); \ |
Alexandre Julliard | 8664b89 | 1996-04-05 14:58:24 +0000 | [diff] [blame] | 90 | (btnPaintFunc[style])(wndPtr,hdc,action); \ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 91 | ReleaseDC( (wndPtr)->hwndSelf, hdc ); } |
Alexandre Julliard | 8664b89 | 1996-04-05 14:58:24 +0000 | [diff] [blame] | 92 | |
Alexandre Julliard | 8664b89 | 1996-04-05 14:58:24 +0000 | [diff] [blame] | 93 | #define BUTTON_SEND_CTLCOLOR(wndPtr,hdc) \ |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 94 | SendMessageW( GetParent((wndPtr)->hwndSelf), WM_CTLCOLORBTN, \ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 95 | (hdc), (wndPtr)->hwndSelf ) |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 96 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 97 | static HBITMAP hbitmapCheckBoxes = 0; |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 98 | static WORD checkBoxWidth = 0, checkBoxHeight = 0; |
| 99 | |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 100 | |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 101 | /********************************************************************* |
| 102 | * button class descriptor |
| 103 | */ |
| 104 | const struct builtin_class_descr BUTTON_builtin_class = |
| 105 | { |
| 106 | "Button", /* name */ |
| 107 | CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */ |
| 108 | ButtonWndProcA, /* procA */ |
| 109 | ButtonWndProcW, /* procW */ |
| 110 | sizeof(BUTTONINFO), /* extra */ |
| 111 | IDC_ARROWA, /* cursor */ |
| 112 | 0 /* brush */ |
| 113 | }; |
| 114 | |
| 115 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 116 | /*********************************************************************** |
Marcus Meissner | 9aded51 | 1999-05-01 10:23:45 +0000 | [diff] [blame] | 117 | * ButtonWndProc_locked |
| 118 | * |
| 119 | * Called with window lock held. |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 120 | */ |
Marcus Meissner | 9aded51 | 1999-05-01 10:23:45 +0000 | [diff] [blame] | 121 | static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg, |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 122 | WPARAM wParam, LPARAM lParam, BOOL unicode ) |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 123 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 124 | RECT rect; |
Marcus Meissner | 9aded51 | 1999-05-01 10:23:45 +0000 | [diff] [blame] | 125 | HWND hWnd = wndPtr->hwndSelf; |
Patrik Stridvall | 0f8bc5b | 1999-04-22 16:27:50 +0000 | [diff] [blame] | 126 | POINT pt; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 127 | BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; |
| 128 | LONG style = wndPtr->dwStyle & 0x0f; |
Pascal Lessard | 026f705 | 1999-04-15 15:49:36 +0000 | [diff] [blame] | 129 | HANDLE oldHbitmap; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 130 | |
Patrik Stridvall | 0f8bc5b | 1999-04-22 16:27:50 +0000 | [diff] [blame] | 131 | pt.x = LOWORD(lParam); |
| 132 | pt.y = HIWORD(lParam); |
| 133 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 134 | switch (uMsg) |
| 135 | { |
| 136 | case WM_GETDLGCODE: |
| 137 | switch(style) |
| 138 | { |
| 139 | case BS_PUSHBUTTON: return DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON; |
| 140 | case BS_DEFPUSHBUTTON: return DLGC_BUTTON | DLGC_DEFPUSHBUTTON; |
| 141 | case BS_RADIOBUTTON: |
| 142 | case BS_AUTORADIOBUTTON: return DLGC_BUTTON | DLGC_RADIOBUTTON; |
| 143 | default: return DLGC_BUTTON; |
| 144 | } |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 145 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 146 | case WM_ENABLE: |
| 147 | PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE ); |
| 148 | break; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 149 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 150 | case WM_CREATE: |
| 151 | if (!hbitmapCheckBoxes) |
| 152 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 153 | BITMAP bmp; |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 154 | hbitmapCheckBoxes = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_CHECKBOXES)); |
| 155 | GetObjectW( hbitmapCheckBoxes, sizeof(bmp), &bmp ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 156 | checkBoxWidth = bmp.bmWidth / 4; |
| 157 | checkBoxHeight = bmp.bmHeight / 3; |
| 158 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 159 | if (style < 0L || style >= MAX_BTN_TYPE) |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 160 | return -1; /* abort */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 161 | infoPtr->state = BUTTON_UNCHECKED; |
| 162 | infoPtr->hFont = 0; |
Dmitry Timoshkov | f92a777 | 1999-12-05 23:51:15 +0000 | [diff] [blame] | 163 | infoPtr->hImage = 0; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 164 | return 0; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 165 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 166 | case WM_ERASEBKGND: |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 167 | return 1; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 168 | |
| 169 | case WM_PAINT: |
| 170 | if (btnPaintFunc[style]) |
| 171 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 172 | PAINTSTRUCT ps; |
| 173 | HDC hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps ); |
Sheri Steeves | 13ffd58 | 2000-06-11 20:08:46 +0000 | [diff] [blame] | 174 | int nOldMode = SetBkMode( hdc, OPAQUE ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 175 | (btnPaintFunc[style])( wndPtr, hdc, ODA_DRAWENTIRE ); |
Sheri Steeves | 13ffd58 | 2000-06-11 20:08:46 +0000 | [diff] [blame] | 176 | SetBkMode(hdc, nOldMode); /* reset painting mode */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 177 | if( !wParam ) EndPaint( hWnd, &ps ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 178 | } |
| 179 | break; |
| 180 | |
Dmitry Timoshkov | f92a777 | 1999-12-05 23:51:15 +0000 | [diff] [blame] | 181 | case WM_KEYDOWN: |
| 182 | if (wParam == VK_SPACE) |
| 183 | { |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 184 | SendMessageW( hWnd, BM_SETSTATE, TRUE, 0 ); |
Dmitry Timoshkov | f92a777 | 1999-12-05 23:51:15 +0000 | [diff] [blame] | 185 | infoPtr->state |= BUTTON_BTNPRESSED; |
| 186 | } |
| 187 | break; |
| 188 | |
Eric Kohl | 65ab1b0 | 1998-11-22 17:53:27 +0000 | [diff] [blame] | 189 | case WM_LBUTTONDBLCLK: |
Rein Klazes | 61b15de | 1999-09-27 11:38:47 +0000 | [diff] [blame] | 190 | if(wndPtr->dwStyle & BS_NOTIFY || |
| 191 | style==BS_RADIOBUTTON || |
| 192 | style==BS_USERBUTTON || |
| 193 | style==BS_OWNERDRAW) { |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 194 | SendMessageW( GetParent(hWnd), WM_COMMAND, |
Rein Klazes | 61b15de | 1999-09-27 11:38:47 +0000 | [diff] [blame] | 195 | MAKEWPARAM( wndPtr->wIDmenu, BN_DOUBLECLICKED ), hWnd); |
| 196 | break; |
| 197 | } |
| 198 | /* fall through */ |
Rein Klazes | dbb4ad8 | 1999-07-31 11:10:52 +0000 | [diff] [blame] | 199 | case WM_LBUTTONDOWN: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 200 | SetCapture( hWnd ); |
Luc Tourangeau | 70cd8cb | 1999-07-10 11:57:29 +0000 | [diff] [blame] | 201 | SetFocus( hWnd ); |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 202 | SendMessageW( hWnd, BM_SETSTATE, TRUE, 0 ); |
Rein Klazes | 61b15de | 1999-09-27 11:38:47 +0000 | [diff] [blame] | 203 | infoPtr->state |= BUTTON_BTNPRESSED; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 204 | break; |
| 205 | |
Dmitry Timoshkov | f92a777 | 1999-12-05 23:51:15 +0000 | [diff] [blame] | 206 | case WM_KEYUP: |
| 207 | if (wParam != VK_SPACE) |
| 208 | break; |
| 209 | /* fall through */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 210 | case WM_LBUTTONUP: |
Rein Klazes | 61b15de | 1999-09-27 11:38:47 +0000 | [diff] [blame] | 211 | if (!(infoPtr->state & BUTTON_BTNPRESSED)) break; |
| 212 | infoPtr->state &= BUTTON_NSTATES; |
| 213 | if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) { |
| 214 | ReleaseCapture(); |
| 215 | break; |
| 216 | } |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 217 | SendMessageW( hWnd, BM_SETSTATE, FALSE, 0 ); |
Rein Klazes | 61b15de | 1999-09-27 11:38:47 +0000 | [diff] [blame] | 218 | ReleaseCapture(); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 219 | GetClientRect( hWnd, &rect ); |
Dmitry Timoshkov | f92a777 | 1999-12-05 23:51:15 +0000 | [diff] [blame] | 220 | if (uMsg == WM_KEYUP || PtInRect( &rect, pt )) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 221 | { |
| 222 | switch(style) |
| 223 | { |
| 224 | case BS_AUTOCHECKBOX: |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 225 | SendMessageW( hWnd, BM_SETCHECK, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 226 | !(infoPtr->state & BUTTON_CHECKED), 0 ); |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 227 | break; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 228 | case BS_AUTORADIOBUTTON: |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 229 | SendMessageW( hWnd, BM_SETCHECK, TRUE, 0 ); |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 230 | break; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 231 | case BS_AUTO3STATE: |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 232 | SendMessageW( hWnd, BM_SETCHECK, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 233 | (infoPtr->state & BUTTON_3STATE) ? 0 : |
| 234 | ((infoPtr->state & 3) + 1), 0 ); |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 235 | break; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 236 | } |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 237 | SendMessageW( GetParent(hWnd), WM_COMMAND, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 238 | MAKEWPARAM( wndPtr->wIDmenu, BN_CLICKED ), hWnd); |
| 239 | } |
| 240 | break; |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 241 | |
Rein Klazes | 61b15de | 1999-09-27 11:38:47 +0000 | [diff] [blame] | 242 | case WM_CAPTURECHANGED: |
| 243 | if (infoPtr->state & BUTTON_BTNPRESSED) { |
| 244 | infoPtr->state &= BUTTON_NSTATES; |
| 245 | if (infoPtr->state & BUTTON_HIGHLIGHTED) |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 246 | SendMessageW( hWnd, BM_SETSTATE, FALSE, 0 ); |
Rein Klazes | 61b15de | 1999-09-27 11:38:47 +0000 | [diff] [blame] | 247 | } |
| 248 | break; |
| 249 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 250 | case WM_MOUSEMOVE: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 251 | if (GetCapture() == hWnd) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 252 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 253 | GetClientRect( hWnd, &rect ); |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 254 | SendMessageW( hWnd, BM_SETSTATE, PtInRect(&rect, pt), 0 ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 255 | } |
| 256 | break; |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 257 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 258 | case WM_SETTEXT: |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 259 | if (unicode) DEFWND_SetTextW( wndPtr, (LPCWSTR)lParam ); |
| 260 | else DEFWND_SetTextA( wndPtr, (LPCSTR)lParam ); |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 261 | if( wndPtr->dwStyle & WS_VISIBLE ) |
| 262 | PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE ); |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 263 | return 1; /* success. FIXME: check text length */ |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 264 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 265 | case WM_SETFONT: |
Alexandre Julliard | bf9130a | 1996-10-13 17:45:47 +0000 | [diff] [blame] | 266 | infoPtr->hFont = (HFONT16)wParam; |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 267 | if (lParam && (wndPtr->dwStyle & WS_VISIBLE)) |
| 268 | PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 269 | break; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 270 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 271 | case WM_GETFONT: |
Marcus Meissner | 9aded51 | 1999-05-01 10:23:45 +0000 | [diff] [blame] | 272 | return infoPtr->hFont; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 273 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 274 | case WM_SETFOCUS: |
Susan Farley | b64aa24 | 2000-05-12 21:51:09 +0000 | [diff] [blame] | 275 | if ((style == BS_RADIOBUTTON || style == BS_AUTORADIOBUTTON) && (GetCapture() != hWnd) && |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 276 | !(SendMessageW(hWnd, BM_GETCHECK, 0, 0) & BST_CHECKED)) |
Luc Tourangeau | 70cd8cb | 1999-07-10 11:57:29 +0000 | [diff] [blame] | 277 | { |
| 278 | /* The notification is sent when the button (BS_AUTORADIOBUTTON) |
Andreas Mohr | 20cd935 | 2000-09-12 23:40:40 +0000 | [diff] [blame] | 279 | is unchecked and the focus was not given by a mouse click. */ |
Susan Farley | b64aa24 | 2000-05-12 21:51:09 +0000 | [diff] [blame] | 280 | if (style == BS_AUTORADIOBUTTON) |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 281 | SendMessageW( hWnd, BM_SETCHECK, BUTTON_CHECKED, 0 ); |
| 282 | SendMessageW( GetParent(hWnd), WM_COMMAND, |
Luc Tourangeau | 70cd8cb | 1999-07-10 11:57:29 +0000 | [diff] [blame] | 283 | MAKEWPARAM( wndPtr->wIDmenu, BN_CLICKED ), hWnd); |
| 284 | } |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 285 | infoPtr->state |= BUTTON_HASFOCUS; |
| 286 | PAINT_BUTTON( wndPtr, style, ODA_FOCUS ); |
| 287 | break; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 288 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 289 | case WM_KILLFOCUS: |
| 290 | infoPtr->state &= ~BUTTON_HASFOCUS; |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 291 | PAINT_BUTTON( wndPtr, style, ODA_FOCUS ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 292 | InvalidateRect( hWnd, NULL, TRUE ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 293 | break; |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 294 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 295 | case WM_SYSCOLORCHANGE: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 296 | InvalidateRect( hWnd, NULL, FALSE ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 297 | break; |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 298 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 299 | case BM_SETSTYLE16: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 300 | case BM_SETSTYLE: |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 301 | if ((wParam & 0x0f) >= MAX_BTN_TYPE) break; |
| 302 | wndPtr->dwStyle = (wndPtr->dwStyle & 0xfffffff0) |
| 303 | | (wParam & 0x0000000f); |
| 304 | style = wndPtr->dwStyle & 0x0000000f; |
Sheri Steeves | 13ffd58 | 2000-06-11 20:08:46 +0000 | [diff] [blame] | 305 | |
| 306 | /* Only redraw if lParam flag is set.*/ |
| 307 | if (lParam) |
| 308 | PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE ); |
| 309 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 310 | break; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 311 | |
Dmitry Timoshkov | 6fb62f5 | 2000-01-29 22:09:40 +0000 | [diff] [blame] | 312 | case BM_CLICK: |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 313 | SendMessageW( hWnd, WM_LBUTTONDOWN, 0, 0 ); |
| 314 | SendMessageW( hWnd, WM_LBUTTONUP, 0, 0 ); |
Dmitry Timoshkov | 6fb62f5 | 2000-01-29 22:09:40 +0000 | [diff] [blame] | 315 | break; |
| 316 | |
Pascal Lessard | 026f705 | 1999-04-15 15:49:36 +0000 | [diff] [blame] | 317 | case BM_SETIMAGE: |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 318 | /* Check that image format confirm button style */ |
| 319 | if ((wndPtr->dwStyle & (BS_BITMAP|BS_ICON)) == BS_BITMAP) |
Bill Jin | 4f155e8 | 2000-02-26 18:29:15 +0000 | [diff] [blame] | 320 | { |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 321 | if (wParam != (WPARAM) IMAGE_BITMAP) |
| 322 | return (HICON)0; |
Bill Jin | 4f155e8 | 2000-02-26 18:29:15 +0000 | [diff] [blame] | 323 | } |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 324 | else if ((wndPtr->dwStyle & (BS_BITMAP|BS_ICON)) == BS_ICON) |
| 325 | { |
| 326 | if (wParam != (WPARAM) IMAGE_ICON) |
| 327 | return (HICON)0; |
| 328 | } else |
| 329 | return (HICON)0; |
| 330 | |
| 331 | oldHbitmap = infoPtr->hImage; |
| 332 | infoPtr->hImage = (HANDLE) lParam; |
| 333 | InvalidateRect( hWnd, NULL, FALSE ); |
Pascal Lessard | 026f705 | 1999-04-15 15:49:36 +0000 | [diff] [blame] | 334 | return oldHbitmap; |
| 335 | |
| 336 | case BM_GETIMAGE: |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 337 | if ((wndPtr->dwStyle & (BS_BITMAP|BS_ICON)) == BS_BITMAP) |
| 338 | { |
| 339 | if (wParam != (WPARAM) IMAGE_BITMAP) |
| 340 | return (HICON)0; |
| 341 | } |
| 342 | else if ((wndPtr->dwStyle & (BS_BITMAP|BS_ICON)) == BS_ICON) |
| 343 | { |
| 344 | if (wParam != (WPARAM) IMAGE_ICON) |
| 345 | return (HICON)0; |
| 346 | } else |
Dmitry Timoshkov | f92a777 | 1999-12-05 23:51:15 +0000 | [diff] [blame] | 347 | return (HICON)0; |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 348 | return infoPtr->hImage; |
Pascal Lessard | 026f705 | 1999-04-15 15:49:36 +0000 | [diff] [blame] | 349 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 350 | case BM_GETCHECK16: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 351 | case BM_GETCHECK: |
Marcus Meissner | 9aded51 | 1999-05-01 10:23:45 +0000 | [diff] [blame] | 352 | return infoPtr->state & 3; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 353 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 354 | case BM_SETCHECK16: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 355 | case BM_SETCHECK: |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 356 | if (wParam > maxCheckState[style]) wParam = maxCheckState[style]; |
| 357 | if ((infoPtr->state & 3) != wParam) |
| 358 | { |
Norman Stevens | a83d065 | 1998-10-12 07:25:35 +0000 | [diff] [blame] | 359 | if ((style == BS_RADIOBUTTON) || (style == BS_AUTORADIOBUTTON)) |
| 360 | { |
| 361 | if (wParam) |
| 362 | wndPtr->dwStyle |= WS_TABSTOP; |
| 363 | else |
| 364 | wndPtr->dwStyle &= ~WS_TABSTOP; |
| 365 | } |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 366 | infoPtr->state = (infoPtr->state & ~3) | wParam; |
| 367 | PAINT_BUTTON( wndPtr, style, ODA_SELECT ); |
| 368 | } |
| 369 | if ((style == BS_AUTORADIOBUTTON) && (wParam == BUTTON_CHECKED)) |
| 370 | BUTTON_CheckAutoRadioButton( wndPtr ); |
| 371 | break; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 372 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 373 | case BM_GETSTATE16: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 374 | case BM_GETSTATE: |
Marcus Meissner | 9aded51 | 1999-05-01 10:23:45 +0000 | [diff] [blame] | 375 | return infoPtr->state; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 376 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 377 | case BM_SETSTATE16: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 378 | case BM_SETSTATE: |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 379 | if (wParam) |
| 380 | { |
| 381 | if (infoPtr->state & BUTTON_HIGHLIGHTED) break; |
| 382 | infoPtr->state |= BUTTON_HIGHLIGHTED; |
| 383 | } |
| 384 | else |
| 385 | { |
| 386 | if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break; |
| 387 | infoPtr->state &= ~BUTTON_HIGHLIGHTED; |
| 388 | } |
| 389 | PAINT_BUTTON( wndPtr, style, ODA_SELECT ); |
| 390 | break; |
| 391 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 392 | case WM_NCHITTEST: |
| 393 | if(style == BS_GROUPBOX) return HTTRANSPARENT; |
| 394 | /* fall through */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 395 | default: |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 396 | return unicode ? DefWindowProcW(hWnd, uMsg, wParam, lParam) : |
| 397 | DefWindowProcA(hWnd, uMsg, wParam, lParam); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 398 | } |
| 399 | return 0; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 400 | } |
| 401 | |
Marcus Meissner | 9aded51 | 1999-05-01 10:23:45 +0000 | [diff] [blame] | 402 | /*********************************************************************** |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 403 | * ButtonWndProcW |
Marcus Meissner | 9aded51 | 1999-05-01 10:23:45 +0000 | [diff] [blame] | 404 | * The button window procedure. This is just a wrapper which locks |
| 405 | * the passed HWND and calls the real window procedure (with a WND* |
| 406 | * pointer pointing to the locked windowstructure). |
| 407 | */ |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 408 | static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) |
Marcus Meissner | 9aded51 | 1999-05-01 10:23:45 +0000 | [diff] [blame] | 409 | { |
| 410 | LRESULT res; |
| 411 | WND *wndPtr = WIN_FindWndPtr(hWnd); |
| 412 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 413 | res = ButtonWndProc_locked(wndPtr,uMsg,wParam,lParam,TRUE); |
Marcus Meissner | 9aded51 | 1999-05-01 10:23:45 +0000 | [diff] [blame] | 414 | |
| 415 | WIN_ReleaseWndPtr(wndPtr); |
| 416 | return res; |
| 417 | } |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 418 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 419 | |
| 420 | /*********************************************************************** |
| 421 | * ButtonWndProcA |
| 422 | */ |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 423 | static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 424 | { |
| 425 | LRESULT res; |
| 426 | WND *wndPtr = WIN_FindWndPtr(hWnd); |
| 427 | |
| 428 | res = ButtonWndProc_locked(wndPtr,uMsg,wParam,lParam,FALSE); |
| 429 | |
| 430 | WIN_ReleaseWndPtr(wndPtr); |
| 431 | return res; |
| 432 | } |
| 433 | |
| 434 | |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 435 | /********************************************************************** |
| 436 | * Push Button Functions |
| 437 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 438 | static void PB_Paint( WND *wndPtr, HDC hDC, WORD action ) |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 439 | { |
Francis Beaudet | 9b4748b | 1999-07-18 15:29:43 +0000 | [diff] [blame] | 440 | BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; |
| 441 | BOOL bHighLighted = (infoPtr->state & BUTTON_HIGHLIGHTED); |
| 442 | |
| 443 | /* |
| 444 | * Delegate this to the more generic pushbutton painting |
| 445 | * method. |
| 446 | */ |
Patrik Stridvall | 0e38aa7 | 1999-07-31 17:34:43 +0000 | [diff] [blame] | 447 | BUTTON_DrawPushButton(wndPtr, |
| 448 | hDC, |
| 449 | action, |
| 450 | bHighLighted); |
Francis Beaudet | 9b4748b | 1999-07-18 15:29:43 +0000 | [diff] [blame] | 451 | } |
| 452 | |
| 453 | /********************************************************************** |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 454 | * Convert button styles to flags used by DrawText. |
| 455 | * TODO: handle WS_EX_RIGHT extended style. |
| 456 | */ |
| 457 | static UINT BUTTON_BStoDT(DWORD style) |
| 458 | { |
| 459 | UINT dtStyle = DT_NOCLIP; /* We use SelectClipRgn to limit output */ |
| 460 | |
| 461 | /* "Convert" pushlike buttons to pushbuttons */ |
| 462 | if (style & BS_PUSHLIKE) |
| 463 | style &= ~0x0F; |
| 464 | |
| 465 | if (!(style & BS_MULTILINE)) |
| 466 | dtStyle |= DT_SINGLELINE; |
| 467 | else |
| 468 | dtStyle |= DT_WORDBREAK; |
| 469 | |
| 470 | switch (style & BS_CENTER) |
| 471 | { |
| 472 | case BS_LEFT: /* DT_LEFT is 0 */ break; |
| 473 | case BS_RIGHT: dtStyle |= DT_RIGHT; break; |
| 474 | case BS_CENTER: dtStyle |= DT_CENTER; break; |
| 475 | default: |
| 476 | /* Pushbutton's text is centered by default */ |
| 477 | if ((style & 0x0F) <= BS_DEFPUSHBUTTON) |
| 478 | dtStyle |= DT_CENTER; |
| 479 | /* all other flavours have left aligned text */ |
| 480 | } |
| 481 | |
| 482 | /* DrawText ignores vertical alignment for multiline text, |
| 483 | * but we use these flags to align label manualy. |
| 484 | */ |
| 485 | if ((style & 0x0F) != BS_GROUPBOX) |
| 486 | { |
| 487 | switch (style & BS_VCENTER) |
| 488 | { |
| 489 | case BS_TOP: /* DT_TOP is 0 */ break; |
| 490 | case BS_BOTTOM: dtStyle |= DT_BOTTOM; break; |
| 491 | case BS_VCENTER: /* fall through */ |
| 492 | default: dtStyle |= DT_VCENTER; break; |
| 493 | } |
| 494 | } |
| 495 | else |
| 496 | /* GroupBox's text is always single line and is top aligned. */ |
| 497 | dtStyle |= DT_SINGLELINE; |
| 498 | |
| 499 | return dtStyle; |
| 500 | } |
| 501 | |
| 502 | /********************************************************************** |
| 503 | * BUTTON_CalcLabelRect |
| 504 | * |
| 505 | * Calculates label's rectangle depending on button style. |
| 506 | * |
| 507 | * Returns flags to be passed to DrawText. |
| 508 | * Calculated rectangle doesn't take into account button state |
| 509 | * (pushed, etc.). If there is nothing to draw (no text/image) output |
| 510 | * rectangle is empty, and return value is (UINT)-1. |
| 511 | */ |
| 512 | static UINT BUTTON_CalcLabelRect(WND *wndPtr, HDC hdc, RECT *rc) |
| 513 | { |
| 514 | BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; |
| 515 | ICONINFO iconInfo; |
| 516 | BITMAP bm; |
| 517 | UINT dtStyle = BUTTON_BStoDT(wndPtr->dwStyle); |
| 518 | RECT r = *rc; |
| 519 | INT n; |
| 520 | |
| 521 | /* Calculate label rectangle according to label type */ |
| 522 | switch (wndPtr->dwStyle & (BS_ICON|BS_BITMAP)) |
| 523 | { |
| 524 | case BS_TEXT: |
| 525 | if (wndPtr->text && wndPtr->text[0]) |
| 526 | DrawTextW(hdc, wndPtr->text, -1, &r, dtStyle | DT_CALCRECT); |
| 527 | else |
| 528 | goto empty_rect; |
| 529 | break; |
| 530 | |
| 531 | case BS_ICON: |
| 532 | if (!GetIconInfo((HICON)infoPtr->hImage, &iconInfo)) |
| 533 | goto empty_rect; |
| 534 | |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 535 | GetObjectW (iconInfo.hbmColor, sizeof(BITMAP), &bm); |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 536 | |
| 537 | r.right = r.left + bm.bmWidth; |
| 538 | r.bottom = r.top + bm.bmHeight; |
| 539 | |
| 540 | DeleteObject(iconInfo.hbmColor); |
| 541 | DeleteObject(iconInfo.hbmMask); |
| 542 | break; |
| 543 | |
| 544 | case BS_BITMAP: |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 545 | if (!GetObjectW (infoPtr->hImage, sizeof(BITMAP), &bm)) |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 546 | goto empty_rect; |
| 547 | |
| 548 | r.right = r.left + bm.bmWidth; |
| 549 | r.bottom = r.top + bm.bmHeight; |
| 550 | break; |
| 551 | |
| 552 | default: |
| 553 | empty_rect: |
| 554 | r.right = r.left; |
| 555 | r.bottom = r.top; |
| 556 | return (UINT)(LONG)-1; |
| 557 | } |
| 558 | |
| 559 | /* Position label inside bounding rectangle according to |
| 560 | * alignment flags. (calculated rect is always left-top aligned). |
| 561 | * If label is aligned to any side - shift label in opposite |
| 562 | * direction to leave extra space for focus rectangle. |
| 563 | */ |
| 564 | switch (dtStyle & (DT_CENTER|DT_RIGHT)) |
| 565 | { |
| 566 | case DT_LEFT: r.left++; r.right++; break; |
| 567 | case DT_CENTER: n = r.right - r.left; |
| 568 | r.left = rc->left + ((rc->right - rc->left) - n) / 2; |
| 569 | r.right = r.left + n; break; |
| 570 | case DT_RIGHT: n = r.right - r.left; |
| 571 | r.right = rc->right - 1; |
| 572 | r.left = r.right - n; |
| 573 | break; |
| 574 | } |
| 575 | |
| 576 | switch (dtStyle & (DT_VCENTER|DT_BOTTOM)) |
| 577 | { |
| 578 | case DT_TOP: r.top++; r.bottom++; break; |
| 579 | case DT_VCENTER: n = r.bottom - r.top; |
| 580 | r.top = rc->top + ((rc->bottom - rc->top) - n) / 2; |
| 581 | r.bottom = r.top + n; break; |
| 582 | case DT_BOTTOM: n = r.bottom - r.top; |
| 583 | r.bottom = rc->bottom - 1; |
| 584 | r.top = r.bottom - n; |
| 585 | break; |
| 586 | } |
| 587 | |
| 588 | *rc = r; |
| 589 | return dtStyle; |
| 590 | } |
| 591 | |
| 592 | |
| 593 | /********************************************************************** |
| 594 | * BUTTON_DrawTextCallback |
| 595 | * |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 596 | * Callback function used by DrawStateW function. |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 597 | */ |
| 598 | static BOOL CALLBACK BUTTON_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy) |
| 599 | { |
Joerg Mayer | abe635c | 2000-11-11 00:38:37 +0000 | [diff] [blame] | 600 | RECT rc; |
| 601 | rc.left = 0; |
| 602 | rc.top = 0; |
| 603 | rc.right = cx; |
| 604 | rc.bottom = cy; |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 605 | |
| 606 | DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp); |
| 607 | return TRUE; |
| 608 | } |
| 609 | |
| 610 | |
| 611 | /********************************************************************** |
| 612 | * BUTTON_DrawLabel |
| 613 | * |
| 614 | * Common function for drawing button label. |
| 615 | */ |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 616 | static void BUTTON_DrawLabel(WND *wndPtr, HDC hdc, UINT dtFlags, RECT *rc) |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 617 | { |
| 618 | BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; |
| 619 | DRAWSTATEPROC lpOutputProc = NULL; |
| 620 | LPARAM lp; |
| 621 | WPARAM wp = 0; |
| 622 | HBRUSH hbr = 0; |
| 623 | UINT flags = IsWindowEnabled(wndPtr->hwndSelf) ? DSS_NORMAL : DSS_DISABLED; |
| 624 | |
| 625 | /* Fixme: To draw disabled label in Win31 look-and-feel, we probably |
| 626 | * must use DSS_MONO flag and COLOR_GRAYTEXT brush (or maybe DSS_UNION). |
| 627 | * I don't have Win31 on hand to verify that, so I leave it as is. |
| 628 | */ |
| 629 | |
| 630 | if ((wndPtr->dwStyle & BS_PUSHLIKE) && (infoPtr->state & BUTTON_3STATE)) |
| 631 | { |
| 632 | hbr = GetSysColorBrush(COLOR_GRAYTEXT); |
| 633 | flags |= DSS_MONO; |
| 634 | } |
| 635 | |
| 636 | switch (wndPtr->dwStyle & (BS_ICON|BS_BITMAP)) |
| 637 | { |
| 638 | case BS_TEXT: |
| 639 | /* DST_COMPLEX -- is 0 */ |
| 640 | lpOutputProc = BUTTON_DrawTextCallback; |
| 641 | lp = (LPARAM)wndPtr->text; |
| 642 | wp = (WPARAM)dtFlags; |
| 643 | break; |
| 644 | |
| 645 | case BS_ICON: |
| 646 | flags |= DST_ICON; |
| 647 | lp = (LPARAM)infoPtr->hImage; |
| 648 | break; |
| 649 | |
| 650 | case BS_BITMAP: |
| 651 | flags |= DST_BITMAP; |
| 652 | lp = (LPARAM)infoPtr->hImage; |
| 653 | break; |
| 654 | |
| 655 | default: |
| 656 | return; |
| 657 | } |
| 658 | |
| 659 | DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top, |
| 660 | rc->right - rc->left, rc->bottom - rc->top, flags); |
| 661 | } |
| 662 | |
| 663 | /********************************************************************** |
Francis Beaudet | 9b4748b | 1999-07-18 15:29:43 +0000 | [diff] [blame] | 664 | * This method will actually do the drawing of the pushbutton |
| 665 | * depending on it's state and the pushedState parameter. |
| 666 | */ |
| 667 | static void BUTTON_DrawPushButton( |
| 668 | WND* wndPtr, |
| 669 | HDC hDC, |
| 670 | WORD action, |
| 671 | BOOL pushedState ) |
| 672 | { |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 673 | BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 674 | RECT rc, focus_rect, r; |
| 675 | UINT dtFlags; |
| 676 | HRGN hRgn; |
| 677 | HPEN hOldPen; |
| 678 | HBRUSH hOldBrush; |
| 679 | INT oldBkMode; |
| 680 | COLORREF oldTxtColor; |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 681 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 682 | GetClientRect( wndPtr->hwndSelf, &rc ); |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 683 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 684 | /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 685 | if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); |
Alexandre Julliard | 8664b89 | 1996-04-05 14:58:24 +0000 | [diff] [blame] | 686 | BUTTON_SEND_CTLCOLOR( wndPtr, hDC ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 687 | hOldPen = (HPEN)SelectObject(hDC, GetSysColorPen(COLOR_WINDOWFRAME)); |
| 688 | hOldBrush =(HBRUSH)SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE)); |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 689 | oldBkMode = SetBkMode(hDC, TRANSPARENT); |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 690 | |
| 691 | if ( TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 692 | { |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 693 | COLORREF clr_wnd = GetSysColor(COLOR_WINDOW); |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 694 | Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); |
| 695 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 696 | SetPixel( hDC, rc.left, rc.top, clr_wnd); |
| 697 | SetPixel( hDC, rc.left, rc.bottom-1, clr_wnd); |
| 698 | SetPixel( hDC, rc.right-1, rc.top, clr_wnd); |
| 699 | SetPixel( hDC, rc.right-1, rc.bottom-1, clr_wnd); |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 700 | InflateRect( &rc, -1, -1 ); |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 701 | } |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 702 | |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 703 | if ((wndPtr->dwStyle & 0x000f) == BS_DEFPUSHBUTTON) |
| 704 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 705 | Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 706 | InflateRect( &rc, -1, -1 ); |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 707 | } |
| 708 | |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 709 | if (TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 710 | { |
Francis Beaudet | 9b4748b | 1999-07-18 15:29:43 +0000 | [diff] [blame] | 711 | if (pushedState) |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 712 | { |
| 713 | /* draw button shadow: */ |
| 714 | SelectObject(hDC, GetSysColorBrush(COLOR_BTNSHADOW)); |
| 715 | PatBlt(hDC, rc.left, rc.top, 1, rc.bottom-rc.top, PATCOPY ); |
| 716 | PatBlt(hDC, rc.left, rc.top, rc.right-rc.left, 1, PATCOPY ); |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 717 | } else { |
| 718 | rc.right++, rc.bottom++; |
| 719 | DrawEdge( hDC, &rc, EDGE_RAISED, BF_RECT ); |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 720 | rc.right--, rc.bottom--; |
| 721 | } |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 722 | } |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 723 | else |
| 724 | { |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 725 | UINT uState = DFCS_BUTTONPUSH | DFCS_ADJUSTRECT; |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 726 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 727 | if (wndPtr->dwStyle & BS_FLAT) |
| 728 | uState |= DFCS_MONO; |
| 729 | else if (pushedState) |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 730 | { |
| 731 | if ( (wndPtr->dwStyle & 0x000f) == BS_DEFPUSHBUTTON ) |
| 732 | uState |= DFCS_FLAT; |
| 733 | else |
| 734 | uState |= DFCS_PUSHED; |
| 735 | } |
| 736 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 737 | if (infoPtr->state & (BUTTON_CHECKED | BUTTON_3STATE)) |
| 738 | uState |= DFCS_CHECKED; |
| 739 | |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 740 | DrawFrameControl( hDC, &rc, DFC_BUTTON, uState ); |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 741 | |
| 742 | focus_rect = rc; |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 743 | } |
| 744 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 745 | /* draw button label */ |
| 746 | r = rc; |
| 747 | dtFlags = BUTTON_CalcLabelRect(wndPtr, hDC, &r); |
| 748 | |
| 749 | if (dtFlags == (UINT)-1L) |
| 750 | goto cleanup; |
| 751 | |
| 752 | if (pushedState) |
| 753 | OffsetRect(&r, 1, 1); |
| 754 | |
| 755 | if(TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 756 | { |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 757 | focus_rect = r; |
| 758 | InflateRect(&focus_rect, 2, 0); |
Pascal Lessard | 026f705 | 1999-04-15 15:49:36 +0000 | [diff] [blame] | 759 | } |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 760 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 761 | hRgn = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom); |
| 762 | SelectClipRgn(hDC, hRgn); |
| 763 | |
| 764 | oldTxtColor = SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) ); |
| 765 | |
| 766 | BUTTON_DrawLabel(wndPtr, hDC, dtFlags, &r); |
| 767 | |
| 768 | SetTextColor( hDC, oldTxtColor ); |
| 769 | SelectClipRgn(hDC, 0); |
| 770 | DeleteObject(hRgn); |
| 771 | |
| 772 | if (infoPtr->state & BUTTON_HASFOCUS) |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 773 | { |
| 774 | InflateRect( &focus_rect, -1, -1 ); |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 775 | IntersectRect(&focus_rect, &focus_rect, &rc); |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 776 | DrawFocusRect( hDC, &focus_rect ); |
| 777 | } |
| 778 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 779 | cleanup: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 780 | SelectObject( hDC, hOldPen ); |
| 781 | SelectObject( hDC, hOldBrush ); |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 782 | SetBkMode(hDC, oldBkMode); |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 783 | } |
| 784 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 785 | /********************************************************************** |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 786 | * Check Box & Radio Button Functions |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 787 | */ |
| 788 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 789 | static void CB_Paint( WND *wndPtr, HDC hDC, WORD action ) |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 790 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 791 | RECT rbox, rtext, client; |
| 792 | HBRUSH hBrush; |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 793 | int delta; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 794 | BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 795 | UINT dtFlags; |
| 796 | HRGN hRgn; |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 797 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 798 | if (wndPtr->dwStyle & BS_PUSHLIKE) |
Francis Beaudet | 9b4748b | 1999-07-18 15:29:43 +0000 | [diff] [blame] | 799 | { |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 800 | BOOL bHighLighted = (infoPtr->state & BUTTON_HIGHLIGHTED); |
Francis Beaudet | 9b4748b | 1999-07-18 15:29:43 +0000 | [diff] [blame] | 801 | |
Patrik Stridvall | 0e38aa7 | 1999-07-31 17:34:43 +0000 | [diff] [blame] | 802 | BUTTON_DrawPushButton(wndPtr, |
| 803 | hDC, |
| 804 | action, |
| 805 | bHighLighted); |
| 806 | return; |
Francis Beaudet | 9b4748b | 1999-07-18 15:29:43 +0000 | [diff] [blame] | 807 | } |
| 808 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 809 | GetClientRect(wndPtr->hwndSelf, &client); |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 810 | rbox = rtext = client; |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 811 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 812 | if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 813 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 814 | /* GetControlBrush16 sends WM_CTLCOLORBTN, plus it returns default brush |
| 815 | * if parent didn't return valid one. So we kill two hares at once |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 816 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 817 | hBrush = GetControlBrush16( wndPtr->hwndSelf, hDC, CTLCOLOR_BTN ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 818 | |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 819 | if (wndPtr->dwStyle & BS_LEFTTEXT) |
| 820 | { |
| 821 | /* magic +4 is what CTL3D expects */ |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 822 | |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 823 | rtext.right -= checkBoxWidth + 4; |
| 824 | rbox.left = rbox.right - checkBoxWidth; |
| 825 | } |
| 826 | else |
| 827 | { |
| 828 | rtext.left += checkBoxWidth + 4; |
| 829 | rbox.right = checkBoxWidth; |
| 830 | } |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 831 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 832 | /* Draw the check-box bitmap */ |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 833 | if (action == ODA_DRAWENTIRE || action == ODA_SELECT) |
| 834 | { |
Dennis Björklund | 9af3eba | 1999-09-13 16:06:17 +0000 | [diff] [blame] | 835 | if( TWEAK_WineLook == WIN31_LOOK ) |
| 836 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 837 | HDC hMemDC = CreateCompatibleDC( hDC ); |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 838 | int x = 0, y = 0; |
Francis Beaudet | f22ff40 | 1999-09-03 12:35:18 +0000 | [diff] [blame] | 839 | delta = (rbox.bottom - rbox.top - checkBoxHeight) / 2; |
| 840 | |
| 841 | /* Check in case the client area is smaller than the checkbox bitmap */ |
| 842 | if (delta < 0) delta = 0; |
Alexandre Julliard | 902da69 | 1995-11-05 14:39:02 +0000 | [diff] [blame] | 843 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 844 | if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush ); |
| 845 | else FillRect( hDC, &client, hBrush ); |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 846 | |
| 847 | if (infoPtr->state & BUTTON_HIGHLIGHTED) x += 2 * checkBoxWidth; |
| 848 | if (infoPtr->state & (BUTTON_CHECKED | BUTTON_3STATE)) x += checkBoxWidth; |
| 849 | if (((wndPtr->dwStyle & 0x0f) == BS_RADIOBUTTON) || |
| 850 | ((wndPtr->dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) y += checkBoxHeight; |
| 851 | else if (infoPtr->state & BUTTON_3STATE) y += 2 * checkBoxHeight; |
| 852 | |
Francis Beaudet | 4993603 | 1999-09-03 15:07:21 +0000 | [diff] [blame] | 853 | /* The bitmap for the radio button is not aligned with the |
| 854 | * left of the window, it is 1 pixel off. */ |
| 855 | if (((wndPtr->dwStyle & 0x0f) == BS_RADIOBUTTON) || |
| 856 | ((wndPtr->dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) |
| 857 | rbox.left += 1; |
| 858 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 859 | SelectObject( hMemDC, hbitmapCheckBoxes ); |
| 860 | BitBlt( hDC, rbox.left, rbox.top + delta, checkBoxWidth, |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 861 | checkBoxHeight, hMemDC, x, y, SRCCOPY ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 862 | DeleteDC( hMemDC ); |
Dennis Björklund | 9af3eba | 1999-09-13 16:06:17 +0000 | [diff] [blame] | 863 | } |
| 864 | else |
| 865 | { |
| 866 | UINT state; |
| 867 | |
| 868 | if (((wndPtr->dwStyle & 0x0f) == BS_RADIOBUTTON) || |
| 869 | ((wndPtr->dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) state = DFCS_BUTTONRADIO; |
| 870 | else if (infoPtr->state & BUTTON_3STATE) state = DFCS_BUTTON3STATE; |
| 871 | else state = DFCS_BUTTONCHECK; |
| 872 | |
| 873 | if (infoPtr->state & (BUTTON_CHECKED | BUTTON_3STATE)) state |= DFCS_CHECKED; |
| 874 | |
| 875 | if (infoPtr->state & BUTTON_HIGHLIGHTED) state |= DFCS_PUSHED; |
| 876 | |
| 877 | if (wndPtr->dwStyle & WS_DISABLED) state |= DFCS_INACTIVE; |
| 878 | |
Susan Farley | b09c6ef | 2000-06-04 01:32:59 +0000 | [diff] [blame] | 879 | /* rbox must have the correct height */ |
| 880 | delta = rbox.bottom - rbox.top - checkBoxHeight; |
| 881 | if (delta > 0) |
| 882 | { |
| 883 | int ofs = (abs(delta) / 2); |
| 884 | rbox.bottom -= ofs + 1; |
| 885 | rbox.top = rbox.bottom - checkBoxHeight; |
| 886 | } |
| 887 | else if (delta < 0) |
| 888 | { |
| 889 | int ofs = (abs(delta) / 2); |
| 890 | rbox.top -= ofs + 1; |
| 891 | rbox.bottom = rbox.top + checkBoxHeight; |
| 892 | } |
| 893 | |
Dennis Björklund | 9af3eba | 1999-09-13 16:06:17 +0000 | [diff] [blame] | 894 | DrawFrameControl( hDC, &rbox, DFC_BUTTON, state ); |
| 895 | } |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 896 | } |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 897 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 898 | /* Draw label */ |
| 899 | client = rtext; |
| 900 | dtFlags = BUTTON_CalcLabelRect(wndPtr, hDC, &rtext); |
| 901 | |
| 902 | if (dtFlags == (UINT)-1L) /* Noting to draw */ |
| 903 | return; |
| 904 | hRgn = CreateRectRgn(client.left, client.top, client.right, client.bottom); |
| 905 | SelectClipRgn(hDC, hRgn); |
| 906 | DeleteObject(hRgn); |
| 907 | |
| 908 | if (action == ODA_DRAWENTIRE) |
| 909 | BUTTON_DrawLabel(wndPtr, hDC, dtFlags, &rtext); |
| 910 | |
| 911 | /* ... and focus */ |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 912 | if ((action == ODA_FOCUS) || |
| 913 | ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS))) |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 914 | { |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 915 | rtext.left--; |
| 916 | rtext.right++; |
| 917 | IntersectRect(&rtext, &rtext, &client); |
| 918 | DrawFocusRect( hDC, &rtext ); |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 919 | } |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 920 | SelectClipRgn(hDC, 0); |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 921 | } |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 922 | |
| 923 | |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 924 | /********************************************************************** |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 925 | * BUTTON_CheckAutoRadioButton |
| 926 | * |
Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 927 | * wndPtr is checked, uncheck every other auto radio button in group |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 928 | */ |
Alexandre Julliard | 8664b89 | 1996-04-05 14:58:24 +0000 | [diff] [blame] | 929 | static void BUTTON_CheckAutoRadioButton( WND *wndPtr ) |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 930 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 931 | HWND parent, sibling, start; |
Alexandre Julliard | 8664b89 | 1996-04-05 14:58:24 +0000 | [diff] [blame] | 932 | if (!(wndPtr->dwStyle & WS_CHILD)) return; |
| 933 | parent = wndPtr->parent->hwndSelf; |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 934 | /* assure that starting control is not disabled or invisible */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 935 | start = sibling = GetNextDlgGroupItem( parent, wndPtr->hwndSelf, TRUE ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 936 | do |
| 937 | { |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 938 | WND *tmpWnd; |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 939 | if (!sibling) break; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 940 | tmpWnd = WIN_FindWndPtr(sibling); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 941 | if ((wndPtr->hwndSelf != sibling) && |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 942 | ((tmpWnd->dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 943 | SendMessageW( sibling, BM_SETCHECK, BUTTON_UNCHECKED, 0 ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 944 | sibling = GetNextDlgGroupItem( parent, sibling, FALSE ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 945 | WIN_ReleaseWndPtr(tmpWnd); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 946 | } while (sibling != start); |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 947 | } |
| 948 | |
| 949 | |
| 950 | /********************************************************************** |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 951 | * Group Box Functions |
| 952 | */ |
| 953 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 954 | static void GB_Paint( WND *wndPtr, HDC hDC, WORD action ) |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 955 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 956 | RECT rc, rcFrame; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 957 | BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 958 | HBRUSH hbr; |
| 959 | UINT dtFlags; |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 960 | |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 961 | if (action != ODA_DRAWENTIRE) return; |
| 962 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 963 | if (infoPtr->hFont) |
| 964 | SelectObject (hDC, infoPtr->hFont); |
| 965 | /* GroupBox acts like static control, so it sends CTLCOLORSTATIC */ |
| 966 | hbr = GetControlBrush16( wndPtr->hwndSelf, hDC, CTLCOLOR_STATIC ); |
| 967 | |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 968 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 969 | GetClientRect( wndPtr->hwndSelf, &rc); |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 970 | if (TWEAK_WineLook == WIN31_LOOK) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 971 | HPEN hPrevPen = SelectObject( hDC, |
| 972 | GetSysColorPen(COLOR_WINDOWFRAME)); |
| 973 | HBRUSH hPrevBrush = SelectObject( hDC, |
| 974 | GetStockObject(NULL_BRUSH) ); |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 975 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 976 | Rectangle( hDC, rc.left, rc.top + 2, rc.right - 1, rc.bottom - 1 ); |
| 977 | SelectObject( hDC, hPrevBrush ); |
| 978 | SelectObject( hDC, hPrevPen ); |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 979 | } else { |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 980 | TEXTMETRICW tm; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 981 | rcFrame = rc; |
| 982 | |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 983 | GetTextMetricsW (hDC, &tm); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 984 | rcFrame.top += (tm.tmHeight / 2) - 1; |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 985 | DrawEdge (hDC, &rcFrame, EDGE_ETCHED, BF_RECT | |
| 986 | ((wndPtr->dwStyle & BS_FLAT) ? BF_FLAT : 0)); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 987 | } |
| 988 | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 989 | InflateRect(&rc, -7, 1); |
| 990 | dtFlags = BUTTON_CalcLabelRect(wndPtr, hDC, &rc); |
| 991 | |
| 992 | if (dtFlags == (UINT)-1L) |
| 993 | return; |
| 994 | |
| 995 | /* Because buttons have CS_PARENTDC class style, there is a chance |
| 996 | * that label will be drawn out of client rect. |
| 997 | * But Windows doesn't clip label's rect, so do I. |
| 998 | */ |
| 999 | |
| 1000 | /* There is 1-pixel marging at the left, right, and bottom */ |
| 1001 | rc.left--; rc.right++; rc.bottom++; |
| 1002 | FillRect(hDC, &rc, hbr); |
| 1003 | rc.left++; rc.right--; rc.bottom--; |
| 1004 | |
| 1005 | BUTTON_DrawLabel(wndPtr, hDC, dtFlags, &rc); |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1006 | } |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 1007 | |
| 1008 | |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1009 | /********************************************************************** |
| 1010 | * User Button Functions |
| 1011 | */ |
| 1012 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1013 | static void UB_Paint( WND *wndPtr, HDC hDC, WORD action ) |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1014 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1015 | RECT rc; |
| 1016 | HBRUSH hBrush; |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 1017 | BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1018 | |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 1019 | if (action == ODA_SELECT) return; |
| 1020 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1021 | GetClientRect( wndPtr->hwndSelf, &rc); |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1022 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1023 | if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); |
| 1024 | hBrush = GetControlBrush16( wndPtr->hwndSelf, hDC, CTLCOLOR_BTN ); |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1025 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1026 | FillRect( hDC, &rc, hBrush ); |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 1027 | if ((action == ODA_FOCUS) || |
| 1028 | ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS))) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1029 | DrawFocusRect( hDC, &rc ); |
Alexandre Julliard | 0e60778 | 1993-11-03 19:23:37 +0000 | [diff] [blame] | 1030 | } |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 1031 | |
Alexandre Julliard | e399fc3 | 1993-11-24 17:08:56 +0000 | [diff] [blame] | 1032 | |
| 1033 | /********************************************************************** |
| 1034 | * Ownerdrawn Button Functions |
| 1035 | */ |
| 1036 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1037 | static void OB_Paint( WND *wndPtr, HDC hDC, WORD action ) |
Alexandre Julliard | e399fc3 | 1993-11-24 17:08:56 +0000 | [diff] [blame] | 1038 | { |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 1039 | BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1040 | DRAWITEMSTRUCT dis; |
Dave Hawkes | fcd3521 | 2000-07-15 21:31:42 +0000 | [diff] [blame] | 1041 | HRGN clipRegion; |
| 1042 | RECT clipRect; |
Alexandre Julliard | e399fc3 | 1993-11-24 17:08:56 +0000 | [diff] [blame] | 1043 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1044 | dis.CtlType = ODT_BUTTON; |
| 1045 | dis.CtlID = wndPtr->wIDmenu; |
| 1046 | dis.itemID = 0; |
| 1047 | dis.itemAction = action; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1048 | dis.itemState = ((infoPtr->state & BUTTON_HASFOCUS) ? ODS_FOCUS : 0) | |
| 1049 | ((infoPtr->state & BUTTON_HIGHLIGHTED) ? ODS_SELECTED : 0) | |
Serge Ivanov | 6117fc4 | 2000-09-13 00:00:55 +0000 | [diff] [blame] | 1050 | (IsWindowEnabled(wndPtr->hwndSelf) ? 0: ODS_DISABLED); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1051 | dis.hwndItem = wndPtr->hwndSelf; |
| 1052 | dis.hDC = hDC; |
| 1053 | dis.itemData = 0; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1054 | GetClientRect( wndPtr->hwndSelf, &dis.rcItem ); |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 1055 | |
Dave Hawkes | fcd3521 | 2000-07-15 21:31:42 +0000 | [diff] [blame] | 1056 | clipRegion = CreateRectRgnIndirect(&dis.rcItem); |
| 1057 | if (GetClipRgn(hDC, clipRegion) != 1) |
| 1058 | { |
| 1059 | DeleteObject(clipRegion); |
| 1060 | clipRegion=(HRGN)NULL; |
| 1061 | } |
| 1062 | clipRect = dis.rcItem; |
| 1063 | DPtoLP(hDC, (LPPOINT) &clipRect, 2); |
| 1064 | IntersectClipRect(hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); |
| 1065 | |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 1066 | SetBkColor( hDC, GetSysColor( COLOR_BTNFACE ) ); |
Dennis Björklund | 767b099 | 1999-07-15 16:07:19 +0000 | [diff] [blame] | 1067 | |
Dmitry Timoshkov | 2b4be4b | 2000-11-28 23:51:48 +0000 | [diff] [blame] | 1068 | SendMessageW( GetParent(wndPtr->hwndSelf), WM_DRAWITEM, |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 1069 | wndPtr->wIDmenu, (LPARAM)&dis ); |
Dave Hawkes | fcd3521 | 2000-07-15 21:31:42 +0000 | [diff] [blame] | 1070 | |
| 1071 | SelectClipRgn(hDC, clipRegion); |
Alexandre Julliard | e399fc3 | 1993-11-24 17:08:56 +0000 | [diff] [blame] | 1072 | } |
Pascal Lessard | 026f705 | 1999-04-15 15:49:36 +0000 | [diff] [blame] | 1073 | |