ReactOS 0.4.15-dev-8636-g945e856
button.c File Reference
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "comctl32.h"
Include dependency graph for button.c:

Go to the source code of this file.

Classes

struct  _BUTTON_INFO
 

Macros

#define OEMRESOURCE
 
#define BUTTON_NSTATES   0x0F
 
#define BUTTON_BTNPRESSED   0x40
 
#define BUTTON_UNKNOWN2   0x20
 
#define BUTTON_UNKNOWN3   0x10
 
#define BUTTON_NOTIFY_PARENT(hWnd, code)
 
#define MAX_BTN_TYPE   16
 

Typedefs

typedef struct _BUTTON_INFO BUTTON_INFO
 
typedef void(* pfPaint) (const BUTTON_INFO *infoPtr, HDC hdc, UINT action)
 
typedef void(* pfThemedPaint) (HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)
 

Enumerations

enum  ButtonState {
  STATE_NORMAL , STATE_DISABLED , STATE_HOT , STATE_PRESSED ,
  STATE_DEFAULTED
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (button)
 
static UINT BUTTON_CalcLabelRect (const BUTTON_INFO *infoPtr, HDC hdc, RECT *rc)
 
static void PB_Paint (const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
 
static void CB_Paint (const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
 
static void GB_Paint (const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
 
static void UB_Paint (const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
 
static void OB_Paint (const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
 
static void BUTTON_CheckAutoRadioButton (HWND hwnd)
 
static void PB_ThemedPaint (HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)
 
static void CB_ThemedPaint (HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)
 
static void GB_ThemedPaint (HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)
 
static UINT get_button_type (LONG window_style)
 
static void paint_button (BUTTON_INFO *infoPtr, LONG style, UINT action)
 
static WCHARget_button_text (const BUTTON_INFO *infoPtr)
 
HRGN set_control_clipping (HDC hdc, const RECT *rect)
 
static WCHARheap_strndupW (const WCHAR *src, size_t length)
 
static UINT BUTTON_BStoDT (DWORD style, DWORD ex_style)
 
static LRESULT CALLBACK BUTTON_WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL CALLBACK BUTTON_DrawTextCallback (HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy)
 
static void BUTTON_DrawLabel (const BUTTON_INFO *infoPtr, HDC hdc, UINT dtFlags, const RECT *rc)
 
void BUTTON_Register (void)
 

Variables

static const WORD maxCheckState [MAX_BTN_TYPE]
 
static const pfPaint btnPaintFunc [MAX_BTN_TYPE]
 
static const pfThemedPaint btnThemedPaintFunc [MAX_BTN_TYPE]
 

Macro Definition Documentation

◆ BUTTON_BTNPRESSED

#define BUTTON_BTNPRESSED   0x40

Definition at line 78 of file button.c.

◆ BUTTON_NOTIFY_PARENT

#define BUTTON_NOTIFY_PARENT (   hWnd,
  code 
)
Value:
do { /* Notify parent which has created this button control */ \
TRACE("notification " #code " sent to hwnd=%p\n", GetParent(hWnd)); \
SendMessageW(GetParent(hWnd), WM_COMMAND, \
(LPARAM)(hWnd)); \
} while(0)
HWND hWnd
Definition: settings.c:17
Definition: inflate.c:139
LONG_PTR LPARAM
Definition: windef.h:208
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define WM_COMMAND
Definition: winuser.h:1743
HWND WINAPI GetParent(_In_ HWND)
#define GWLP_ID
Definition: winuser.h:863

Definition at line 85 of file button.c.

◆ BUTTON_NSTATES

#define BUTTON_NSTATES   0x0F

Definition at line 77 of file button.c.

◆ BUTTON_UNKNOWN2

#define BUTTON_UNKNOWN2   0x20

Definition at line 79 of file button.c.

◆ BUTTON_UNKNOWN3

#define BUTTON_UNKNOWN3   0x10

Definition at line 80 of file button.c.

◆ MAX_BTN_TYPE

#define MAX_BTN_TYPE   16

Definition at line 123 of file button.c.

◆ OEMRESOURCE

#define OEMRESOURCE

Definition at line 61 of file button.c.

Typedef Documentation

◆ BUTTON_INFO

◆ pfPaint

typedef void(* pfPaint) (const BUTTON_INFO *infoPtr, HDC hdc, UINT action)

Definition at line 155 of file button.c.

◆ pfThemedPaint

typedef void(* pfThemedPaint) (HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)

Definition at line 186 of file button.c.

Enumeration Type Documentation

◆ ButtonState

Enumerator
STATE_NORMAL 
STATE_DISABLED 
STATE_HOT 
STATE_PRESSED 
STATE_DEFAULTED 

Definition at line 146 of file button.c.

147{
150 STATE_HOT,
ButtonState
Definition: button.c:147
@ STATE_PRESSED
Definition: button.c:151
@ STATE_DEFAULTED
Definition: button.c:152
@ STATE_DISABLED
Definition: button.c:149
@ STATE_NORMAL
Definition: button.c:148
@ STATE_HOT
Definition: button.c:150

Function Documentation

◆ BUTTON_BStoDT()

static UINT BUTTON_BStoDT ( DWORD  style,
DWORD  ex_style 
)
static

Definition at line 273 of file button.c.

274{
275 UINT dtStyle = DT_NOCLIP; /* We use SelectClipRgn to limit output */
276
277 /* "Convert" pushlike buttons to pushbuttons */
278 if (style & BS_PUSHLIKE)
279 style &= ~BS_TYPEMASK;
280
281 if (!(style & BS_MULTILINE))
282 dtStyle |= DT_SINGLELINE;
283 else
284 dtStyle |= DT_WORDBREAK;
285
286 switch (style & BS_CENTER)
287 {
288 case BS_LEFT: /* DT_LEFT is 0 */ break;
289 case BS_RIGHT: dtStyle |= DT_RIGHT; break;
290 case BS_CENTER: dtStyle |= DT_CENTER; break;
291 default:
292 /* Pushbutton's text is centered by default */
294 /* all other flavours have left aligned text */
295 }
296
297 if (ex_style & WS_EX_RIGHT) dtStyle = DT_RIGHT | (dtStyle & ~(DT_LEFT | DT_CENTER));
298
299 /* DrawText ignores vertical alignment for multiline text,
300 * but we use these flags to align label manually.
301 */
303 {
304 switch (style & BS_VCENTER)
305 {
306 case BS_TOP: /* DT_TOP is 0 */ break;
307 case BS_BOTTOM: dtStyle |= DT_BOTTOM; break;
308 case BS_VCENTER: /* fall through */
309 default: dtStyle |= DT_VCENTER; break;
310 }
311 }
312 else
313 /* GroupBox's text is always single line and is top aligned. */
314 dtStyle |= DT_SINGLELINE;
315
316 return dtStyle;
317}
Arabic default style
Definition: afstyles.h:94
static UINT get_button_type(LONG window_style)
Definition: button.c:214
unsigned int UINT
Definition: ndis.h:50
#define BS_GROUPBOX
Definition: pedump.c:658
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
#define DT_CENTER
Definition: winuser.h:527
#define BS_RIGHT
Definition: winuser.h:274
#define BS_PUSHLIKE
Definition: winuser.h:272
#define DT_SINGLELINE
Definition: winuser.h:540
#define BS_BOTTOM
Definition: winuser.h:259
#define DT_NOCLIP
Definition: winuser.h:536
#define BS_MULTILINE
Definition: winuser.h:267
#define DT_LEFT
Definition: winuser.h:534
#define BS_LEFT
Definition: winuser.h:265
#define DT_WORDBREAK
Definition: winuser.h:544
#define BS_VCENTER
Definition: winuser.h:279
#define BS_TOP
Definition: winuser.h:277
#define DT_VCENTER
Definition: winuser.h:543
#define DT_BOTTOM
Definition: winuser.h:525
#define DT_RIGHT
Definition: winuser.h:538
#define BS_CENTER
Definition: winuser.h:260
#define WS_EX_RIGHT
Definition: winuser.h:400

Referenced by BUTTON_CalcLabelRect(), and BUTTON_WindowProc().

◆ BUTTON_CalcLabelRect()

static UINT BUTTON_CalcLabelRect ( const BUTTON_INFO infoPtr,
HDC  hdc,
RECT rc 
)
static

Definition at line 1278 of file button.c.

1279{
1280 LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1281 LONG ex_style = GetWindowLongW( infoPtr->hwnd, GWL_EXSTYLE );
1282 WCHAR *text;
1283 ICONINFO iconInfo;
1284 BITMAP bm;
1285 UINT dtStyle = BUTTON_BStoDT( style, ex_style );
1286 RECT r = *rc;
1287 INT n;
1288#ifdef __REACTOS__
1289 BOOL bHasIml = BUTTON_DrawIml(hdc, &infoPtr->imlData, &r, TRUE, 0);
1290#endif
1291
1292 /* Calculate label rectangle according to label type */
1293 switch (style & (BS_ICON|BS_BITMAP))
1294 {
1295 case BS_TEXT:
1296 {
1297 HFONT hFont, hPrevFont = 0;
1298
1299 if (!(text = get_button_text( infoPtr ))) goto empty_rect;
1300 if (!text[0])
1301 {
1302 heap_free( text );
1303 goto empty_rect;
1304 }
1305
1306 if ((hFont = infoPtr->font)) hPrevFont = SelectObject( hdc, hFont );
1307#ifdef __REACTOS__
1308 DrawTextW(hdc, text, -1, &r, ((dtStyle | DT_CALCRECT) & ~(DT_VCENTER | DT_BOTTOM)));
1309#else
1310 DrawTextW(hdc, text, -1, &r, dtStyle | DT_CALCRECT);
1311#endif
1312 if (hPrevFont) SelectObject( hdc, hPrevFont );
1313 heap_free( text );
1314#ifdef __REACTOS__
1315 if (infoPtr->ui_state & UISF_HIDEACCEL)
1316 dtStyle |= DT_HIDEPREFIX;
1317#endif
1318 break;
1319 }
1320
1321 case BS_ICON:
1322 if (!GetIconInfo(infoPtr->u.icon, &iconInfo))
1323 goto empty_rect;
1324
1325 GetObjectW (iconInfo.hbmColor, sizeof(BITMAP), &bm);
1326
1327 r.right = r.left + bm.bmWidth;
1328 r.bottom = r.top + bm.bmHeight;
1329
1330 DeleteObject(iconInfo.hbmColor);
1331 DeleteObject(iconInfo.hbmMask);
1332 break;
1333
1334 case BS_BITMAP:
1335 if (!GetObjectW( infoPtr->u.bitmap, sizeof(BITMAP), &bm))
1336 goto empty_rect;
1337
1338 r.right = r.left + bm.bmWidth;
1339 r.bottom = r.top + bm.bmHeight;
1340 break;
1341
1342 default:
1343 empty_rect:
1344#ifdef __REACTOS__
1345 if (bHasIml)
1346 break;
1347#endif
1348 rc->right = r.left;
1349 rc->bottom = r.top;
1350 return (UINT)-1;
1351 }
1352
1353#ifdef __REACTOS__
1354 if (bHasIml)
1355 {
1356 if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_LEFT)
1357 r.left = infoPtr->imlData.margin.left;
1358 else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_RIGHT)
1359 r.right = infoPtr->imlData.margin.right;
1360 else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_TOP)
1361 r.top = infoPtr->imlData.margin.top;
1362 else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_BOTTOM)
1363 r.bottom = infoPtr->imlData.margin.bottom;
1364 }
1365#endif
1366
1367 /* Position label inside bounding rectangle according to
1368 * alignment flags. (calculated rect is always left-top aligned).
1369 * If label is aligned to any side - shift label in opposite
1370 * direction to leave extra space for focus rectangle.
1371 */
1372 switch (dtStyle & (DT_CENTER|DT_RIGHT))
1373 {
1374 case DT_LEFT: r.left++; r.right++; break;
1375 case DT_CENTER: n = r.right - r.left;
1376 r.left = rc->left + ((rc->right - rc->left) - n) / 2;
1377 r.right = r.left + n; break;
1378 case DT_RIGHT: n = r.right - r.left;
1379 r.right = rc->right - 1;
1380 r.left = r.right - n;
1381 break;
1382 }
1383
1384 switch (dtStyle & (DT_VCENTER|DT_BOTTOM))
1385 {
1386 case DT_TOP: r.top++; r.bottom++; break;
1387 case DT_VCENTER: n = r.bottom - r.top;
1388#ifdef __REACTOS__
1389 r.top = rc->top + ((rc->bottom - 1 - rc->top) - n) / 2;
1390#else
1391 r.top = rc->top + ((rc->bottom - rc->top) - n) / 2;
1392#endif
1393 r.bottom = r.top + n; break;
1394 case DT_BOTTOM: n = r.bottom - r.top;
1395 r.bottom = rc->bottom - 1;
1396 r.top = r.bottom - n;
1397 break;
1398 }
1399
1400 *rc = r;
1401 return dtStyle;
1402}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
HFONT hFont
Definition: main.c:53
#define TRUE
Definition: types.h:120
static UINT BUTTON_BStoDT(DWORD style, DWORD ex_style)
Definition: button.c:273
static WCHAR * get_button_text(const BUTTON_INFO *infoPtr)
Definition: button.c:233
const WCHAR * text
Definition: package.c:1799
unsigned int BOOL
Definition: ntddk_ex.h:94
pKey DeleteObject()
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
HDC hdc
Definition: main.c:9
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
long LONG
Definition: pedump.c:60
#define BUTTON_IMAGELIST_ALIGN_TOP
Definition: commctrl.h:4634
#define BUTTON_IMAGELIST_ALIGN_LEFT
Definition: commctrl.h:4632
#define BUTTON_IMAGELIST_ALIGN_RIGHT
Definition: commctrl.h:4633
#define BUTTON_IMAGELIST_ALIGN_BOTTOM
Definition: commctrl.h:4635
Definition: bl.h:1331
HBITMAP bitmap
Definition: button.c:104
HWND hwnd
Definition: button.c:95
HICON icon
Definition: button.c:103
union _BUTTON_INFO::@333 u
HFONT font
Definition: button.c:98
HBITMAP hbmColor
Definition: winuser.h:3130
HBITMAP hbmMask
Definition: winuser.h:3129
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define BS_BITMAP
Definition: winuser.h:258
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2089
#define BS_ICON
Definition: winuser.h:264
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define DT_TOP
Definition: winuser.h:542
#define BS_TEXT
Definition: winuser.h:276
#define DT_CALCRECT
Definition: winuser.h:526
#define DT_HIDEPREFIX
Definition: winuser.h:547
#define GWL_STYLE
Definition: winuser.h:855
#define GWL_EXSTYLE
Definition: winuser.h:854
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by BUTTON_WindowProc(), ButtonWndProc_common(), CB_Paint(), GB_Paint(), and PB_Paint().

◆ BUTTON_CheckAutoRadioButton()

static void BUTTON_CheckAutoRadioButton ( HWND  hwnd)
static

Definition at line 1749 of file button.c.

1750{
1751 HWND parent, sibling, start;
1752
1754 /* make sure that starting control is not disabled or invisible */
1755#ifdef __REACTOS__
1756 start = sibling = hwnd;
1757#else
1758 start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
1759#endif
1760 do
1761 {
1762 if (!sibling) break;
1763#ifdef __REACTOS__
1765 SendMessageW( sibling, BM_SETCHECK, sibling == hwnd ? BST_CHECKED : BST_UNCHECKED, 0 );
1766#else
1767 if ((hwnd != sibling) &&
1769 SendMessageW( sibling, BM_SETCHECK, BST_UNCHECKED, 0 );
1770#endif
1771 sibling = GetNextDlgGroupItem( parent, sibling, FALSE );
1772 } while (sibling != start);
1773}
#define FALSE
Definition: types.h:117
r parent
Definition: btrfs.c:3010
GLuint start
Definition: gl.h:1545
#define BS_AUTORADIOBUTTON
Definition: pedump.c:660
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define DLGC_BUTTON
Definition: winuser.h:2623
#define BST_UNCHECKED
Definition: winuser.h:199
#define BS_TYPEMASK
Definition: winuser.h:270
#define BM_SETCHECK
Definition: winuser.h:1924
HWND WINAPI GetNextDlgGroupItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
#define DLGC_RADIOBUTTON
Definition: winuser.h:2620
#define WM_GETDLGCODE
Definition: winuser.h:1692
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197

Referenced by BUTTON_WindowProc(), and ButtonWndProc_common().

◆ BUTTON_DrawLabel()

static void BUTTON_DrawLabel ( const BUTTON_INFO infoPtr,
HDC  hdc,
UINT  dtFlags,
const RECT rc 
)
static

Definition at line 1425 of file button.c.

1426{
1427 DRAWSTATEPROC lpOutputProc = NULL;
1428 LPARAM lp;
1429 WPARAM wp = 0;
1430 HBRUSH hbr = 0;
1432 LONG state = infoPtr->state;
1433 LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1434 WCHAR *text = NULL;
1435
1436 /* FIXME: To draw disabled label in Win31 look-and-feel, we probably
1437 * must use DSS_MONO flag and COLOR_GRAYTEXT brush (or maybe DSS_UNION).
1438 * I don't have Win31 on hand to verify that, so I leave it as is.
1439 */
1440
1441#ifdef __REACTOS__
1442 RECT rcText = *rc;
1443 BUTTON_DrawIml(hdc, &infoPtr->imlData, &rcText, FALSE, 0);
1444#endif
1445
1447 {
1449 flags |= DSS_MONO;
1450 }
1451
1452 switch (style & (BS_ICON|BS_BITMAP))
1453 {
1454 case BS_TEXT:
1455 /* DST_COMPLEX -- is 0 */
1456 lpOutputProc = BUTTON_DrawTextCallback;
1457 if (!(text = get_button_text( infoPtr ))) return;
1458 lp = (LPARAM)text;
1459 wp = dtFlags;
1460#ifdef __REACTOS__
1461 if (dtFlags & DT_HIDEPREFIX)
1463#endif
1464 break;
1465
1466 case BS_ICON:
1467 flags |= DST_ICON;
1468 lp = (LPARAM)infoPtr->u.icon;
1469 break;
1470
1471 case BS_BITMAP:
1472 flags |= DST_BITMAP;
1473 lp = (LPARAM)infoPtr->u.bitmap;
1474 break;
1475
1476 default:
1477 return;
1478 }
1479
1480#ifdef __REACTOS__
1481 DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rcText.left, rcText.top,
1482 rcText.right - rcText.left, rcText.bottom - rcText.top, flags);
1483#else
1484 DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top,
1485 rc->right - rc->left, rc->bottom - rc->top, flags);
1486#endif
1487 heap_free( text );
1488}
static int state
Definition: maze.c:121
#define NULL
Definition: types.h:112
static BOOL CALLBACK BUTTON_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy)
Definition: button.c:1410
GLbitfield flags
Definition: glext.h:7161
LONG state
Definition: button.c:97
UINT_PTR WPARAM
Definition: windef.h:207
#define BST_INDETERMINATE
Definition: winuser.h:198
#define COLOR_GRAYTEXT
Definition: winuser.h:935
#define DSS_DISABLED
Definition: winuser.h:519
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define DST_ICON
Definition: winuser.h:515
#define DST_BITMAP
Definition: winuser.h:516
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define DSS_NORMAL
Definition: winuser.h:517
#define DSS_HIDEPREFIX
Definition: winuser.h:522
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)
BOOL(CALLBACK * DRAWSTATEPROC)(HDC, LPARAM, WPARAM, int, int)
Definition: winuser.h:2910
#define DSS_MONO
Definition: winuser.h:521

Referenced by CB_Paint(), GB_Paint(), and PB_Paint().

◆ BUTTON_DrawTextCallback()

static BOOL CALLBACK BUTTON_DrawTextCallback ( HDC  hdc,
LPARAM  lp,
WPARAM  wp,
int  cx,
int  cy 
)
static

Definition at line 1410 of file button.c.

1411{
1412 RECT rc;
1413
1414 SetRect(&rc, 0, 0, cx, cy);
1415 DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp);
1416 return TRUE;
1417}
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by BUTTON_DrawLabel().

◆ BUTTON_Register()

void BUTTON_Register ( void  )

Definition at line 2223 of file button.c.

2224{
2225 WNDCLASSW wndClass;
2226
2227 memset(&wndClass, 0, sizeof(wndClass));
2229 wndClass.lpfnWndProc = BUTTON_WindowProc;
2230 wndClass.cbClsExtra = 0;
2231 wndClass.cbWndExtra = sizeof(BUTTON_INFO *);
2232 wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
2233 wndClass.hbrBackground = NULL;
2234 wndClass.lpszClassName = WC_BUTTONW;
2235 RegisterClassW(&wndClass);
2236}
static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: button.c:598
#define WC_BUTTONW
Definition: commctrl.h:4628
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR lpszClassName
Definition: winuser.h:3188
HBRUSH hbrBackground
Definition: winuser.h:3186
int cbClsExtra
Definition: winuser.h:3181
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
#define CS_VREDRAW
Definition: winuser.h:658
#define CS_HREDRAW
Definition: winuser.h:653
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define CS_DBLCLKS
Definition: winuser.h:651
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2149
#define CS_GLOBALCLASS
Definition: winuser.h:652
#define CS_PARENTDC
Definition: winuser.h:656
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DllMain().

◆ BUTTON_WindowProc()

static LRESULT CALLBACK BUTTON_WindowProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 598 of file button.c.

599{
601 RECT rect;
602 POINT pt;
604 UINT btn_type = get_button_type( style );
605 LONG state, new_state;
606 HANDLE oldHbitmap;
607 HTHEME theme;
608
609 if (!IsWindow( hWnd )) return 0;
610
611 if (!infoPtr && (uMsg != WM_NCCREATE))
612 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
613
614 pt.x = (short)LOWORD(lParam);
615 pt.y = (short)HIWORD(lParam);
616
617 switch (uMsg)
618 {
619 case WM_GETDLGCODE:
620 switch(btn_type)
621 {
622 case BS_COMMANDLINK:
623 case BS_USERBUTTON:
627 case BS_RADIOBUTTON:
629 case BS_GROUPBOX: return DLGC_STATIC;
632 default: return DLGC_BUTTON;
633 }
634
635 case WM_ENABLE:
636#ifndef __REACTOS__
637 theme = GetWindowTheme( hWnd );
638 if (theme)
640 else
641#endif
642 paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
643 break;
644
645 case WM_NCCREATE:
646 infoPtr = heap_alloc_zero( sizeof(*infoPtr) );
647 SetWindowLongPtrW( hWnd, 0, (LONG_PTR)infoPtr );
648 infoPtr->hwnd = hWnd;
649#ifdef __REACTOS__
650 SetRect(&infoPtr->rcTextMargin, 1,1,1,1);
651#endif
652 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
653
654 case WM_NCDESTROY:
655 SetWindowLongPtrW( hWnd, 0, 0 );
656 heap_free(infoPtr->note);
657 heap_free(infoPtr);
658 break;
659
660 case WM_CREATE:
661 if (btn_type >= MAX_BTN_TYPE)
662 return -1; /* abort */
663
664 /* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
665 if (btn_type == BS_USERBUTTON )
666 {
667 style = (style & ~BS_TYPEMASK) | BS_PUSHBUTTON;
669 }
670 infoPtr->state = BST_UNCHECKED;
672 return 0;
673
674 case WM_DESTROY:
675 theme = GetWindowTheme( hWnd );
676 CloseThemeData( theme );
677 break;
678
679 case WM_THEMECHANGED:
680 theme = GetWindowTheme( hWnd );
681 CloseThemeData( theme );
683#ifdef __REACTOS__
685#endif
686 break;
687
688 case WM_ERASEBKGND:
689 if (btn_type == BS_OWNERDRAW)
690 {
691 HDC hdc = (HDC)wParam;
692 RECT rc;
693 HBRUSH hBrush;
695 if (!parent) parent = hWnd;
696 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hdc, (LPARAM)hWnd);
697 if (!hBrush) /* did the app forget to call defwindowproc ? */
698 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN,
699 (WPARAM)hdc, (LPARAM)hWnd);
700 GetClientRect(hWnd, &rc);
701 FillRect(hdc, &rc, hBrush);
702 }
703 return 1;
704
705 case WM_PRINTCLIENT:
706 case WM_PAINT:
707 {
708 PAINTSTRUCT ps;
709 HDC hdc;
710
711 theme = GetWindowTheme( hWnd );
712 hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
713
714#ifdef __REACTOS__
715 if (theme && BUTTON_PaintWithTheme(theme, infoPtr, hdc, uMsg == WM_PRINTCLIENT ? lParam : 0))
716 {
717 if ( !wParam ) EndPaint( hWnd, &ps );
718 return 0;
719 }
720#else
721 if (theme && btnThemedPaintFunc[btn_type])
722 {
723 ButtonState drawState;
724 UINT dtflags;
725
726 if (IsWindowEnabled( hWnd ))
727 {
728 if (infoPtr->state & BST_PUSHED) drawState = STATE_PRESSED;
729 else if (infoPtr->state & BST_HOT) drawState = STATE_HOT;
730 else if (infoPtr->state & BST_FOCUS) drawState = STATE_DEFAULTED;
731 else drawState = STATE_NORMAL;
732 }
733 else
734 drawState = STATE_DISABLED;
735
737 btnThemedPaintFunc[btn_type](theme, infoPtr, hdc, drawState, dtflags, infoPtr->state & BST_FOCUS);
738 }
739#endif
740 else if (btnPaintFunc[btn_type])
741 {
742 int nOldMode = SetBkMode( hdc, OPAQUE );
743 btnPaintFunc[btn_type]( infoPtr, hdc, ODA_DRAWENTIRE );
744 SetBkMode(hdc, nOldMode); /* reset painting mode */
745 }
746
747 if ( !wParam ) EndPaint( hWnd, &ps );
748 break;
749 }
750
751 case WM_KEYDOWN:
752 if (wParam == VK_SPACE)
753 {
755 infoPtr->state |= BUTTON_BTNPRESSED;
756 SetCapture( hWnd );
757 }
758 break;
759
760 case WM_LBUTTONDBLCLK:
761 if(style & BS_NOTIFY ||
762 btn_type == BS_RADIOBUTTON ||
763 btn_type == BS_USERBUTTON ||
764 btn_type == BS_OWNERDRAW)
765 {
767 break;
768 }
769 /* fall through */
770 case WM_LBUTTONDOWN:
771 SetCapture( hWnd );
772 SetFocus( hWnd );
773 infoPtr->state |= BUTTON_BTNPRESSED;
775 break;
776
777 case WM_KEYUP:
778 if (wParam != VK_SPACE)
779 break;
780 /* fall through */
781 case WM_LBUTTONUP:
782 state = infoPtr->state;
783 if (!(state & BUTTON_BTNPRESSED)) break;
784 infoPtr->state &= BUTTON_NSTATES;
785 if (!(state & BST_PUSHED))
786 {
788 break;
789 }
792 if (uMsg == WM_KEYUP || PtInRect( &rect, pt ))
793 {
794 switch(btn_type)
795 {
796 case BS_AUTOCHECKBOX:
797 SendMessageW( hWnd, BM_SETCHECK, !(infoPtr->state & BST_CHECKED), 0 );
798 break;
800#ifdef __REACTOS__
802#else
804#endif
805 break;
806 case BS_AUTO3STATE:
808 ((infoPtr->state & 3) + 1), 0 );
809 break;
810 }
811#ifdef __REACTOS__
812 // Fix CORE-10194, Notify parent after capture is released.
815#else
818#endif
819 }
820 else
821 {
823 }
824
825 break;
826
828 TRACE("WM_CAPTURECHANGED %p\n", hWnd);
829 if (hWnd == (HWND)lParam) break;
830 if (infoPtr->state & BUTTON_BTNPRESSED)
831 {
832 infoPtr->state &= BUTTON_NSTATES;
833 if (infoPtr->state & BST_PUSHED)
835 }
836 break;
837
838 case WM_MOUSEMOVE:
839 {
841 mouse_event.cbSize = sizeof(TRACKMOUSEEVENT);
842 mouse_event.dwFlags = TME_QUERY;
843
844#ifdef __REACTOS__
845 if ((infoPtr->state & BST_HOT) == 0)
846 {
847 NMBCHOTITEM nmhotitem;
848
849 infoPtr->state |= BST_HOT;
850
851 nmhotitem.hdr.hwndFrom = hWnd;
852 nmhotitem.hdr.idFrom = GetWindowLongPtrW (hWnd, GWLP_ID);
853 nmhotitem.hdr.code = BCN_HOTITEMCHANGE;
854 nmhotitem.dwFlags = HICF_ENTERING;
855 SendMessageW(GetParent(hWnd), WM_NOTIFY, nmhotitem.hdr.idFrom, (LPARAM)&nmhotitem);
856
857 theme = GetWindowTheme( hWnd );
858 if (theme)
860 }
861
863 {
864 mouse_event.dwFlags = TME_LEAVE;
865 mouse_event.hwndTrack = hWnd;
866 mouse_event.dwHoverTime = 1;
868 }
869#else
870
871 if (!TrackMouseEvent(&mouse_event) || !(mouse_event.dwFlags & (TME_HOVER | TME_LEAVE)))
872 {
873 mouse_event.dwFlags = TME_HOVER | TME_LEAVE;
874 mouse_event.hwndTrack = hWnd;
875 mouse_event.dwHoverTime = 1;
877 }
878#endif
879
880 if ((wParam & MK_LBUTTON) && GetCapture() == hWnd)
881 {
884 }
885 break;
886 }
887
888#ifndef __REACTOS__
889 case WM_MOUSEHOVER:
890 {
891 infoPtr->state |= BST_HOT;
893 break;
894 }
895#endif
896
897 case WM_MOUSELEAVE:
898 {
899#ifdef __REACTOS__
900 if (infoPtr->state & BST_HOT)
901 {
902 NMBCHOTITEM nmhotitem;
903
904 infoPtr->state &= ~BST_HOT;
905
906 nmhotitem.hdr.hwndFrom = hWnd;
907 nmhotitem.hdr.idFrom = GetWindowLongPtrW (hWnd, GWLP_ID);
908 nmhotitem.hdr.code = BCN_HOTITEMCHANGE;
909 nmhotitem.dwFlags = HICF_LEAVING;
910 SendMessageW(GetParent(hWnd), WM_NOTIFY, nmhotitem.hdr.idFrom, (LPARAM)&nmhotitem);
911
912 theme = GetWindowTheme( hWnd );
913 if (theme)
915 }
916 break;
917#else
918 infoPtr->state &= ~BST_HOT;
920 break;
921#endif
922 }
923
924#ifdef __REACTOS__
926 {
927 RECT* prc = (RECT*)lParam;
928 if (!prc)
929 return FALSE;
930 *prc = infoPtr->rcTextMargin;
931 return TRUE;
932 }
934 {
935 RECT* prc = (RECT*)lParam;
936 if (!prc)
937 return FALSE;
938 infoPtr->rcTextMargin = *prc;
939 return TRUE;
940 }
941 case BCM_SETIMAGELIST:
942 {
944 if (!pimldata || !pimldata->himl)
945 return FALSE;
946 infoPtr->imlData = *pimldata;
947 return TRUE;
948 }
949 case BCM_GETIMAGELIST:
950 {
952 if (!pimldata)
953 return FALSE;
954 *pimldata = infoPtr->imlData;
955 return TRUE;
956 }
957 case BCM_GETIDEALSIZE:
958 {
959 HTHEME theme = GetWindowTheme(hWnd);
960 BOOL ret = FALSE;
961 SIZE* pSize = (SIZE*)lParam;
962
963 if (!pSize)
964 {
965 return FALSE;
966 }
967
968 if (btn_type == BS_PUSHBUTTON ||
969 btn_type == BS_DEFPUSHBUTTON ||
970 btn_type == BS_USERBUTTON)
971 {
972 ret = BUTTON_GetIdealSize(infoPtr, theme, pSize);
973 }
974
975 if (!ret)
976 {
978 pSize->cx = rect.right;
979 pSize->cy = rect.bottom;
980 }
981
982 return TRUE;
983 }
984#endif
985
986 case WM_SETTEXT:
987 {
988 /* Clear an old text here as Windows does */
989#ifdef __REACTOS__
990//
991// ReactOS Note :
992// wine Bug: http://bugs.winehq.org/show_bug.cgi?id=25790
993// Patch: http://source.winehq.org/patches/data/70889
994// By: Alexander LAW, Replicate Windows behavior of WM_SETTEXT handler regarding WM_CTLCOLOR*
995//
996 if (style & WS_VISIBLE)
997#else
999#endif
1000 {
1001 HDC hdc = GetDC(hWnd);
1002 HBRUSH hbrush;
1003 RECT client, rc;
1005 UINT message = (btn_type == BS_PUSHBUTTON ||
1006 btn_type == BS_DEFPUSHBUTTON ||
1007 btn_type == BS_USERBUTTON ||
1008 btn_type == BS_OWNERDRAW) ?
1010
1011 if (!parent) parent = hWnd;
1012 hbrush = (HBRUSH)SendMessageW(parent, message,
1013 (WPARAM)hdc, (LPARAM)hWnd);
1014 if (!hbrush) /* did the app forget to call DefWindowProc ? */
1016 (WPARAM)hdc, (LPARAM)hWnd);
1017
1019 rc = client;
1020 /* FIXME: check other BS_* handlers */
1021 if (btn_type == BS_GROUPBOX)
1022 InflateRect(&rc, -7, 1); /* GB_Paint does this */
1023 BUTTON_CalcLabelRect(infoPtr, hdc, &rc);
1024 /* Clip by client rect bounds */
1025 if (rc.right > client.right) rc.right = client.right;
1026 if (rc.bottom > client.bottom) rc.bottom = client.bottom;
1027 FillRect(hdc, &rc, hbrush);
1028 ReleaseDC(hWnd, hdc);
1029 }
1030
1032 if (btn_type == BS_GROUPBOX) /* Yes, only for BS_GROUPBOX */
1034 else
1035 paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
1036 return 1; /* success. FIXME: check text length */
1037 }
1038
1039 case BCM_SETNOTE:
1040 {
1041 WCHAR *note = (WCHAR *)lParam;
1042 if (btn_type != BS_COMMANDLINK && btn_type != BS_DEFCOMMANDLINK)
1043 {
1045 return FALSE;
1046 }
1047
1048 heap_free(infoPtr->note);
1049 if (note)
1050 {
1051 infoPtr->note_length = lstrlenW(note);
1052 infoPtr->note = heap_strndupW(note, infoPtr->note_length);
1053 }
1054
1055 if (!note || !infoPtr->note)
1056 {
1057 infoPtr->note_length = 0;
1058 infoPtr->note = heap_alloc_zero(sizeof(WCHAR));
1059 }
1060
1062 return TRUE;
1063 }
1064
1065 case BCM_GETNOTE:
1066 {
1067 DWORD *size = (DWORD *)wParam;
1068 WCHAR *buffer = (WCHAR *)lParam;
1069 INT length = 0;
1070
1071 if (btn_type != BS_COMMANDLINK && btn_type != BS_DEFCOMMANDLINK)
1072 {
1074 return FALSE;
1075 }
1076
1077 if (!buffer || !size || !infoPtr->note)
1078 {
1080 return FALSE;
1081 }
1082
1083 if (*size > 0)
1084 {
1085 length = min(*size - 1, infoPtr->note_length);
1086 memcpy(buffer, infoPtr->note, length * sizeof(WCHAR));
1087 buffer[length] = '\0';
1088 }
1089
1090 if (*size < infoPtr->note_length + 1)
1091 {
1092 *size = infoPtr->note_length + 1;
1094 return FALSE;
1095 }
1096 else
1097 {
1099 return TRUE;
1100 }
1101 }
1102
1103 case BCM_GETNOTELENGTH:
1104 {
1105 if (btn_type != BS_COMMANDLINK && btn_type != BS_DEFCOMMANDLINK)
1106 {
1108 return 0;
1109 }
1110
1111 return infoPtr->note_length;
1112 }
1113
1114 case WM_SETFONT:
1115 infoPtr->font = (HFONT)wParam;
1117 break;
1118
1119 case WM_GETFONT:
1120 return (LRESULT)infoPtr->font;
1121
1122 case WM_SETFOCUS:
1123 TRACE("WM_SETFOCUS %p\n",hWnd);
1124 infoPtr->state |= BST_FOCUS;
1125#ifdef __REACTOS__
1126 if (btn_type != BS_OWNERDRAW)
1128 else
1129#endif
1130 paint_button( infoPtr, btn_type, ODA_FOCUS );
1131 if (style & BS_NOTIFY)
1133#ifdef __REACTOS__
1134 if (((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON)) &&
1135 !(infoPtr->state & BST_CHECKED))
1136 {
1138 }
1139#endif
1140 break;
1141
1142 case WM_KILLFOCUS:
1143 TRACE("WM_KILLFOCUS %p\n",hWnd);
1144 infoPtr->state &= ~BST_FOCUS;
1145#ifndef __REACTOS__
1146 paint_button( infoPtr, btn_type, ODA_FOCUS );
1147#endif
1148
1149 if ((infoPtr->state & BUTTON_BTNPRESSED) && GetCapture() == hWnd)
1151 if (style & BS_NOTIFY)
1153
1155 break;
1156
1157 case WM_SYSCOLORCHANGE:
1159 break;
1160
1161 case BM_SETSTYLE:
1162 btn_type = wParam & BS_TYPEMASK;
1163 style = (style & ~BS_TYPEMASK) | btn_type;
1165
1166 /* Only redraw if lParam flag is set.*/
1167 if (lParam)
1169
1170 break;
1171
1172 case BM_CLICK:
1173#ifdef __REACTOS__
1174 /* Fix for core CORE-6024 */
1175 if (infoPtr->state & BUTTON_BMCLICK)
1176 break;
1177 infoPtr->state |= BUTTON_BMCLICK;
1178#endif
1180 SendMessageW( hWnd, WM_LBUTTONUP, 0, 0 );
1181#ifdef __REACTOS__
1182 infoPtr->state &= ~BUTTON_BMCLICK;
1183#endif
1184 break;
1185
1186 case BM_SETIMAGE:
1187 /* Check that image format matches button style */
1188 switch (style & (BS_BITMAP|BS_ICON))
1189 {
1190 case BS_BITMAP:
1191 if (wParam != IMAGE_BITMAP) return 0;
1192 break;
1193 case BS_ICON:
1194 if (wParam != IMAGE_ICON) return 0;
1195 break;
1196 default:
1197 return 0;
1198 }
1199 oldHbitmap = infoPtr->u.image;
1200 infoPtr->u.image = (HANDLE)lParam;
1202 return (LRESULT)oldHbitmap;
1203
1204 case BM_GETIMAGE:
1205 return (LRESULT)infoPtr->u.image;
1206
1207 case BM_GETCHECK:
1208 return infoPtr->state & 3;
1209
1210 case BM_SETCHECK:
1211 if (wParam > maxCheckState[btn_type]) wParam = maxCheckState[btn_type];
1212 if ((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON))
1213 {
1214 style = wParam ? style | WS_TABSTOP : style & ~WS_TABSTOP;
1216 }
1217 if ((infoPtr->state & 3) != wParam)
1218 {
1219 infoPtr->state = (infoPtr->state & ~3) | wParam;
1221 }
1222#ifndef __REACTOS__
1223 if ((btn_type == BS_AUTORADIOBUTTON) && (wParam == BST_CHECKED) && (style & WS_CHILD))
1225#endif
1226 break;
1227
1228 case BM_GETSTATE:
1229 return infoPtr->state;
1230
1231 case BM_SETSTATE:
1232 state = infoPtr->state;
1233 new_state = wParam ? BST_PUSHED : 0;
1234
1235 if ((state ^ new_state) & BST_PUSHED)
1236 {
1237 if (wParam)
1238 state |= BST_PUSHED;
1239 else
1240 state &= ~BST_PUSHED;
1241
1242 if (btn_type == BS_USERBUTTON)
1244 infoPtr->state = state;
1245
1247 }
1248 break;
1249
1250#ifdef __REACTOS__
1251 case WM_UPDATEUISTATE:
1253
1254 if (button_update_uistate(infoPtr))
1255 paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
1256 break;
1257#endif
1258
1259 case WM_NCHITTEST:
1260 if(btn_type == BS_GROUPBOX) return HTTRANSPARENT;
1261 /* fall through */
1262 default:
1263 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
1264 }
1265 return 0;
1266}
static HBRUSH hbrush
int note(char *format,...)
Definition: util.c:12
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
static WCHAR * heap_strndupW(const WCHAR *src, size_t length)
Definition: button.c:262
static const pfThemedPaint btnThemedPaintFunc[MAX_BTN_TYPE]
Definition: button.c:194
#define BUTTON_NSTATES
Definition: button.c:77
#define BUTTON_NOTIFY_PARENT(hWnd, code)
Definition: button.c:85
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
#define BUTTON_BTNPRESSED
Definition: button.c:78
static const WORD maxCheckState[MAX_BTN_TYPE]
Definition: button.c:125
#define MAX_BTN_TYPE
Definition: button.c:123
static void BUTTON_CheckAutoRadioButton(HWND hwnd)
Definition: button.c:1749
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100
#define lstrlenW
Definition: compat.h:750
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HDC
Definition: imagelist.c:88
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define min(a, b)
Definition: monoChain.cc:55
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
_Out_ LPRECT prc
Definition: ntgdi.h:1658
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define BS_USERBUTTON
Definition: pedump.c:659
#define WS_TABSTOP
Definition: pedump.c:634
#define WS_VISIBLE
Definition: pedump.c:620
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
#define BS_OWNERDRAW
Definition: pedump.c:661
#define BS_AUTO3STATE
Definition: pedump.c:657
#define BS_RADIOBUTTON
Definition: pedump.c:655
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define BST_HOT
Definition: commctrl.h:4673
#define TME_LEAVE
Definition: commctrl.h:4986
#define BCM_SETNOTE
Definition: commctrl.h:4664
#define BS_SPLITBUTTON
Definition: commctrl.h:4675
#define BCM_GETNOTE
Definition: commctrl.h:4665
#define BS_DEFCOMMANDLINK
Definition: commctrl.h:4678
#define BCM_GETIDEALSIZE
Definition: commctrl.h:4644
#define BCM_SETIMAGELIST
Definition: commctrl.h:4647
#define BCN_HOTITEMCHANGE
Definition: commctrl.h:260
#define BCM_SETTEXTMARGIN
Definition: commctrl.h:4653
#define WM_MOUSELEAVE
Definition: commctrl.h:4980
#define BS_DEFSPLITBUTTON
Definition: commctrl.h:4676
#define HICF_ENTERING
Definition: commctrl.h:1330
#define BCM_GETNOTELENGTH
Definition: commctrl.h:4666
struct tagTRACKMOUSEEVENT TRACKMOUSEEVENT
#define HICF_LEAVING
Definition: commctrl.h:1331
#define WM_MOUSEHOVER
Definition: commctrl.h:4979
#define TME_QUERY
Definition: commctrl.h:4988
#define BS_COMMANDLINK
Definition: commctrl.h:4677
#define TME_HOVER
Definition: commctrl.h:4985
#define BCM_GETTEXTMARGIN
Definition: commctrl.h:4655
#define BCM_GETIMAGELIST
Definition: commctrl.h:4650
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_NOTIFY
Definition: richedit.h:61
static FILE * client
Definition: client.c:41
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
HIMAGELIST himl
Definition: commctrl.h:4639
WCHAR * note
Definition: button.c:99
HANDLE image
Definition: button.c:105
INT note_length
Definition: button.c:100
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
Definition: tftpd.h:60
UINT_PTR idFrom
Definition: winuser.h:3161
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
PVOID HANDLE
Definition: typedefs.h:73
#define HIWORD(l)
Definition: typedefs.h:247
int ret
LONG_PTR LRESULT
Definition: windef.h:209
#define OPAQUE
Definition: wingdi.h:949
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define WM_PAINT
Definition: winuser.h:1623
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_ERASEBKGND
Definition: winuser.h:1628
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1775
#define BM_GETSTATE
Definition: winuser.h:1923
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
#define IMAGE_BITMAP
Definition: winuser.h:211
#define WM_ENABLE
Definition: winuser.h:1618
#define WM_KEYUP
Definition: winuser.h:1719
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define ODA_DRAWENTIRE
Definition: winuser.h:2545
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BN_DOUBLECLICKED
Definition: winuser.h:1931
#define IMAGE_ICON
Definition: winuser.h:212
#define BN_SETFOCUS
Definition: winuser.h:1936
#define WM_CAPTURECHANGED
Definition: winuser.h:1811
#define WM_CREATE
Definition: winuser.h:1611
#define VK_SPACE
Definition: winuser.h:2222
#define BM_SETSTATE
Definition: winuser.h:1926
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1781
#define ODA_FOCUS
Definition: winuser.h:2547
#define DLGC_UNDEFPUSHBUTTON
Definition: winuser.h:2619
#define WM_NCHITTEST
Definition: winuser.h:1689
#define BN_KILLFOCUS
Definition: winuser.h:1933
#define WM_SETFOCUS
Definition: winuser.h:1616
#define BN_HILITE
Definition: winuser.h:1932
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define RDW_UPDATENOW
Definition: winuser.h:1223
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define BS_NOTIFY
Definition: winuser.h:268
BOOL WINAPI TrackMouseEvent(_Inout_ LPTRACKMOUSEEVENT)
#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 WM_NCCREATE
Definition: winuser.h:1686
#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
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_SETFONT
Definition: winuser.h:1653
#define BM_CLICK
Definition: winuser.h:1920
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define DLGC_WANTARROWS
Definition: winuser.h:2613
#define BST_PUSHED
Definition: winuser.h:201
#define BM_GETIMAGE
Definition: winuser.h:1922
#define RDW_FRAME
Definition: winuser.h:1215
#define BM_SETSTYLE
Definition: winuser.h:1927
#define BST_FOCUS
Definition: winuser.h:200
HDC WINAPI GetDC(_In_opt_ HWND)
#define DLGC_STATIC
Definition: winuser.h:2622
#define WM_LBUTTONUP
Definition: winuser.h:1780
#define WM_NCDESTROY
Definition: winuser.h:1687
#define HTTRANSPARENT
Definition: winuser.h:2476
#define MK_LBUTTON
Definition: winuser.h:2370
#define BN_CLICKED
Definition: winuser.h:1928
#define WM_DESTROY
Definition: winuser.h:1612
#define WM_KEYDOWN
Definition: winuser.h:1718
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define SetWindowLongPtrW
Definition: winuser.h:5358
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define WM_KILLFOCUS
Definition: winuser.h:1617
#define RDW_INVALIDATE
Definition: winuser.h:1217
#define BM_GETCHECK
Definition: winuser.h:1921

Referenced by BUTTON_Register().

◆ CB_Paint()

static void CB_Paint ( const BUTTON_INFO infoPtr,
HDC  hDC,
UINT  action 
)
static

Definition at line 1616 of file button.c.

1617{
1618 RECT rbox, rtext, client;
1619 HBRUSH hBrush;
1620 int delta, text_offset, checkBoxWidth, checkBoxHeight;
1621 UINT dtFlags;
1622 HFONT hFont;
1623 LONG state = infoPtr->state;
1624 LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1625 LONG ex_style = GetWindowLongW( infoPtr->hwnd, GWL_EXSTYLE );
1626 HWND parent;
1627 HRGN hrgn;
1628
1629 if (style & BS_PUSHLIKE)
1630 {
1631 PB_Paint( infoPtr, hDC, action );
1632 return;
1633 }
1634
1635 GetClientRect(infoPtr->hwnd, &client);
1636 rbox = rtext = client;
1637
1638 checkBoxWidth = 12 * GetDeviceCaps( hDC, LOGPIXELSX ) / 96 + 1;
1639 checkBoxHeight = 12 * GetDeviceCaps( hDC, LOGPIXELSY ) / 96 + 1;
1640
1641 if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1642 GetCharWidthW( hDC, '0', '0', &text_offset );
1643 text_offset /= 2;
1644
1645 parent = GetParent(infoPtr->hwnd);
1646 if (!parent) parent = infoPtr->hwnd;
1647 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1648 if (!hBrush) /* did the app forget to call defwindowproc ? */
1649 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1651
1652 if (style & BS_LEFTTEXT || ex_style & WS_EX_RIGHT)
1653 {
1654 rtext.right -= checkBoxWidth + text_offset;
1655 rbox.left = rbox.right - checkBoxWidth;
1656 }
1657 else
1658 {
1659 rtext.left += checkBoxWidth + text_offset;
1660 rbox.right = checkBoxWidth;
1661 }
1662
1663 /* Since WM_ERASEBKGND does nothing, first prepare background */
1664 if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
1665 if (action == ODA_DRAWENTIRE) FillRect( hDC, &client, hBrush );
1666
1667 /* Draw label */
1668 client = rtext;
1669 dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &rtext);
1670
1671 /* Only adjust rbox when rtext is valid */
1672 if (dtFlags != (UINT)-1L)
1673 {
1674 rbox.top = rtext.top;
1675 rbox.bottom = rtext.bottom;
1676 }
1677
1678 /* Draw the check-box bitmap */
1680 {
1681 UINT flags;
1682
1686 else flags = DFCS_BUTTONCHECK;
1687
1690
1692
1693 /* rbox must have the correct height */
1694 delta = rbox.bottom - rbox.top - checkBoxHeight;
1695
1696 if (style & BS_TOP) {
1697 if (delta > 0) {
1698 rbox.bottom = rbox.top + checkBoxHeight;
1699 } else {
1700 rbox.top -= -delta/2 + 1;
1701 rbox.bottom = rbox.top + checkBoxHeight;
1702 }
1703 } else if (style & BS_BOTTOM) {
1704 if (delta > 0) {
1705 rbox.top = rbox.bottom - checkBoxHeight;
1706 } else {
1707 rbox.bottom += -delta/2 + 1;
1708 rbox.top = rbox.bottom - checkBoxHeight;
1709 }
1710 } else { /* Default */
1711 if (delta > 0) {
1712 int ofs = (delta / 2);
1713 rbox.bottom -= ofs + 1;
1714 rbox.top = rbox.bottom - checkBoxHeight;
1715 } else if (delta < 0) {
1716 int ofs = (-delta / 2);
1717 rbox.top -= ofs + 1;
1718 rbox.bottom = rbox.top + checkBoxHeight;
1719 }
1720 }
1721
1723 }
1724
1725 if (dtFlags == (UINT)-1L) /* Noting to draw */
1726 return;
1727
1728 if (action == ODA_DRAWENTIRE)
1729 BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &rtext);
1730
1731 /* ... and focus */
1732 if (action == ODA_FOCUS || (state & BST_FOCUS))
1733 {
1734 rtext.left--;
1735 rtext.right++;
1736 IntersectRect(&rtext, &rtext, &client);
1737 DrawFocusRect( hDC, &rtext );
1738 }
1740 if (hrgn) DeleteObject( hrgn );
1741}
static HDC hDC
Definition: 3dtext.c:33
static HRGN hrgn
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:242
static void BUTTON_DrawLabel(const BUTTON_INFO *infoPtr, HDC hdc, UINT dtFlags, const RECT *rc)
Definition: button.c:1425
static void PB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1493
const WCHAR * action
Definition: action.c:7479
#define BS_LEFTTEXT
Definition: pedump.c:662
#define WS_DISABLED
Definition: pedump.c:621
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
#define LOGPIXELSX
Definition: wingdi.h:718
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_BUTTONCHECK
Definition: winuser.h:496
#define DFCS_INACTIVE
Definition: winuser.h:502
#define DFC_BUTTON
Definition: winuser.h:476
#define DFCS_BUTTON3STATE
Definition: winuser.h:500
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define DFCS_BUTTONRADIO
Definition: winuser.h:499
#define ODA_SELECT
Definition: winuser.h:2546
#define DFCS_CHECKED
Definition: winuser.h:504
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define DFCS_PUSHED
Definition: winuser.h:503

◆ CB_ThemedPaint()

static void CB_ThemedPaint ( HTHEME  theme,
const BUTTON_INFO infoPtr,
HDC  hdc,
ButtonState  drawState,
UINT  dtflags,
BOOL  focused 
)
static

Definition at line 1997 of file button.c.

1999{
2000 static const int cb_states[3][5] =
2001 {
2005 };
2006
2007 static const int rb_states[2][5] =
2008 {
2011 };
2012
2013 SIZE sz;
2014 RECT bgRect, textRect;
2015 HFONT font, hPrevFont = NULL;
2016 int checkState = infoPtr->state & 3;
2017 DWORD dwStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
2018 UINT btn_type = get_button_type( dwStyle );
2019 int part = (btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON) ? BP_RADIOBUTTON : BP_CHECKBOX;
2020 int state = (part == BP_CHECKBOX)
2021 ? cb_states[ checkState ][ drawState ]
2022 : rb_states[ checkState ][ drawState ];
2023 WCHAR *text = get_button_text(infoPtr);
2024 LOGFONTW lf;
2025 BOOL created_font = FALSE;
2026#ifdef __REACTOS__
2027 HWND parent;
2028 HBRUSH hBrush;
2029 DWORD cdrf;
2030#endif
2031
2032 HRESULT hr = GetThemeFont(theme, hDC, part, state, TMT_FONT, &lf);
2033 if (SUCCEEDED(hr)) {
2035 if (!font)
2036 TRACE("Failed to create font\n");
2037 else {
2038 TRACE("font = %s\n", debugstr_w(lf.lfFaceName));
2039 hPrevFont = SelectObject(hDC, font);
2040 created_font = TRUE;
2041 }
2042 } else {
2043#ifdef __REACTOS__ /* r73885 */
2044 font = infoPtr->font;
2045#else
2046 font = (HFONT)SendMessageW(infoPtr->hwnd, WM_GETFONT, 0, 0);
2047#endif
2048 hPrevFont = SelectObject(hDC, font);
2049 }
2050
2051 if (FAILED(GetThemePartSize(theme, hDC, part, state, NULL, TS_DRAW, &sz)))
2052 sz.cx = sz.cy = 13;
2053
2054 GetClientRect(infoPtr->hwnd, &bgRect);
2055
2056#ifdef __REACTOS__
2057 if (prfFlag == 0)
2058 {
2060 }
2061
2062 parent = GetParent(infoPtr->hwnd);
2063 if (!parent) parent = infoPtr->hwnd;
2064 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
2065 (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
2066 if (!hBrush) /* did the app forget to call defwindowproc ? */
2067 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
2068 (WPARAM)hDC, (LPARAM)infoPtr->hwnd );
2069 FillRect( hDC, &bgRect, hBrush );
2070
2071 cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &bgRect);
2072 if (cdrf == CDRF_SKIPDEFAULT)
2073 goto cleanup;
2074#endif
2075
2076 GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &textRect);
2077
2078 if (dtFlags & DT_SINGLELINE) /* Center the checkbox / radio button to the text. */
2079 bgRect.top = bgRect.top + (textRect.bottom - textRect.top - sz.cy) / 2;
2080
2081 /* adjust for the check/radio marker */
2082 bgRect.bottom = bgRect.top + sz.cy;
2083 bgRect.right = bgRect.left + sz.cx;
2084 textRect.left = bgRect.right + 6;
2085
2086#ifdef __REACTOS__
2087 DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
2088
2089 if (cdrf == CDRF_NOTIFYPOSTERASE)
2090 BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &bgRect);
2091
2092 cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &bgRect);
2093 if (cdrf == CDRF_SKIPDEFAULT)
2094 goto cleanup;
2095
2096#else
2098 DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
2099#endif
2100 if (text)
2101 {
2102 DrawThemeText(theme, hDC, part, state, text, lstrlenW(text), dtFlags, 0, &textRect);
2103
2104 if (focused)
2105 {
2106 RECT focusRect;
2107
2108 focusRect = textRect;
2109
2110 DrawTextW(hDC, text, lstrlenW(text), &focusRect, dtFlags | DT_CALCRECT);
2111
2112 if (focusRect.right < textRect.right) focusRect.right++;
2113 focusRect.bottom = textRect.bottom;
2114
2115 DrawFocusRect( hDC, &focusRect );
2116 }
2117
2118 heap_free(text);
2119#ifdef __REACTOS__
2120 text = NULL;
2121#endif
2122 }
2123
2124#ifdef __REACTOS__
2125 if (cdrf == CDRF_NOTIFYPOSTPAINT)
2126 BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
2127cleanup:
2128 if (text) heap_free(text);
2129#endif
2130 if (created_font) DeleteObject(font);
2131 if (hPrevFont) SelectObject(hDC, hPrevFont);
2132}
static void cleanup(void)
Definition: main.c:1335
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
HRESULT WINAPI GetThemePartSize(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, THEMESIZE eSize, SIZE *psz)
Definition: draw.c:1821
HRESULT WINAPI DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect)
Definition: draw.c:1500
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect)
Definition: draw.c:1523
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, LOGFONTW *pFont)
Definition: property.c:108
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_w
Definition: kernel32.h:32
Definition: mk_font.cpp:20
#define CDRF_NOTIFYPOSTERASE
Definition: commctrl.h:277
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define CDDS_POSTERASE
Definition: commctrl.h:283
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define CDDS_POSTPAINT
Definition: commctrl.h:281
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:270
#define CDDS_PREERASE
Definition: commctrl.h:282
HRESULT hr
Definition: shlfolder.c:183
RECT textRect
Definition: startmenu.cpp:1392
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
#define CBS_UNCHECKEDNORMAL
Definition: treelist.c:148
#define CBS_CHECKEDNORMAL
Definition: treelist.c:151
#define BP_CHECKBOX
Definition: treelist.c:145
@ CBS_CHECKEDDISABLED
Definition: vsstyle.h:113
@ CBS_UNCHECKEDDISABLED
Definition: vsstyle.h:109
@ CBS_UNCHECKEDHOT
Definition: vsstyle.h:107
@ CBS_MIXEDPRESSED
Definition: vsstyle.h:116
@ CBS_MIXEDNORMAL
Definition: vsstyle.h:114
@ CBS_UNCHECKEDPRESSED
Definition: vsstyle.h:108
@ CBS_CHECKEDPRESSED
Definition: vsstyle.h:112
@ CBS_CHECKEDHOT
Definition: vsstyle.h:111
@ CBS_MIXEDDISABLED
Definition: vsstyle.h:117
@ CBS_MIXEDHOT
Definition: vsstyle.h:115
@ BP_RADIOBUTTON
Definition: vsstyle.h:75
@ RBS_UNCHECKEDHOT
Definition: vsstyle.h:96
@ RBS_CHECKEDPRESSED
Definition: vsstyle.h:101
@ RBS_CHECKEDHOT
Definition: vsstyle.h:100
@ RBS_UNCHECKEDNORMAL
Definition: vsstyle.h:95
@ RBS_CHECKEDDISABLED
Definition: vsstyle.h:102
@ RBS_UNCHECKEDDISABLED
Definition: vsstyle.h:98
@ RBS_CHECKEDNORMAL
Definition: vsstyle.h:99
@ RBS_UNCHECKEDPRESSED
Definition: vsstyle.h:97
#define TMT_FONT
Definition: vssym32.h:144
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)

◆ GB_Paint()

static void GB_Paint ( const BUTTON_INFO infoPtr,
HDC  hDC,
UINT  action 
)
static

Definition at line 1780 of file button.c.

1781{
1782 RECT rc, rcFrame;
1783 HBRUSH hbr;
1784 HFONT hFont;
1785 UINT dtFlags;
1787 LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1788 HWND parent;
1789 HRGN hrgn;
1790
1791 if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1792 /* GroupBox acts like static control, so it sends CTLCOLORSTATIC */
1793 parent = GetParent(infoPtr->hwnd);
1794 if (!parent) parent = infoPtr->hwnd;
1795 hbr = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1796 if (!hbr) /* did the app forget to call defwindowproc ? */
1797 hbr = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1798 GetClientRect( infoPtr->hwnd, &rc);
1799 rcFrame = rc;
1800 hrgn = set_control_clipping( hDC, &rc );
1801
1803 rcFrame.top += (tm.tmHeight / 2) - 1;
1804 DrawEdge (hDC, &rcFrame, EDGE_ETCHED, BF_RECT | ((style & BS_FLAT) ? BF_FLAT : 0));
1805
1806 InflateRect(&rc, -7, 1);
1807 dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &rc);
1808
1809 if (dtFlags != (UINT)-1)
1810 {
1811 /* Because buttons have CS_PARENTDC class style, there is a chance
1812 * that label will be drawn out of client rect.
1813 * But Windows doesn't clip label's rect, so do I.
1814 */
1815
1816 /* There is 1-pixel margin at the left, right, and bottom */
1817 rc.left--; rc.right++; rc.bottom++;
1818 FillRect(hDC, &rc, hbr);
1819 rc.left++; rc.right--; rc.bottom--;
1820
1821 BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &rc);
1822 }
1824 if (hrgn) DeleteObject( hrgn );
1825}
Definition: time.h:68
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
#define EDGE_ETCHED
Definition: winuser.h:452
#define BF_FLAT
Definition: winuser.h:471
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BS_FLAT
Definition: winuser.h:280
#define BF_RECT
Definition: winuser.h:462

◆ GB_ThemedPaint()

static void GB_ThemedPaint ( HTHEME  theme,
const BUTTON_INFO infoPtr,
HDC  hdc,
ButtonState  drawState,
UINT  dtflags,
BOOL  focused 
)
static

Definition at line 2137 of file button.c.

2139{
2140 static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };
2141
2142 RECT bgRect, textRect, contentRect;
2143 int state = states[ drawState ];
2144 WCHAR *text = get_button_text(infoPtr);
2145 LOGFONTW lf;
2146 HFONT font, hPrevFont = NULL;
2147 BOOL created_font = FALSE;
2148#ifdef __REACTOS__ /* r74406 */
2149 HWND parent;
2150 HBRUSH hBrush;
2151 RECT clientRect;
2152#endif
2153
2155 if (SUCCEEDED(hr)) {
2157 if (!font)
2158 TRACE("Failed to create font\n");
2159 else {
2160 hPrevFont = SelectObject(hDC, font);
2161 created_font = TRUE;
2162 }
2163 } else {
2164#ifdef __REACTOS__ /* r73885 */
2165 font = infoPtr->font;
2166#else
2167 font = (HFONT)SendMessageW(infoPtr->hwnd, WM_GETFONT, 0, 0);
2168#endif
2169 hPrevFont = SelectObject(hDC, font);
2170 }
2171
2172 GetClientRect(infoPtr->hwnd, &bgRect);
2173 textRect = bgRect;
2174
2175 if (text)
2176 {
2177 SIZE textExtent;
2178 GetTextExtentPoint32W(hDC, text, lstrlenW(text), &textExtent);
2179 bgRect.top += (textExtent.cy / 2);
2180 textRect.left += 10;
2181 textRect.bottom = textRect.top + textExtent.cy;
2182 textRect.right = textRect.left + textExtent.cx + 4;
2183
2185 }
2186
2187 GetThemeBackgroundContentRect(theme, hDC, BP_GROUPBOX, state, &bgRect, &contentRect);
2188 ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom);
2189
2190#ifdef __REACTOS__ /* r73885 & r74149 */
2191 if (prfFlag == 0)
2192#endif
2195
2196#ifdef __REACTOS__ /* r74406 */
2197 parent = GetParent(infoPtr->hwnd);
2198 if (!parent) parent = infoPtr->hwnd;
2199 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
2200 (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
2201 if (!hBrush) /* did the app forget to call defwindowproc ? */
2202 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
2203 (WPARAM)hDC, (LPARAM)infoPtr->hwnd );
2204 GetClientRect(infoPtr->hwnd, &clientRect);
2205 FillRect( hDC, &clientRect, hBrush );
2206#endif
2207
2208 DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);
2209
2211
2212 if (text)
2213 {
2214 InflateRect(&textRect, -2, 0);
2216 heap_free(text);
2217 }
2218
2219 if (created_font) DeleteObject(font);
2220 if (hPrevFont) SelectObject(hDC, hPrevFont);
2221}
BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
Definition: draw.c:1927
@ BP_GROUPBOX
Definition: vsstyle.h:77
@ GBS_NORMAL
Definition: vsstyle.h:129
@ GBS_DISABLED
Definition: vsstyle.h:130
int WINAPI ExcludeClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

◆ get_button_text()

static WCHAR * get_button_text ( const BUTTON_INFO infoPtr)
inlinestatic

Definition at line 233 of file button.c.

234{
235 INT len = GetWindowTextLengthW( infoPtr->hwnd );
236 WCHAR *buffer = heap_alloc( (len + 1) * sizeof(WCHAR) );
237 if (buffer)
238 GetWindowTextW( infoPtr->hwnd, buffer, len + 1 );
239 return buffer;
240}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
GLenum GLsizei len
Definition: glext.h:6722
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1384
int WINAPI GetWindowTextLengthW(_In_ HWND)

Referenced by BUTTON_CalcLabelRect(), BUTTON_DrawLabel(), CB_ThemedPaint(), GB_ThemedPaint(), and PB_ThemedPaint().

◆ get_button_type()

static UINT get_button_type ( LONG  window_style)
inlinestatic

Definition at line 214 of file button.c.

215{
216 return (window_style & BS_TYPEMASK);
217}

Referenced by BUTTON_BStoDT(), BUTTON_WindowProc(), ButtonWndProc_common(), CB_Paint(), CB_ThemedPaint(), and PB_Paint().

◆ heap_strndupW()

static WCHAR * heap_strndupW ( const WCHAR src,
size_t  length 
)
static

◆ OB_Paint()

static void OB_Paint ( const BUTTON_INFO infoPtr,
HDC  hDC,
UINT  action 
)
static

Definition at line 1874 of file button.c.

1875{
1876 LONG state = infoPtr->state;
1877 DRAWITEMSTRUCT dis;
1878 LONG_PTR id = GetWindowLongPtrW( infoPtr->hwnd, GWLP_ID );
1879 HWND parent;
1880 HFONT hFont;
1881 HRGN hrgn;
1882
1883 dis.CtlType = ODT_BUTTON;
1884 dis.CtlID = id;
1885 dis.itemID = 0;
1886 dis.itemAction = action;
1887 dis.itemState = ((state & BST_FOCUS) ? ODS_FOCUS : 0) |
1888 ((state & BST_PUSHED) ? ODS_SELECTED : 0) |
1889 (IsWindowEnabled(infoPtr->hwnd) ? 0: ODS_DISABLED);
1890 dis.hwndItem = infoPtr->hwnd;
1891 dis.hDC = hDC;
1892 dis.itemData = 0;
1893 GetClientRect( infoPtr->hwnd, &dis.rcItem );
1894
1895 if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1896 parent = GetParent(infoPtr->hwnd);
1897 if (!parent) parent = infoPtr->hwnd;
1899
1901
1902 SendMessageW( GetParent(infoPtr->hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
1904 if (hrgn) DeleteObject( hrgn );
1905}
GLuint id
Definition: glext.h:5910
ULONG_PTR itemData
Definition: winuser.h:3096
#define ODS_DISABLED
Definition: winuser.h:2550
#define ODS_SELECTED
Definition: winuser.h:2548
#define WM_DRAWITEM
Definition: winuser.h:1648
#define ODT_BUTTON
Definition: winuser.h:2543
#define ODS_FOCUS
Definition: winuser.h:2552

◆ paint_button()

static void paint_button ( BUTTON_INFO infoPtr,
LONG  style,
UINT  action 
)
inlinestatic

Definition at line 221 of file button.c.

222{
223 if (btnPaintFunc[style] && IsWindowVisible(infoPtr->hwnd))
224 {
225 HDC hdc = GetDC( infoPtr->hwnd );
226 btnPaintFunc[style]( infoPtr, hdc, action );
227 ReleaseDC( infoPtr->hwnd, hdc );
228 }
229}

Referenced by BUTTON_WindowProc(), and ButtonWndProc_common().

◆ PB_Paint()

static void PB_Paint ( const BUTTON_INFO infoPtr,
HDC  hDC,
UINT  action 
)
static

Definition at line 1493 of file button.c.

1494{
1495 RECT rc, r;
1496 UINT dtFlags, uState;
1497 HPEN hOldPen, hpen;
1498 HBRUSH hOldBrush;
1499 INT oldBkMode;
1500 COLORREF oldTxtColor;
1501 HFONT hFont;
1502 LONG state = infoPtr->state;
1503 LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1504 BOOL pushedState = (state & BST_PUSHED);
1505 HWND parent;
1506 HRGN hrgn;
1507#ifdef __REACTOS__
1508 DWORD cdrf;
1509#endif
1510
1511 GetClientRect( infoPtr->hwnd, &rc );
1512
1513 /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
1514 if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1515 parent = GetParent(infoPtr->hwnd);
1516 if (!parent) parent = infoPtr->hwnd;
1518
1519 hrgn = set_control_clipping( hDC, &rc );
1520
1522 hOldPen = SelectObject(hDC, hpen);
1524 oldBkMode = SetBkMode(hDC, TRANSPARENT);
1525
1526#ifdef __REACTOS__
1527 cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &rc);
1528 if (cdrf == CDRF_SKIPDEFAULT)
1529 goto cleanup;
1530#endif
1531
1533 {
1534 if (action != ODA_FOCUS)
1535 Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
1536 InflateRect( &rc, -1, -1 );
1537 }
1538
1539 /* completely skip the drawing if only focus has changed */
1540 if (action == ODA_FOCUS) goto draw_focus;
1541
1542 uState = DFCS_BUTTONPUSH;
1543
1544 if (style & BS_FLAT)
1545 uState |= DFCS_MONO;
1546 else if (pushedState)
1547 {
1549 uState |= DFCS_FLAT;
1550 else
1551 uState |= DFCS_PUSHED;
1552 }
1553
1555 uState |= DFCS_CHECKED;
1556
1557 DrawFrameControl( hDC, &rc, DFC_BUTTON, uState );
1558
1559#ifdef __REACTOS__
1560 if (cdrf == CDRF_NOTIFYPOSTERASE)
1561 BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &rc);
1562
1563 cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &rc);
1564 if (cdrf == CDRF_SKIPDEFAULT)
1565 goto cleanup;
1566#endif
1567
1568 /* draw button label */
1569 r = rc;
1570 dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &r);
1571
1572 if (dtFlags == (UINT)-1L)
1573 goto cleanup;
1574
1575 if (pushedState)
1576 OffsetRect(&r, 1, 1);
1577
1578 oldTxtColor = SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) );
1579
1580 BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &r);
1581
1582 SetTextColor( hDC, oldTxtColor );
1583
1584#ifdef __REACTOS__
1585 if (cdrf == CDRF_NOTIFYPOSTPAINT)
1586 BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &rc);
1587#endif
1588
1589draw_focus:
1590 if (action == ODA_FOCUS || (state & BST_FOCUS))
1591 {
1592#ifdef __REACTOS__
1593 if (!(infoPtr->ui_state & UISF_HIDEFOCUS))
1594 {
1595#endif
1596 InflateRect( &rc, -2, -2 );
1597 DrawFocusRect( hDC, &rc );
1598#ifdef __REACTOS__
1599 }
1600#endif
1601 }
1602
1603 cleanup:
1604 SelectObject( hDC, hOldPen );
1605 SelectObject( hDC, hOldBrush );
1606 SetBkMode(hDC, oldBkMode);
1608 if (hrgn) DeleteObject( hrgn );
1609 DeleteObject( hpen );
1610}
static HPEN hpen
DWORD COLORREF
Definition: windef.h:300
#define TRANSPARENT
Definition: wingdi.h:950
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define PS_SOLID
Definition: wingdi.h:586
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_BTNTEXT
Definition: winuser.h:936
#define COLOR_WINDOWFRAME
Definition: winuser.h:922
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
#define DFCS_FLAT
Definition: winuser.h:510
#define DFCS_MONO
Definition: winuser.h:511
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define COLOR_BTNFACE
Definition: winuser.h:931

Referenced by CB_Paint().

◆ PB_ThemedPaint()

static void PB_ThemedPaint ( HTHEME  theme,
const BUTTON_INFO infoPtr,
HDC  hdc,
ButtonState  drawState,
UINT  dtflags,
BOOL  focused 
)
static

Definition at line 1910 of file button.c.

1912{
1913 static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED };
1914
1915 RECT bgRect, textRect;
1916 HFONT font = infoPtr->font;
1917 HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
1918 int state = states[ drawState ];
1919 WCHAR *text = get_button_text(infoPtr);
1920#ifdef __REACTOS__
1921 HWND parent;
1922 DWORD cdrf;
1923
1924 GetClientRect(infoPtr->hwnd, &bgRect);
1926
1927 if (prfFlag == 0)
1928 {
1931 }
1932
1933 parent = GetParent(infoPtr->hwnd);
1934 if (!parent) parent = infoPtr->hwnd;
1936
1937 cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &bgRect);
1938 if (cdrf == CDRF_SKIPDEFAULT)
1939 goto cleanup;
1940
1941 DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
1942
1943 if (cdrf == CDRF_NOTIFYPOSTERASE)
1944 BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &bgRect);
1945
1946 cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &bgRect);
1947 if (cdrf == CDRF_SKIPDEFAULT)
1948 goto cleanup;
1949
1950 BUTTON_DrawIml(hDC, &infoPtr->imlData, &textRect, FALSE, drawState);
1951#else
1952 GetClientRect(infoPtr->hwnd, &bgRect);
1954
1957
1958 DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
1959#endif
1960
1961 if (text)
1962 {
1963 DrawThemeText(theme, hDC, BP_PUSHBUTTON, state, text, lstrlenW(text), dtFlags, 0, &textRect);
1964 heap_free(text);
1965#ifdef __REACTOS__
1966 text = NULL;
1967#endif
1968 }
1969
1970 if (focused)
1971 {
1973 RECT focusRect = bgRect;
1974
1976
1977 focusRect.left += margins.cxLeftWidth;
1978 focusRect.top += margins.cyTopHeight;
1979 focusRect.right -= margins.cxRightWidth;
1980 focusRect.bottom -= margins.cyBottomHeight;
1981
1982 DrawFocusRect( hDC, &focusRect );
1983 }
1984
1985#ifdef __REACTOS__
1986 if (cdrf == CDRF_NOTIFYPOSTPAINT)
1987 BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
1988cleanup:
1989 if (text) heap_free(text);
1990#endif
1991 if (hPrevFont) SelectObject(hDC, hPrevFont);
1992}
static RECT margins
Definition: print.c:55
HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, RECT *prc, MARGINS *pMargins)
Definition: property.c:216
Definition: misc.c:279
@ PBS_DISABLED
Definition: vsstyle.h:89
@ PBS_PRESSED
Definition: vsstyle.h:88
@ PBS_NORMAL
Definition: vsstyle.h:86
@ PBS_HOT
Definition: vsstyle.h:87
@ PBS_DEFAULTED
Definition: vsstyle.h:90
@ BP_PUSHBUTTON
Definition: vsstyle.h:74
#define TMT_CONTENTMARGINS
Definition: vssym32.h:324

◆ set_control_clipping()

HRGN set_control_clipping ( HDC  hdc,
const RECT rect 
)

Definition at line 242 of file button.c.

243{
244 RECT rc = *rect;
245 HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
246
247 if (GetClipRgn( hdc, hrgn ) != 1)
248 {
250 hrgn = 0;
251 }
252 DPtoLP( hdc, (POINT *)&rc, 2 );
253 if (GetLayout( hdc ) & LAYOUT_RTL) /* compensate for the shifting done by IntersectClipRect */
254 {
255 rc.left++;
256 rc.right++;
257 }
258 IntersectClipRect( hdc, rc.left, rc.top, rc.right, rc.bottom );
259 return hrgn;
260}
DWORD WINAPI GetLayout(_In_ HDC hdc)
Definition: coord.c:750
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI DPtoLP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define LAYOUT_RTL
Definition: wingdi.h:1371

Referenced by CB_Paint(), CBPaintText(), GB_Paint(), LISTBOX_PaintItem(), OB_Paint(), PB_Paint(), STATIC_TryPaintFcn(), STATIC_WindowProc(), and StaticWndProc_common().

◆ UB_Paint()

static void UB_Paint ( const BUTTON_INFO infoPtr,
HDC  hDC,
UINT  action 
)
static

Definition at line 1832 of file button.c.

1833{
1834 RECT rc;
1835 HBRUSH hBrush;
1836 HFONT hFont;
1837 LONG state = infoPtr->state;
1838 HWND parent;
1839
1840 GetClientRect( infoPtr->hwnd, &rc);
1841
1842 if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1843
1844 parent = GetParent(infoPtr->hwnd);
1845 if (!parent) parent = infoPtr->hwnd;
1846 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1847 if (!hBrush) /* did the app forget to call defwindowproc ? */
1848 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1849
1850 FillRect( hDC, &rc, hBrush );
1851 if (action == ODA_FOCUS || (state & BST_FOCUS))
1852 DrawFocusRect( hDC, &rc );
1853
1854 switch (action)
1855 {
1856 case ODA_FOCUS:
1858 break;
1859
1860 case ODA_SELECT:
1862 break;
1863
1864 default:
1865 break;
1866 }
1867}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( button  )

Variable Documentation

◆ btnPaintFunc

const pfPaint btnPaintFunc[MAX_BTN_TYPE]
static
Initial value:
=
{
NULL,
}
static void GB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1780
static void CB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1616
static void UB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1832
static void OB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1874

Definition at line 157 of file button.c.

Referenced by BUTTON_WindowProc(), ButtonWndProc_common(), and paint_button().

◆ btnThemedPaintFunc

const pfThemedPaint btnThemedPaintFunc[MAX_BTN_TYPE]
static
Initial value:
=
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}
static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)
Definition: button.c:2137
static void CB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)
Definition: button.c:1997
static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)
Definition: button.c:1910

Definition at line 194 of file button.c.

Referenced by BUTTON_WindowProc().

◆ maxCheckState