ReactOS 0.4.17-dev-683-g0dafdc5
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
LONG_PTR LPARAM
Definition: minwindef.h:175
Definition: inflate.c:139
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define WM_COMMAND
Definition: winuser.h:1768
HWND WINAPI GetParent(_In_ HWND)
#define GWLP_ID
Definition: winuser.h:871

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: sysinfo.c:13
#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 1282 of file button.c.

1283{
1284 LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1285 LONG ex_style = GetWindowLongW( infoPtr->hwnd, GWL_EXSTYLE );
1286 WCHAR *text;
1287 ICONINFO iconInfo;
1288 BITMAP bm;
1289 UINT dtStyle = BUTTON_BStoDT( style, ex_style );
1290 RECT r = *rc;
1291 INT n;
1292#ifdef __REACTOS__
1293 BOOL bHasIml = BUTTON_DrawIml(hdc, &infoPtr->imlData, &r, TRUE, 0);
1294#endif
1295
1296 /* Calculate label rectangle according to label type */
1297 switch (style & (BS_ICON|BS_BITMAP))
1298 {
1299 case BS_TEXT:
1300 {
1301 HFONT hFont, hPrevFont = 0;
1302
1303 if (!(text = get_button_text( infoPtr ))) goto empty_rect;
1304 if (!text[0])
1305 {
1306 heap_free( text );
1307 goto empty_rect;
1308 }
1309
1310 if ((hFont = infoPtr->font)) hPrevFont = SelectObject( hdc, hFont );
1311#ifdef __REACTOS__
1312 DrawTextW(hdc, text, -1, &r, ((dtStyle | DT_CALCRECT) & ~(DT_VCENTER | DT_BOTTOM)));
1313#else
1314 DrawTextW(hdc, text, -1, &r, dtStyle | DT_CALCRECT);
1315#endif
1316 if (hPrevFont) SelectObject( hdc, hPrevFont );
1317 heap_free( text );
1318#ifdef __REACTOS__
1319 if (infoPtr->ui_state & UISF_HIDEACCEL)
1320 dtStyle |= DT_HIDEPREFIX;
1321#endif
1322 break;
1323 }
1324
1325 case BS_ICON:
1326 if (!GetIconInfo(infoPtr->u.icon, &iconInfo))
1327 goto empty_rect;
1328
1329 GetObjectW (iconInfo.hbmColor, sizeof(BITMAP), &bm);
1330
1331 r.right = r.left + bm.bmWidth;
1332 r.bottom = r.top + bm.bmHeight;
1333
1334 DeleteObject(iconInfo.hbmColor);
1335 DeleteObject(iconInfo.hbmMask);
1336 break;
1337
1338 case BS_BITMAP:
1339 if (!GetObjectW( infoPtr->u.bitmap, sizeof(BITMAP), &bm))
1340 goto empty_rect;
1341
1342 r.right = r.left + bm.bmWidth;
1343 r.bottom = r.top + bm.bmHeight;
1344 break;
1345
1346 default:
1347 empty_rect:
1348#ifdef __REACTOS__
1349 if (bHasIml)
1350 break;
1351#endif
1352 rc->right = r.left;
1353 rc->bottom = r.top;
1354 return (UINT)-1;
1355 }
1356
1357#ifdef __REACTOS__
1358 if (bHasIml)
1359 {
1360 if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_LEFT)
1361 r.left = infoPtr->imlData.margin.left;
1362 else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_RIGHT)
1363 r.right = infoPtr->imlData.margin.right;
1364 else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_TOP)
1365 r.top = infoPtr->imlData.margin.top;
1366 else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_BOTTOM)
1367 r.bottom = infoPtr->imlData.margin.bottom;
1368 }
1369#endif
1370
1371 /* Position label inside bounding rectangle according to
1372 * alignment flags. (calculated rect is always left-top aligned).
1373 * If label is aligned to any side - shift label in opposite
1374 * direction to leave extra space for focus rectangle.
1375 */
1376 switch (dtStyle & (DT_CENTER|DT_RIGHT))
1377 {
1378 case DT_LEFT: r.left++; r.right++; break;
1379 case DT_CENTER: n = r.right - r.left;
1380 r.left = rc->left + ((rc->right - rc->left) - n) / 2;
1381 r.right = r.left + n; break;
1382 case DT_RIGHT: n = r.right - r.left;
1383 r.right = rc->right - 1;
1384 r.left = r.right - n;
1385 break;
1386 }
1387
1388 switch (dtStyle & (DT_VCENTER|DT_BOTTOM))
1389 {
1390 case DT_TOP: r.top++; r.bottom++; break;
1391 case DT_VCENTER: n = r.bottom - r.top;
1392#ifdef __REACTOS__
1393 r.top = rc->top + ((rc->bottom - 1 - rc->top) - n) / 2;
1394#else
1395 r.top = rc->top + ((rc->bottom - rc->top) - n) / 2;
1396#endif
1397 r.bottom = r.top + n; break;
1398 case DT_BOTTOM: n = r.bottom - r.top;
1399 r.bottom = rc->bottom - 1;
1400 r.top = r.bottom - n;
1401 break;
1402 }
1403
1404 *rc = r;
1405 return dtStyle;
1406}
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:1794
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
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
short WCHAR
Definition: pedump.c:58
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
HBITMAP bitmap
Definition: button.c:104
HWND hwnd
Definition: button.c:95
HICON icon
Definition: button.c:103
HFONT font
Definition: button.c:98
union _BUTTON_INFO::@331 u
HBITMAP hbmColor
Definition: winuser.h:3235
HBITMAP hbmMask
Definition: winuser.h:3234
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
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:2414
#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:863
#define GWL_EXSTYLE
Definition: winuser.h:862

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 1753 of file button.c.

1754{
1755 HWND parent, sibling, start;
1756
1758 /* make sure that starting control is not disabled or invisible */
1759#ifdef __REACTOS__
1760 start = sibling = hwnd;
1761#else
1762 start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
1763#endif
1764 do
1765 {
1766 if (!sibling) break;
1767#ifdef __REACTOS__
1769 SendMessageW( sibling, BM_SETCHECK, sibling == hwnd ? BST_CHECKED : BST_UNCHECKED, 0 );
1770#else
1771 if ((hwnd != sibling) &&
1773 SendMessageW( sibling, BM_SETCHECK, BST_UNCHECKED, 0 );
1774#endif
1775 sibling = GetNextDlgGroupItem( parent, sibling, FALSE );
1776 } while (sibling != start);
1777}
#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:2662
#define BST_UNCHECKED
Definition: winuser.h:199
#define BS_TYPEMASK
Definition: winuser.h:270
#define BM_SETCHECK
Definition: winuser.h:1950
HWND WINAPI GetNextDlgGroupItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
#define DLGC_RADIOBUTTON
Definition: winuser.h:2659
#define WM_GETDLGCODE
Definition: winuser.h:1717
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 1429 of file button.c.

1430{
1431 DRAWSTATEPROC lpOutputProc = NULL;
1432 LPARAM lp;
1433 WPARAM wp = 0;
1434 HBRUSH hbr = 0;
1436 LONG state = infoPtr->state;
1437 LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1438 WCHAR *text = NULL;
1439
1440 /* FIXME: To draw disabled label in Win31 look-and-feel, we probably
1441 * must use DSS_MONO flag and COLOR_GRAYTEXT brush (or maybe DSS_UNION).
1442 * I don't have Win31 on hand to verify that, so I leave it as is.
1443 */
1444
1445#ifdef __REACTOS__
1446 RECT rcText = *rc;
1447 BUTTON_DrawIml(hdc, &infoPtr->imlData, &rcText, FALSE, 0);
1448#endif
1449
1451 {
1453 flags |= DSS_MONO;
1454 }
1455
1456 switch (style & (BS_ICON|BS_BITMAP))
1457 {
1458 case BS_TEXT:
1459 /* DST_COMPLEX -- is 0 */
1460 lpOutputProc = BUTTON_DrawTextCallback;
1461 if (!(text = get_button_text( infoPtr ))) return;
1462 lp = (LPARAM)text;
1463 wp = dtFlags;
1464#ifdef __REACTOS__
1465 if (dtFlags & DT_HIDEPREFIX)
1467#endif
1468 break;
1469
1470 case BS_ICON:
1471 flags |= DST_ICON;
1472 lp = (LPARAM)infoPtr->u.icon;
1473 break;
1474
1475 case BS_BITMAP:
1476 flags |= DST_BITMAP;
1477 lp = (LPARAM)infoPtr->u.bitmap;
1478 break;
1479
1480 default:
1481 return;
1482 }
1483
1484#ifdef __REACTOS__
1485 DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rcText.left, rcText.top,
1486 rcText.right - rcText.left, rcText.bottom - rcText.top, flags);
1487#else
1488 DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top,
1489 rc->right - rc->left, rc->bottom - rc->top, flags);
1490#endif
1491 heap_free( text );
1492}
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:1414
GLbitfield flags
Definition: glext.h:7161
UINT_PTR WPARAM
Definition: minwindef.h:174
LONG state
Definition: button.c:97
#define BST_INDETERMINATE
Definition: winuser.h:198
#define COLOR_GRAYTEXT
Definition: winuser.h:943
#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:3015
#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 1414 of file button.c.

1415{
1416 RECT rc;
1417
1418 SetRect(&rc, 0, 0, cx, cy);
1419 DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp);
1420 return TRUE;
1421}
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
const uint16_t * LPCWSTR
Definition: typedefs.h:57
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by BUTTON_DrawLabel().

◆ BUTTON_Register()

void BUTTON_Register ( void  )

Definition at line 2227 of file button.c.

2228{
2229 WNDCLASSW wndClass;
2230
2231 memset(&wndClass, 0, sizeof(wndClass));
2233 wndClass.lpfnWndProc = BUTTON_WindowProc;
2234 wndClass.cbClsExtra = 0;
2235 wndClass.cbWndExtra = sizeof(BUTTON_INFO *);
2236 wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
2237 wndClass.hbrBackground = NULL;
2238 wndClass.lpszClassName = WC_BUTTONW;
2239 RegisterClassW(&wndClass);
2240}
static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: button.c:602
#define WC_BUTTONW
Definition: commctrl.h:4628
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR lpszClassName
Definition: winuser.h:3293
HBRUSH hbrBackground
Definition: winuser.h:3291
int cbClsExtra
Definition: winuser.h:3286
UINT style
Definition: winuser.h:3284
WNDPROC lpfnWndProc
Definition: winuser.h:3285
int cbWndExtra
Definition: winuser.h:3287
HCURSOR hCursor
Definition: winuser.h:3290
uint16_t * LPWSTR
Definition: typedefs.h:56
#define CS_VREDRAW
Definition: winuser.h:666
#define CS_HREDRAW
Definition: winuser.h:661
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:695
#define CS_DBLCLKS
Definition: winuser.h:659
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2474
#define CS_GLOBALCLASS
Definition: winuser.h:660
#define CS_PARENTDC
Definition: winuser.h:664

Referenced by DllMain().

◆ BUTTON_WindowProc()

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

Definition at line 602 of file button.c.

603{
605 RECT rect;
606 POINT pt;
608 UINT btn_type = get_button_type( style );
609 LONG state, new_state;
610 HANDLE oldHbitmap;
611 HTHEME theme;
612
613 if (!IsWindow( hWnd )) return 0;
614
615 if (!infoPtr && (uMsg != WM_NCCREATE))
616 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
617
618 pt.x = (short)LOWORD(lParam);
619 pt.y = (short)HIWORD(lParam);
620
621 switch (uMsg)
622 {
623 case WM_GETDLGCODE:
624 switch(btn_type)
625 {
626 case BS_COMMANDLINK:
627 case BS_USERBUTTON:
631 case BS_RADIOBUTTON:
633 case BS_GROUPBOX: return DLGC_STATIC;
636 default: return DLGC_BUTTON;
637 }
638
639 case WM_ENABLE:
640#ifndef __REACTOS__
641 theme = GetWindowTheme( hWnd );
642 if (theme)
644 else
645#endif
646 paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
647 break;
648
649 case WM_NCCREATE:
650 infoPtr = heap_alloc_zero( sizeof(*infoPtr) );
651 SetWindowLongPtrW( hWnd, 0, (LONG_PTR)infoPtr );
652 infoPtr->hwnd = hWnd;
653#ifdef __REACTOS__
654 SetRect(&infoPtr->rcTextMargin, 1,1,1,1);
655#endif
656 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
657
658 case WM_NCDESTROY:
659 SetWindowLongPtrW( hWnd, 0, 0 );
660 heap_free(infoPtr->note);
661 heap_free(infoPtr);
662 break;
663
664 case WM_CREATE:
665 if (btn_type >= MAX_BTN_TYPE)
666 return -1; /* abort */
667
668 /* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
669 if (btn_type == BS_USERBUTTON )
670 {
671 style = (style & ~BS_TYPEMASK) | BS_PUSHBUTTON;
673 }
674 infoPtr->state = BST_UNCHECKED;
676 return 0;
677
678 case WM_DESTROY:
679 theme = GetWindowTheme( hWnd );
680 CloseThemeData( theme );
681 break;
682
683 case WM_THEMECHANGED:
684 theme = GetWindowTheme( hWnd );
685 CloseThemeData( theme );
687#ifdef __REACTOS__
689#endif
690 break;
691
692 case WM_ERASEBKGND:
693 if (btn_type == BS_OWNERDRAW)
694 {
695 HDC hdc = (HDC)wParam;
696 RECT rc;
697 HBRUSH hBrush;
699 if (!parent) parent = hWnd;
700 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hdc, (LPARAM)hWnd);
701 if (!hBrush) /* did the app forget to call defwindowproc ? */
702 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN,
703 (WPARAM)hdc, (LPARAM)hWnd);
704 GetClientRect(hWnd, &rc);
705 FillRect(hdc, &rc, hBrush);
706 }
707 return 1;
708
709 case WM_PRINTCLIENT:
710 case WM_PAINT:
711 {
712 PAINTSTRUCT ps;
713 HDC hdc;
714
715 theme = GetWindowTheme( hWnd );
716 hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
717
718#ifdef __REACTOS__
719 if (theme && BUTTON_PaintWithTheme(theme, infoPtr, hdc, uMsg == WM_PRINTCLIENT ? lParam : 0))
720 {
721 if ( !wParam ) EndPaint( hWnd, &ps );
722 return 0;
723 }
724#else
725 if (theme && btnThemedPaintFunc[btn_type])
726 {
727 ButtonState drawState;
728 UINT dtflags;
729
730 if (IsWindowEnabled( hWnd ))
731 {
732 if (infoPtr->state & BST_PUSHED) drawState = STATE_PRESSED;
733 else if (infoPtr->state & BST_HOT) drawState = STATE_HOT;
734 else if (infoPtr->state & BST_FOCUS) drawState = STATE_DEFAULTED;
735 else drawState = STATE_NORMAL;
736 }
737 else
738 drawState = STATE_DISABLED;
739
741 btnThemedPaintFunc[btn_type](theme, infoPtr, hdc, drawState, dtflags, infoPtr->state & BST_FOCUS);
742 }
743#endif
744 else if (btnPaintFunc[btn_type])
745 {
746 int nOldMode = SetBkMode( hdc, OPAQUE );
747 btnPaintFunc[btn_type]( infoPtr, hdc, ODA_DRAWENTIRE );
748 SetBkMode(hdc, nOldMode); /* reset painting mode */
749 }
750
751 if ( !wParam ) EndPaint( hWnd, &ps );
752 break;
753 }
754
755 case WM_KEYDOWN:
756 if (wParam == VK_SPACE)
757 {
759 infoPtr->state |= BUTTON_BTNPRESSED;
760 SetCapture( hWnd );
761 }
762 break;
763
764 case WM_LBUTTONDBLCLK:
765 if(style & BS_NOTIFY ||
766 btn_type == BS_RADIOBUTTON ||
767 btn_type == BS_USERBUTTON ||
768 btn_type == BS_OWNERDRAW)
769 {
771 break;
772 }
773 /* fall through */
774 case WM_LBUTTONDOWN:
775 SetCapture( hWnd );
776 SetFocus( hWnd );
777 infoPtr->state |= BUTTON_BTNPRESSED;
779 break;
780
781 case WM_KEYUP:
782 if (wParam != VK_SPACE)
783 break;
784 /* fall through */
785 case WM_LBUTTONUP:
786 state = infoPtr->state;
787 if (!(state & BUTTON_BTNPRESSED)) break;
788 infoPtr->state &= BUTTON_NSTATES;
789 if (!(state & BST_PUSHED))
790 {
792 break;
793 }
796 if (uMsg == WM_KEYUP || PtInRect( &rect, pt ))
797 {
798 switch(btn_type)
799 {
800 case BS_AUTOCHECKBOX:
801 SendMessageW( hWnd, BM_SETCHECK, !(infoPtr->state & BST_CHECKED), 0 );
802 break;
804#ifdef __REACTOS__
806#else
808#endif
809 break;
810 case BS_AUTO3STATE:
812 ((infoPtr->state & 3) + 1), 0 );
813 break;
814 }
815#ifdef __REACTOS__
816 // Fix CORE-10194, Notify parent after capture is released.
819#else
822#endif
823 }
824 else
825 {
827 }
828
829 break;
830
832 TRACE("WM_CAPTURECHANGED %p\n", hWnd);
833 if (hWnd == (HWND)lParam) break;
834 if (infoPtr->state & BUTTON_BTNPRESSED)
835 {
836 infoPtr->state &= BUTTON_NSTATES;
837 if (infoPtr->state & BST_PUSHED)
839 }
840 break;
841
842 case WM_MOUSEMOVE:
843 {
845 mouse_event.cbSize = sizeof(TRACKMOUSEEVENT);
846 mouse_event.dwFlags = TME_QUERY;
847
848#ifdef __REACTOS__
849 if ((infoPtr->state & BST_HOT) == 0)
850 {
851 NMBCHOTITEM nmhotitem;
852
853 infoPtr->state |= BST_HOT;
854
855 nmhotitem.hdr.hwndFrom = hWnd;
856 nmhotitem.hdr.idFrom = GetWindowLongPtrW (hWnd, GWLP_ID);
857 nmhotitem.hdr.code = BCN_HOTITEMCHANGE;
858 nmhotitem.dwFlags = HICF_ENTERING;
859 SendMessageW(GetParent(hWnd), WM_NOTIFY, nmhotitem.hdr.idFrom, (LPARAM)&nmhotitem);
860
861 theme = GetWindowTheme( hWnd );
862 if (theme)
864 }
865
867 {
868 mouse_event.dwFlags = TME_LEAVE;
869 mouse_event.hwndTrack = hWnd;
870 mouse_event.dwHoverTime = 1;
872 }
873#else
874
875 if (!TrackMouseEvent(&mouse_event) || !(mouse_event.dwFlags & (TME_HOVER | TME_LEAVE)))
876 {
877 mouse_event.dwFlags = TME_HOVER | TME_LEAVE;
878 mouse_event.hwndTrack = hWnd;
879 mouse_event.dwHoverTime = 1;
881 }
882#endif
883
884 if ((wParam & MK_LBUTTON) && GetCapture() == hWnd)
885 {
888 }
889 break;
890 }
891
892#ifndef __REACTOS__
893 case WM_MOUSEHOVER:
894 {
895 infoPtr->state |= BST_HOT;
897 break;
898 }
899#endif
900
901 case WM_MOUSELEAVE:
902 {
903#ifdef __REACTOS__
904 if (infoPtr->state & BST_HOT)
905 {
906 NMBCHOTITEM nmhotitem;
907
908 infoPtr->state &= ~BST_HOT;
909
910 nmhotitem.hdr.hwndFrom = hWnd;
911 nmhotitem.hdr.idFrom = GetWindowLongPtrW (hWnd, GWLP_ID);
912 nmhotitem.hdr.code = BCN_HOTITEMCHANGE;
913 nmhotitem.dwFlags = HICF_LEAVING;
914 SendMessageW(GetParent(hWnd), WM_NOTIFY, nmhotitem.hdr.idFrom, (LPARAM)&nmhotitem);
915
916 theme = GetWindowTheme( hWnd );
917 if (theme)
919 }
920 break;
921#else
922 infoPtr->state &= ~BST_HOT;
924 break;
925#endif
926 }
927
928#ifdef __REACTOS__
930 {
931 RECT* prc = (RECT*)lParam;
932 if (!prc)
933 return FALSE;
934 *prc = infoPtr->rcTextMargin;
935 return TRUE;
936 }
938 {
939 RECT* prc = (RECT*)lParam;
940 if (!prc)
941 return FALSE;
942 infoPtr->rcTextMargin = *prc;
943 return TRUE;
944 }
945 case BCM_SETIMAGELIST:
946 {
948 if (!pimldata || !pimldata->himl)
949 return FALSE;
950 infoPtr->imlData = *pimldata;
951 return TRUE;
952 }
953 case BCM_GETIMAGELIST:
954 {
956 if (!pimldata)
957 return FALSE;
958 *pimldata = infoPtr->imlData;
959 return TRUE;
960 }
961 case BCM_GETIDEALSIZE:
962 {
963 HTHEME theme = GetWindowTheme(hWnd);
964 BOOL ret = FALSE;
965 SIZE* pSize = (SIZE*)lParam;
966
967 if (!pSize)
968 {
969 return FALSE;
970 }
971
972 if (btn_type == BS_PUSHBUTTON ||
973 btn_type == BS_DEFPUSHBUTTON ||
974 btn_type == BS_USERBUTTON)
975 {
976 ret = BUTTON_GetIdealSize(infoPtr, theme, pSize);
977 }
978
979 if (!ret)
980 {
982 pSize->cx = rect.right;
983 pSize->cy = rect.bottom;
984 }
985
986 return TRUE;
987 }
988#endif
989
990 case WM_SETTEXT:
991 {
992 /* Clear an old text here as Windows does */
993#ifdef __REACTOS__
994//
995// ReactOS Note :
996// wine Bug: http://bugs.winehq.org/show_bug.cgi?id=25790
997// Patch: http://source.winehq.org/patches/data/70889
998// By: Alexander LAW, Replicate Windows behavior of WM_SETTEXT handler regarding WM_CTLCOLOR*
999//
1000 if (style & WS_VISIBLE)
1001#else
1002 if (IsWindowVisible(hWnd))
1003#endif
1004 {
1005 HDC hdc = GetDC(hWnd);
1006 HBRUSH hbrush;
1007 RECT client, rc;
1009 UINT message = (btn_type == BS_PUSHBUTTON ||
1010 btn_type == BS_DEFPUSHBUTTON ||
1011 btn_type == BS_USERBUTTON ||
1012 btn_type == BS_OWNERDRAW) ?
1014
1015 if (!parent) parent = hWnd;
1016 hbrush = (HBRUSH)SendMessageW(parent, message,
1017 (WPARAM)hdc, (LPARAM)hWnd);
1018 if (!hbrush) /* did the app forget to call DefWindowProc ? */
1020 (WPARAM)hdc, (LPARAM)hWnd);
1021
1023 rc = client;
1024 /* FIXME: check other BS_* handlers */
1025 if (btn_type == BS_GROUPBOX)
1026 InflateRect(&rc, -7, 1); /* GB_Paint does this */
1027 BUTTON_CalcLabelRect(infoPtr, hdc, &rc);
1028 /* Clip by client rect bounds */
1029 if (rc.right > client.right) rc.right = client.right;
1030 if (rc.bottom > client.bottom) rc.bottom = client.bottom;
1031 FillRect(hdc, &rc, hbrush);
1032 ReleaseDC(hWnd, hdc);
1033 }
1034
1036 if (btn_type == BS_GROUPBOX) /* Yes, only for BS_GROUPBOX */
1038 else
1039 paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
1040 return 1; /* success. FIXME: check text length */
1041 }
1042
1043 case BCM_SETNOTE:
1044 {
1045 WCHAR *note = (WCHAR *)lParam;
1046 if (btn_type != BS_COMMANDLINK && btn_type != BS_DEFCOMMANDLINK)
1047 {
1049 return FALSE;
1050 }
1051
1052 heap_free(infoPtr->note);
1053 if (note)
1054 {
1055 infoPtr->note_length = lstrlenW(note);
1056 infoPtr->note = heap_strndupW(note, infoPtr->note_length);
1057 }
1058
1059 if (!note || !infoPtr->note)
1060 {
1061 infoPtr->note_length = 0;
1062 infoPtr->note = heap_alloc_zero(sizeof(WCHAR));
1063 }
1064
1066 return TRUE;
1067 }
1068
1069 case BCM_GETNOTE:
1070 {
1071 DWORD *size = (DWORD *)wParam;
1072 WCHAR *buffer = (WCHAR *)lParam;
1073 INT length = 0;
1074
1075 if (btn_type != BS_COMMANDLINK && btn_type != BS_DEFCOMMANDLINK)
1076 {
1078 return FALSE;
1079 }
1080
1081 if (!buffer || !size || !infoPtr->note)
1082 {
1084 return FALSE;
1085 }
1086
1087 if (*size > 0)
1088 {
1089 length = min(*size - 1, infoPtr->note_length);
1090 memcpy(buffer, infoPtr->note, length * sizeof(WCHAR));
1091 buffer[length] = '\0';
1092 }
1093
1094 if (*size < infoPtr->note_length + 1)
1095 {
1096 *size = infoPtr->note_length + 1;
1098 return FALSE;
1099 }
1100 else
1101 {
1103 return TRUE;
1104 }
1105 }
1106
1107 case BCM_GETNOTELENGTH:
1108 {
1109 if (btn_type != BS_COMMANDLINK && btn_type != BS_DEFCOMMANDLINK)
1110 {
1112 return 0;
1113 }
1114
1115 return infoPtr->note_length;
1116 }
1117
1118 case WM_SETFONT:
1119 infoPtr->font = (HFONT)wParam;
1121 break;
1122
1123 case WM_GETFONT:
1124 return (LRESULT)infoPtr->font;
1125
1126 case WM_SETFOCUS:
1127 TRACE("WM_SETFOCUS %p\n",hWnd);
1128 infoPtr->state |= BST_FOCUS;
1129#ifdef __REACTOS__
1130 if (btn_type != BS_OWNERDRAW)
1132 else
1133#endif
1134 paint_button( infoPtr, btn_type, ODA_FOCUS );
1135 if (style & BS_NOTIFY)
1137#ifdef __REACTOS__
1138 if (((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON)) &&
1139 !(infoPtr->state & BST_CHECKED))
1140 {
1142 }
1143#endif
1144 break;
1145
1146 case WM_KILLFOCUS:
1147 TRACE("WM_KILLFOCUS %p\n",hWnd);
1148 infoPtr->state &= ~BST_FOCUS;
1149#ifndef __REACTOS__
1150 paint_button( infoPtr, btn_type, ODA_FOCUS );
1151#endif
1152
1153 if ((infoPtr->state & BUTTON_BTNPRESSED) && GetCapture() == hWnd)
1155 if (style & BS_NOTIFY)
1157
1159 break;
1160
1161 case WM_SYSCOLORCHANGE:
1163 break;
1164
1165 case BM_SETSTYLE:
1166 btn_type = wParam & BS_TYPEMASK;
1167 style = (style & ~BS_TYPEMASK) | btn_type;
1169
1170 /* Only redraw if lParam flag is set.*/
1171 if (lParam)
1173
1174 break;
1175
1176 case BM_CLICK:
1177#ifdef __REACTOS__
1178 /* Fix for core CORE-6024 */
1179 if (infoPtr->state & BUTTON_BMCLICK)
1180 break;
1181 infoPtr->state |= BUTTON_BMCLICK;
1182#endif
1184 SendMessageW( hWnd, WM_LBUTTONUP, 0, 0 );
1185#ifdef __REACTOS__
1186 infoPtr->state &= ~BUTTON_BMCLICK;
1187#endif
1188 break;
1189
1190 case BM_SETIMAGE:
1191 /* Check that image format matches button style */
1192 switch (style & (BS_BITMAP|BS_ICON))
1193 {
1194 case BS_BITMAP:
1195 if (wParam != IMAGE_BITMAP) return 0;
1196 break;
1197 case BS_ICON:
1198 if (wParam != IMAGE_ICON) return 0;
1199 break;
1200 default:
1201 return 0;
1202 }
1203 oldHbitmap = infoPtr->u.image;
1204 infoPtr->u.image = (HANDLE)lParam;
1206 return (LRESULT)oldHbitmap;
1207
1208 case BM_GETIMAGE:
1209 return (LRESULT)infoPtr->u.image;
1210
1211 case BM_GETCHECK:
1212 return infoPtr->state & 3;
1213
1214 case BM_SETCHECK:
1215 if (wParam > maxCheckState[btn_type]) wParam = maxCheckState[btn_type];
1216 if ((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON))
1217 {
1218 style = wParam ? style | WS_TABSTOP : style & ~WS_TABSTOP;
1220 }
1221 if ((infoPtr->state & 3) != wParam)
1222 {
1223 infoPtr->state = (infoPtr->state & ~3) | wParam;
1225 }
1226#ifndef __REACTOS__
1227 if ((btn_type == BS_AUTORADIOBUTTON) && (wParam == BST_CHECKED) && (style & WS_CHILD))
1229#endif
1230 break;
1231
1232 case BM_GETSTATE:
1233 return infoPtr->state;
1234
1235 case BM_SETSTATE:
1236 state = infoPtr->state;
1237 new_state = wParam ? BST_PUSHED : 0;
1238
1239 if ((state ^ new_state) & BST_PUSHED)
1240 {
1241 if (wParam)
1242 state |= BST_PUSHED;
1243 else
1244 state &= ~BST_PUSHED;
1245
1246 if (btn_type == BS_USERBUTTON)
1248 infoPtr->state = state;
1249
1251 }
1252 break;
1253
1254#ifdef __REACTOS__
1255 case WM_UPDATEUISTATE:
1257
1258 if (button_update_uistate(infoPtr))
1259 paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
1260 break;
1261#endif
1262
1263 case WM_NCHITTEST:
1264 if(btn_type == BS_GROUPBOX) return HTTRANSPARENT;
1265 /* fall through */
1266 default:
1267 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
1268 }
1269 return 0;
1270}
static HBRUSH hbrush
int note(char *format,...)
Definition: util.c:12
RECT rect
Definition: combotst.c:67
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:1282
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:1753
#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 GetWindowTheme(HWND hwnd)
Definition: system.c:920
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:1036
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR pszClassList)
Definition: system.c:890
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
return ret
Definition: mutex.c:147
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
LONG_PTR LRESULT
Definition: minwindef.h:176
#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
#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:4998
#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:4992
#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:4991
#define TME_QUERY
Definition: commctrl.h:5000
#define BS_COMMANDLINK
Definition: commctrl.h:4677
#define TME_HOVER
Definition: commctrl.h:4997
#define BCM_GETTEXTMARGIN
Definition: commctrl.h:4655
#define BCM_GETIMAGELIST
Definition: commctrl.h:4650
_Out_ LPRECT prc
Definition: ntgdi.h:1658
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_NOTIFY
Definition: richedit.h:61
static FILE * client
Definition: client.c:37
#define TRACE(s)
Definition: solgame.cpp:4
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:3266
UINT code
Definition: winuser.h:3267
HWND hwndFrom
Definition: winuser.h:3265
PVOID HANDLE
Definition: typedefs.h:73
#define HIWORD(l)
Definition: typedefs.h:247
#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:1648
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_ERASEBKGND
Definition: winuser.h:1653
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1800
#define BM_GETSTATE
Definition: winuser.h:1949
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:1643
#define WM_KEYUP
Definition: winuser.h:1744
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define ODA_DRAWENTIRE
Definition: winuser.h:2578
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BN_DOUBLECLICKED
Definition: winuser.h:1957
#define IMAGE_ICON
Definition: winuser.h:212
#define BN_SETFOCUS
Definition: winuser.h:1962
#define WM_CAPTURECHANGED
Definition: winuser.h:1836
#define WM_CREATE
Definition: winuser.h:1636
#define VK_SPACE
Definition: winuser.h:2255
#define BM_SETSTATE
Definition: winuser.h:1952
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1806
#define ODA_FOCUS
Definition: winuser.h:2580
#define DLGC_UNDEFPUSHBUTTON
Definition: winuser.h:2658
#define WM_NCHITTEST
Definition: winuser.h:1714
#define BN_KILLFOCUS
Definition: winuser.h:1959
#define WM_SETFOCUS
Definition: winuser.h:1641
#define BN_HILITE
Definition: winuser.h:1958
#define WM_MOUSEMOVE
Definition: winuser.h:1803
#define RDW_UPDATENOW
Definition: winuser.h:1231
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:1804
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1654
#define DLGC_DEFPUSHBUTTON
Definition: winuser.h:2657
#define WM_GETFONT
Definition: winuser.h:1679
#define WM_NCCREATE
Definition: winuser.h:1711
#define BM_SETIMAGE
Definition: winuser.h:1951
#define BN_UNHILITE
Definition: winuser.h:1963
#define WM_CTLCOLORBTN
Definition: winuser.h:1797
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define WM_SETTEXT
Definition: winuser.h:1645
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_SETFONT
Definition: winuser.h:1678
#define BM_CLICK
Definition: winuser.h:1946
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define DLGC_WANTARROWS
Definition: winuser.h:2652
#define BST_PUSHED
Definition: winuser.h:201
#define BM_GETIMAGE
Definition: winuser.h:1948
#define RDW_FRAME
Definition: winuser.h:1223
#define BM_SETSTYLE
Definition: winuser.h:1953
#define BST_FOCUS
Definition: winuser.h:200
HDC WINAPI GetDC(_In_opt_ HWND)
#define DLGC_STATIC
Definition: winuser.h:2661
#define WM_LBUTTONUP
Definition: winuser.h:1805
#define WM_NCDESTROY
Definition: winuser.h:1712
#define HTTRANSPARENT
Definition: winuser.h:2509
#define MK_LBUTTON
Definition: winuser.h:2403
#define BN_CLICKED
Definition: winuser.h:1954
#define WM_DESTROY
Definition: winuser.h:1637
#define WM_KEYDOWN
Definition: winuser.h:1743
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define SetWindowLongPtrW
Definition: winuser.h:5512
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define WM_KILLFOCUS
Definition: winuser.h:1642
#define RDW_INVALIDATE
Definition: winuser.h:1225
#define BM_GETCHECK
Definition: winuser.h:1947

Referenced by BUTTON_Register().

◆ CB_Paint()

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

Definition at line 1620 of file button.c.

1621{
1622 RECT rbox, rtext, client;
1623 HBRUSH hBrush;
1624 int delta, text_offset, checkBoxWidth, checkBoxHeight;
1625 UINT dtFlags;
1626 HFONT hFont;
1627 LONG state = infoPtr->state;
1628 LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1629 LONG ex_style = GetWindowLongW( infoPtr->hwnd, GWL_EXSTYLE );
1630 HWND parent;
1631 HRGN hrgn;
1632
1633 if (style & BS_PUSHLIKE)
1634 {
1635 PB_Paint( infoPtr, hDC, action );
1636 return;
1637 }
1638
1639 GetClientRect(infoPtr->hwnd, &client);
1640 rbox = rtext = client;
1641
1642 checkBoxWidth = 12 * GetDeviceCaps( hDC, LOGPIXELSX ) / 96 + 1;
1643 checkBoxHeight = 12 * GetDeviceCaps( hDC, LOGPIXELSY ) / 96 + 1;
1644
1645 if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1646 GetCharWidthW( hDC, '0', '0', &text_offset );
1647 text_offset /= 2;
1648
1649 parent = GetParent(infoPtr->hwnd);
1650 if (!parent) parent = infoPtr->hwnd;
1651 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1652 if (!hBrush) /* did the app forget to call defwindowproc ? */
1653 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1655
1656 if (style & BS_LEFTTEXT || ex_style & WS_EX_RIGHT)
1657 {
1658 rtext.right -= checkBoxWidth + text_offset;
1659 rbox.left = rbox.right - checkBoxWidth;
1660 }
1661 else
1662 {
1663 rtext.left += checkBoxWidth + text_offset;
1664 rbox.right = checkBoxWidth;
1665 }
1666
1667 /* Since WM_ERASEBKGND does nothing, first prepare background */
1668 if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
1669 if (action == ODA_DRAWENTIRE) FillRect( hDC, &client, hBrush );
1670
1671 /* Draw label */
1672 client = rtext;
1673 dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &rtext);
1674
1675 /* Only adjust rbox when rtext is valid */
1676 if (dtFlags != (UINT)-1L)
1677 {
1678 rbox.top = rtext.top;
1679 rbox.bottom = rtext.bottom;
1680 }
1681
1682 /* Draw the check-box bitmap */
1684 {
1685 UINT flags;
1686
1690 else flags = DFCS_BUTTONCHECK;
1691
1694
1696
1697 /* rbox must have the correct height */
1698 delta = rbox.bottom - rbox.top - checkBoxHeight;
1699
1700 if (style & BS_TOP) {
1701 if (delta > 0) {
1702 rbox.bottom = rbox.top + checkBoxHeight;
1703 } else {
1704 rbox.top -= -delta/2 + 1;
1705 rbox.bottom = rbox.top + checkBoxHeight;
1706 }
1707 } else if (style & BS_BOTTOM) {
1708 if (delta > 0) {
1709 rbox.top = rbox.bottom - checkBoxHeight;
1710 } else {
1711 rbox.bottom += -delta/2 + 1;
1712 rbox.top = rbox.bottom - checkBoxHeight;
1713 }
1714 } else { /* Default */
1715 if (delta > 0) {
1716 int ofs = (delta / 2);
1717 rbox.bottom -= ofs + 1;
1718 rbox.top = rbox.bottom - checkBoxHeight;
1719 } else if (delta < 0) {
1720 int ofs = (-delta / 2);
1721 rbox.top -= ofs + 1;
1722 rbox.bottom = rbox.top + checkBoxHeight;
1723 }
1724 }
1725
1727 }
1728
1729 if (dtFlags == (UINT)-1L) /* Noting to draw */
1730 return;
1731
1732 if (action == ODA_DRAWENTIRE)
1733 BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &rtext);
1734
1735 /* ... and focus */
1736 if (action == ODA_FOCUS || (state & BST_FOCUS))
1737 {
1738 rtext.left--;
1739 rtext.right++;
1740 IntersectRect(&rtext, &rtext, &client);
1741 DrawFocusRect( hDC, &rtext );
1742 }
1744 if (hrgn) DeleteObject( hrgn );
1745}
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:1429
static void PB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1497
action
Definition: namespace.c:707
#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:2579
#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 2001 of file button.c.

2003{
2004 static const int cb_states[3][5] =
2005 {
2009 };
2010
2011 static const int rb_states[2][5] =
2012 {
2015 };
2016
2017 SIZE sz;
2018 RECT bgRect, textRect;
2019 HFONT font, hPrevFont = NULL;
2020 int checkState = infoPtr->state & 3;
2021 DWORD dwStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
2022 UINT btn_type = get_button_type( dwStyle );
2023 int part = (btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON) ? BP_RADIOBUTTON : BP_CHECKBOX;
2024 int state = (part == BP_CHECKBOX)
2025 ? cb_states[ checkState ][ drawState ]
2026 : rb_states[ checkState ][ drawState ];
2027 WCHAR *text = get_button_text(infoPtr);
2028 LOGFONTW lf;
2029 BOOL created_font = FALSE;
2030#ifdef __REACTOS__
2031 HWND parent;
2032 HBRUSH hBrush;
2033 DWORD cdrf;
2034#endif
2035
2036 HRESULT hr = GetThemeFont(theme, hDC, part, state, TMT_FONT, &lf);
2037 if (SUCCEEDED(hr)) {
2039 if (!font)
2040 TRACE("Failed to create font\n");
2041 else {
2042 TRACE("font = %s\n", debugstr_w(lf.lfFaceName));
2043 hPrevFont = SelectObject(hDC, font);
2044 created_font = TRUE;
2045 }
2046 } else {
2047#ifdef __REACTOS__ /* r73885 */
2048 font = infoPtr->font;
2049#else
2050 font = (HFONT)SendMessageW(infoPtr->hwnd, WM_GETFONT, 0, 0);
2051#endif
2052 hPrevFont = SelectObject(hDC, font);
2053 }
2054
2055 if (FAILED(GetThemePartSize(theme, hDC, part, state, NULL, TS_DRAW, &sz)))
2056 sz.cx = sz.cy = 13;
2057
2058 GetClientRect(infoPtr->hwnd, &bgRect);
2059
2060#ifdef __REACTOS__
2061 if (prfFlag == 0)
2062 {
2064 }
2065
2066 parent = GetParent(infoPtr->hwnd);
2067 if (!parent) parent = infoPtr->hwnd;
2068 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
2069 (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
2070 if (!hBrush) /* did the app forget to call defwindowproc ? */
2071 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
2072 (WPARAM)hDC, (LPARAM)infoPtr->hwnd );
2073 FillRect( hDC, &bgRect, hBrush );
2074
2075 cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &bgRect);
2076 if (cdrf == CDRF_SKIPDEFAULT)
2077 goto cleanup;
2078#endif
2079
2080 GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &textRect);
2081
2082 if (dtFlags & DT_SINGLELINE) /* Center the checkbox / radio button to the text. */
2083 bgRect.top = bgRect.top + (textRect.bottom - textRect.top - sz.cy) / 2;
2084
2085 /* adjust for the check/radio marker */
2086 bgRect.bottom = bgRect.top + sz.cy;
2087 bgRect.right = bgRect.left + sz.cx;
2088 textRect.left = bgRect.right + 6;
2089
2090#ifdef __REACTOS__
2091 DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
2092
2093 if (cdrf == CDRF_NOTIFYPOSTERASE)
2094 BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &bgRect);
2095
2096 cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &bgRect);
2097 if (cdrf == CDRF_SKIPDEFAULT)
2098 goto cleanup;
2099
2100#else
2102 DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
2103#endif
2104 if (text)
2105 {
2106 DrawThemeText(theme, hDC, part, state, text, lstrlenW(text), dtFlags, 0, &textRect);
2107
2108 if (focused)
2109 {
2110 RECT focusRect;
2111
2112 focusRect = textRect;
2113
2114 DrawTextW(hDC, text, lstrlenW(text), &focusRect, dtFlags | DT_CALCRECT);
2115
2116 if (focusRect.right < textRect.right) focusRect.right++;
2117 focusRect.bottom = textRect.bottom;
2118
2119 DrawFocusRect( hDC, &focusRect );
2120 }
2121
2122 heap_free(text);
2123#ifdef __REACTOS__
2124 text = NULL;
2125#endif
2126 }
2127
2128#ifdef __REACTOS__
2129 if (cdrf == CDRF_NOTIFYPOSTPAINT)
2130 BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
2131cleanup:
2132 if (text) heap_free(text);
2133#endif
2134 if (created_font) DeleteObject(font);
2135 if (hPrevFont) SelectObject(hDC, hPrevFont);
2136}
HRESULT hr
Definition: delayimp.cpp:582
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
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 1784 of file button.c.

1785{
1786 RECT rc, rcFrame;
1787 HBRUSH hbr;
1788 HFONT hFont;
1789 UINT dtFlags;
1791 LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1792 HWND parent;
1793 HRGN hrgn;
1794
1795 if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1796 /* GroupBox acts like static control, so it sends CTLCOLORSTATIC */
1797 parent = GetParent(infoPtr->hwnd);
1798 if (!parent) parent = infoPtr->hwnd;
1799 hbr = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1800 if (!hbr) /* did the app forget to call defwindowproc ? */
1801 hbr = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1802 GetClientRect( infoPtr->hwnd, &rc);
1803 rcFrame = rc;
1804 hrgn = set_control_clipping( hDC, &rc );
1805
1807 rcFrame.top += (tm.tmHeight / 2) - 1;
1808 DrawEdge (hDC, &rcFrame, EDGE_ETCHED, BF_RECT | ((style & BS_FLAT) ? BF_FLAT : 0));
1809
1810 InflateRect(&rc, -7, 1);
1811 dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &rc);
1812
1813 if (dtFlags != (UINT)-1)
1814 {
1815 /* Because buttons have CS_PARENTDC class style, there is a chance
1816 * that label will be drawn out of client rect.
1817 * But Windows doesn't clip label's rect, so do I.
1818 */
1819
1820 /* There is 1-pixel margin at the left, right, and bottom */
1821 rc.left--; rc.right++; rc.bottom++;
1822 FillRect(hDC, &rc, hbr);
1823 rc.left++; rc.right--; rc.bottom--;
1824
1825 BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &rc);
1826 }
1828 if (hrgn) DeleteObject( hrgn );
1829}
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 2141 of file button.c.

2143{
2144 static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };
2145
2146 RECT bgRect, textRect, contentRect;
2147 int state = states[ drawState ];
2148 WCHAR *text = get_button_text(infoPtr);
2149 LOGFONTW lf;
2150 HFONT font, hPrevFont = NULL;
2151 BOOL created_font = FALSE;
2152#ifdef __REACTOS__ /* r74406 */
2153 HWND parent;
2154 HBRUSH hBrush;
2155 RECT clientRect;
2156#endif
2157
2159 if (SUCCEEDED(hr)) {
2161 if (!font)
2162 TRACE("Failed to create font\n");
2163 else {
2164 hPrevFont = SelectObject(hDC, font);
2165 created_font = TRUE;
2166 }
2167 } else {
2168#ifdef __REACTOS__ /* r73885 */
2169 font = infoPtr->font;
2170#else
2171 font = (HFONT)SendMessageW(infoPtr->hwnd, WM_GETFONT, 0, 0);
2172#endif
2173 hPrevFont = SelectObject(hDC, font);
2174 }
2175
2176 GetClientRect(infoPtr->hwnd, &bgRect);
2177 textRect = bgRect;
2178
2179 if (text)
2180 {
2181 SIZE textExtent;
2182 GetTextExtentPoint32W(hDC, text, lstrlenW(text), &textExtent);
2183 bgRect.top += (textExtent.cy / 2);
2184 textRect.left += 10;
2185 textRect.bottom = textRect.top + textExtent.cy;
2186 textRect.right = textRect.left + textExtent.cx + 4;
2187
2188 ExcludeClipRect(hDC, textRect.left, textRect.top, textRect.right, textRect.bottom);
2189 }
2190
2191 GetThemeBackgroundContentRect(theme, hDC, BP_GROUPBOX, state, &bgRect, &contentRect);
2192 ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom);
2193
2194#ifdef __REACTOS__ /* r73885 & r74149 */
2195 if (prfFlag == 0)
2196#endif
2199
2200#ifdef __REACTOS__ /* r74406 */
2201 parent = GetParent(infoPtr->hwnd);
2202 if (!parent) parent = infoPtr->hwnd;
2203 hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
2204 (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
2205 if (!hBrush) /* did the app forget to call defwindowproc ? */
2206 hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
2207 (WPARAM)hDC, (LPARAM)infoPtr->hwnd );
2208 GetClientRect(infoPtr->hwnd, &clientRect);
2209 FillRect( hDC, &clientRect, hBrush );
2210#endif
2211
2212 DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);
2213
2215
2216 if (text)
2217 {
2218 InflateRect(&textRect, -2, 0);
2219 DrawThemeText(theme, hDC, BP_GROUPBOX, state, text, lstrlenW(text), 0, 0, &textRect);
2220 heap_free(text);
2221 }
2222
2223 if (created_font) DeleteObject(font);
2224 if (hPrevFont) SelectObject(hDC, hPrevFont);
2225}
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:1382
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 1878 of file button.c.

1879{
1880 LONG state = infoPtr->state;
1881 DRAWITEMSTRUCT dis;
1882 LONG_PTR id = GetWindowLongPtrW( infoPtr->hwnd, GWLP_ID );
1883 HWND parent;
1884 HFONT hFont;
1885 HRGN hrgn;
1886
1887 dis.CtlType = ODT_BUTTON;
1888 dis.CtlID = id;
1889 dis.itemID = 0;
1890 dis.itemAction = action;
1891 dis.itemState = ((state & BST_FOCUS) ? ODS_FOCUS : 0) |
1892 ((state & BST_PUSHED) ? ODS_SELECTED : 0) |
1893 (IsWindowEnabled(infoPtr->hwnd) ? 0: ODS_DISABLED);
1894 dis.hwndItem = infoPtr->hwnd;
1895 dis.hDC = hDC;
1896 dis.itemData = 0;
1897 GetClientRect( infoPtr->hwnd, &dis.rcItem );
1898
1899 if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1900 parent = GetParent(infoPtr->hwnd);
1901 if (!parent) parent = infoPtr->hwnd;
1903
1905
1906 SendMessageW( GetParent(infoPtr->hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
1908 if (hrgn) DeleteObject( hrgn );
1909}
GLuint id
Definition: glext.h:5910
ULONG_PTR itemData
Definition: winuser.h:3201
#define ODS_DISABLED
Definition: winuser.h:2583
#define ODS_SELECTED
Definition: winuser.h:2581
#define WM_DRAWITEM
Definition: winuser.h:1673
#define ODT_BUTTON
Definition: winuser.h:2576
#define ODS_FOCUS
Definition: winuser.h:2585

◆ 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 1497 of file button.c.

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

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 1914 of file button.c.

1916{
1917 static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED };
1918
1919 RECT bgRect, textRect;
1920 HFONT font = infoPtr->font;
1921 HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
1922 int state = states[ drawState ];
1923 WCHAR *text = get_button_text(infoPtr);
1924#ifdef __REACTOS__
1925 HWND parent;
1926 DWORD cdrf;
1927
1928 GetClientRect(infoPtr->hwnd, &bgRect);
1929 GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect);
1930
1931 if (prfFlag == 0)
1932 {
1935 }
1936
1937 parent = GetParent(infoPtr->hwnd);
1938 if (!parent) parent = infoPtr->hwnd;
1940
1941 cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &bgRect);
1942 if (cdrf == CDRF_SKIPDEFAULT)
1943 goto cleanup;
1944
1945 DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
1946
1947 if (cdrf == CDRF_NOTIFYPOSTERASE)
1948 BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &bgRect);
1949
1950 cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &bgRect);
1951 if (cdrf == CDRF_SKIPDEFAULT)
1952 goto cleanup;
1953
1954 BUTTON_DrawIml(hDC, &infoPtr->imlData, &textRect, FALSE, drawState);
1955#else
1956 GetClientRect(infoPtr->hwnd, &bgRect);
1957 GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect);
1958
1961
1962 DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
1963#endif
1964
1965 if (text)
1966 {
1967 DrawThemeText(theme, hDC, BP_PUSHBUTTON, state, text, lstrlenW(text), dtFlags, 0, &textRect);
1968 heap_free(text);
1969#ifdef __REACTOS__
1970 text = NULL;
1971#endif
1972 }
1973
1974 if (focused)
1975 {
1977 RECT focusRect = bgRect;
1978
1980
1981 focusRect.left += margins.cxLeftWidth;
1982 focusRect.top += margins.cyTopHeight;
1983 focusRect.right -= margins.cxRightWidth;
1984 focusRect.bottom -= margins.cyBottomHeight;
1985
1986 DrawFocusRect( hDC, &focusRect );
1987 }
1988
1989#ifdef __REACTOS__
1990 if (cdrf == CDRF_NOTIFYPOSTPAINT)
1991 BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
1992cleanup:
1993 if (text) heap_free(text);
1994#endif
1995 if (hPrevFont) SelectObject(hDC, hPrevFont);
1996}
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 1836 of file button.c.

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

◆ 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:1784
static void CB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1620
static void UB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1836
static void OB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1878

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:2141
static void CB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)
Definition: button.c:2001
static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)
Definition: button.c:1914

Definition at line 194 of file button.c.

Referenced by BUTTON_WindowProc().

◆ maxCheckState