ReactOS  0.4.13-dev-464-g6b95727
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 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)
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
HWND hWnd
Definition: settings.c:17
#define GetWindowLongPtrW
Definition: winuser.h:4698
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_COMMAND
Definition: winuser.h:1716
HWND WINAPI GetParent(_In_ HWND)
#define GWLP_ID
Definition: winuser.h:854

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 120 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 152 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 183 of file button.c.

Enumeration Type Documentation

◆ ButtonState

Enumerator
STATE_NORMAL 
STATE_DISABLED 
STATE_HOT 
STATE_PRESSED 
STATE_DEFAULTED 

Definition at line 143 of file button.c.

Function Documentation

◆ BUTTON_BStoDT()

static UINT BUTTON_BStoDT ( DWORD  style,
DWORD  ex_style 
)
static

Definition at line 262 of file button.c.

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

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

1182 {
1183  LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1184  LONG ex_style = GetWindowLongW( infoPtr->hwnd, GWL_EXSTYLE );
1185  WCHAR *text;
1186  ICONINFO iconInfo;
1187  BITMAP bm;
1188  UINT dtStyle = BUTTON_BStoDT( style, ex_style );
1189  RECT r = *rc;
1190  INT n;
1191 #ifdef __REACTOS__
1192  BOOL bHasIml = BUTTON_DrawIml(hdc, &infoPtr->imlData, &r, TRUE, 0);
1193 #endif
1194 
1195  /* Calculate label rectangle according to label type */
1196  switch (style & (BS_ICON|BS_BITMAP))
1197  {
1198  case BS_TEXT:
1199  {
1200  HFONT hFont, hPrevFont = 0;
1201 
1202  if (!(text = get_button_text( infoPtr ))) goto empty_rect;
1203  if (!text[0])
1204  {
1205  heap_free( text );
1206  goto empty_rect;
1207  }
1208 
1209  if ((hFont = infoPtr->font)) hPrevFont = SelectObject( hdc, hFont );
1210  DrawTextW(hdc, text, -1, &r, dtStyle | DT_CALCRECT);
1211  if (hPrevFont) SelectObject( hdc, hPrevFont );
1212  heap_free( text );
1213 #ifdef __REACTOS__
1214  if (infoPtr->ui_state & UISF_HIDEACCEL)
1215  dtStyle |= DT_HIDEPREFIX;
1216 #endif
1217  break;
1218  }
1219 
1220  case BS_ICON:
1221  if (!GetIconInfo(infoPtr->u.icon, &iconInfo))
1222  goto empty_rect;
1223 
1224  GetObjectW (iconInfo.hbmColor, sizeof(BITMAP), &bm);
1225 
1226  r.right = r.left + bm.bmWidth;
1227  r.bottom = r.top + bm.bmHeight;
1228 
1229  DeleteObject(iconInfo.hbmColor);
1230  DeleteObject(iconInfo.hbmMask);
1231  break;
1232 
1233  case BS_BITMAP:
1234  if (!GetObjectW( infoPtr->u.bitmap, sizeof(BITMAP), &bm))
1235  goto empty_rect;
1236 
1237  r.right = r.left + bm.bmWidth;
1238  r.bottom = r.top + bm.bmHeight;
1239  break;
1240 
1241  default:
1242  empty_rect:
1243 #ifdef __REACTOS__
1244  if (bHasIml)
1245  break;
1246 #endif
1247  rc->right = r.left;
1248  rc->bottom = r.top;
1249  return (UINT)-1;
1250  }
1251 
1252 #ifdef __REACTOS__
1253  if (bHasIml)
1254  {
1255  if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_LEFT)
1256  r.left = infoPtr->imlData.margin.left;
1257  else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_RIGHT)
1258  r.right = infoPtr->imlData.margin.right;
1259  else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_TOP)
1260  r.top = infoPtr->imlData.margin.top;
1261  else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_BOTTOM)
1262  r.bottom = infoPtr->imlData.margin.bottom;
1263  }
1264 #endif
1265 
1266  /* Position label inside bounding rectangle according to
1267  * alignment flags. (calculated rect is always left-top aligned).
1268  * If label is aligned to any side - shift label in opposite
1269  * direction to leave extra space for focus rectangle.
1270  */
1271  switch (dtStyle & (DT_CENTER|DT_RIGHT))
1272  {
1273  case DT_LEFT: r.left++; r.right++; break;
1274  case DT_CENTER: n = r.right - r.left;
1275  r.left = rc->left + ((rc->right - rc->left) - n) / 2;
1276  r.right = r.left + n; break;
1277  case DT_RIGHT: n = r.right - r.left;
1278  r.right = rc->right - 1;
1279  r.left = r.right - n;
1280  break;
1281  }
1282 
1283  switch (dtStyle & (DT_VCENTER|DT_BOTTOM))
1284  {
1285  case DT_TOP: r.top++; r.bottom++; break;
1286  case DT_VCENTER: n = r.bottom - r.top;
1287 #ifdef __REACTOS__
1288  r.top = rc->top + ((rc->bottom - 1 - rc->top) - n) / 2;
1289 #else
1290  r.top = rc->top + ((rc->bottom - rc->top) - n) / 2;
1291 #endif
1292  r.bottom = r.top + n; break;
1293  case DT_BOTTOM: n = r.bottom - r.top;
1294  r.bottom = rc->bottom - 1;
1295  r.top = r.bottom - n;
1296  break;
1297  }
1298 
1299  *rc = r;
1300  return dtStyle;
1301 }
#define TRUE
Definition: types.h:120
#define DT_HIDEPREFIX
Definition: winuser.h:547
static WCHAR * get_button_text(const BUTTON_INFO *infoPtr)
Definition: button.c:230
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const WCHAR * text
Definition: package.c:1827
#define BS_TEXT
Definition: winuser.h:276
GLdouble n
Definition: glext.h:7729
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define BUTTON_IMAGELIST_ALIGN_TOP
Definition: commctrl.h:4601
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define GWL_EXSTYLE
Definition: winuser.h:845
#define DT_RIGHT
Definition: winuser.h:538
HBITMAP bitmap
Definition: button.c:101
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2014
HFONT hFont
Definition: main.c:53
#define DT_LEFT
Definition: winuser.h:534
#define DT_CALCRECT
Definition: winuser.h:526
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
HBITMAP hbmMask
Definition: winuser.h:3079
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
HBITMAP hbmColor
Definition: winuser.h:3080
#define DT_VCENTER
Definition: winuser.h:543
HWND hwnd
Definition: button.c:95
__wchar_t WCHAR
Definition: xmlstorage.h:180
static UINT BUTTON_BStoDT(DWORD style, DWORD ex_style)
Definition: button.c:262
#define BUTTON_IMAGELIST_ALIGN_LEFT
Definition: commctrl.h:4599
#define BS_ICON
Definition: winuser.h:264
HDC hdc
Definition: main.c:9
#define BS_BITMAP
Definition: winuser.h:258
HFONT font
Definition: button.c:97
#define GWL_STYLE
Definition: winuser.h:846
#define BUTTON_IMAGELIST_ALIGN_BOTTOM
Definition: commctrl.h:4602
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
Definition: bl.h:1331
#define DT_TOP
Definition: winuser.h:542
unsigned int UINT
Definition: ndis.h:50
#define BUTTON_IMAGELIST_ALIGN_RIGHT
Definition: commctrl.h:4600
union _BUTTON_INFO::@318 u
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG bottom
Definition: windef.h:294
#define DT_CENTER
Definition: winuser.h:527
Arabic default style
Definition: afstyles.h:93
#define DT_BOTTOM
Definition: winuser.h:525
HICON icon
Definition: button.c:100
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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

◆ BUTTON_CheckAutoRadioButton()

static void BUTTON_CheckAutoRadioButton ( HWND  hwnd)
static

Definition at line 1648 of file button.c.

1649 {
1650  HWND parent, sibling, start;
1651 
1652  parent = GetParent(hwnd);
1653  /* make sure that starting control is not disabled or invisible */
1654 #ifdef __REACTOS__
1655  start = sibling = hwnd;
1656 #else
1657  start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
1658 #endif
1659  do
1660  {
1661  if (!sibling) break;
1662 #ifdef __REACTOS__
1663  if (SendMessageW( sibling, WM_GETDLGCODE, 0, 0 ) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
1664  SendMessageW( sibling, BM_SETCHECK, sibling == hwnd ? BST_CHECKED : BST_UNCHECKED, 0 );
1665 #else
1666  if ((hwnd != sibling) &&
1668  SendMessageW( sibling, BM_SETCHECK, BST_UNCHECKED, 0 );
1669 #endif
1670  sibling = GetNextDlgGroupItem( parent, sibling, FALSE );
1671  } while (sibling != start);
1672 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define DLGC_RADIOBUTTON
Definition: winuser.h:2571
HWND WINAPI GetNextDlgGroupItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define BM_SETCHECK
Definition: winuser.h:1882
r parent
Definition: btrfs.c:2708
#define BST_UNCHECKED
Definition: winuser.h:199
#define GWL_STYLE
Definition: winuser.h:846
HWND WINAPI GetParent(_In_ HWND)
#define BS_AUTORADIOBUTTON
Definition: pedump.c:660
GLuint start
Definition: gl.h:1545
#define BS_TYPEMASK
Definition: winuser.h:270
#define DLGC_BUTTON
Definition: winuser.h:2574
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197

Referenced by BUTTON_WindowProc().

◆ BUTTON_DrawLabel()

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

Definition at line 1324 of file button.c.

1325 {
1326  DRAWSTATEPROC lpOutputProc = NULL;
1327  LPARAM lp;
1328  WPARAM wp = 0;
1329  HBRUSH hbr = 0;
1331  LONG state = infoPtr->state;
1332  LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1333  WCHAR *text = NULL;
1334 
1335  /* FIXME: To draw disabled label in Win31 look-and-feel, we probably
1336  * must use DSS_MONO flag and COLOR_GRAYTEXT brush (or maybe DSS_UNION).
1337  * I don't have Win31 on hand to verify that, so I leave it as is.
1338  */
1339 
1340 #ifdef __REACTOS__
1341  RECT rcText = *rc;
1342  BUTTON_DrawIml(hdc, &infoPtr->imlData, &rcText, FALSE, 0);
1343 #endif
1344 
1345  if ((style & BS_PUSHLIKE) && (state & BST_INDETERMINATE))
1346  {
1348  flags |= DSS_MONO;
1349  }
1350 
1351  switch (style & (BS_ICON|BS_BITMAP))
1352  {
1353  case BS_TEXT:
1354  /* DST_COMPLEX -- is 0 */
1355  lpOutputProc = BUTTON_DrawTextCallback;
1356  if (!(text = get_button_text( infoPtr ))) return;
1357  lp = (LPARAM)text;
1358  wp = dtFlags;
1359 #ifdef __REACTOS__
1360  if (dtFlags & DT_HIDEPREFIX)
1361  flags |= DSS_HIDEPREFIX;
1362 #endif
1363  break;
1364 
1365  case BS_ICON:
1366  flags |= DST_ICON;
1367  lp = (LPARAM)infoPtr->u.icon;
1368  break;
1369 
1370  case BS_BITMAP:
1371  flags |= DST_BITMAP;
1372  lp = (LPARAM)infoPtr->u.bitmap;
1373  break;
1374 
1375  default:
1376  return;
1377  }
1378 
1379 #ifdef __REACTOS__
1380  DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rcText.left, rcText.top,
1381  rcText.right - rcText.left, rcText.bottom - rcText.top, flags);
1382 #else
1383  DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top,
1384  rc->right - rc->left, rc->bottom - rc->top, flags);
1385 #endif
1386  heap_free( text );
1387 }
#define DT_HIDEPREFIX
Definition: winuser.h:547
static WCHAR * get_button_text(const BUTTON_INFO *infoPtr)
Definition: button.c:230
const WCHAR * text
Definition: package.c:1827
#define BS_TEXT
Definition: winuser.h:276
LONG top
Definition: windef.h:292
BOOL(CALLBACK * DRAWSTATEPROC)(HDC, LPARAM, WPARAM, int, int)
Definition: winuser.h:2860
UINT_PTR WPARAM
Definition: windef.h:207
HBITMAP bitmap
Definition: button.c:101
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define BST_INDETERMINATE
Definition: winuser.h:198
#define DSS_HIDEPREFIX
Definition: winuser.h:522
long LONG
Definition: pedump.c:60
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI IsWindowEnabled(_In_ HWND)
HWND hwnd
Definition: button.c:95
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DSS_MONO
Definition: winuser.h:521
#define DSS_DISABLED
Definition: winuser.h:519
GLbitfield flags
Definition: glext.h:7161
static LPARAM
Definition: button.c:42
#define BS_ICON
Definition: winuser.h:264
#define COLOR_GRAYTEXT
Definition: winuser.h:922
HDC hdc
Definition: main.c:9
BOOL WINAPI DrawStateW(_In_ HDC, _In_opt_ HBRUSH, _In_opt_ DRAWSTATEPROC, _In_ LPARAM, _In_ WPARAM, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define BS_BITMAP
Definition: winuser.h:258
static int state
Definition: maze.c:121
LONG state
Definition: button.c:96
#define GWL_STYLE
Definition: winuser.h:846
unsigned int UINT
Definition: ndis.h:50
union _BUTTON_INFO::@318 u
#define BS_PUSHLIKE
Definition: winuser.h:272
#define DST_BITMAP
Definition: winuser.h:516
#define DSS_NORMAL
Definition: winuser.h:517
LONG bottom
Definition: windef.h:294
static BOOL CALLBACK BUTTON_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy)
Definition: button.c:1309
#define DST_ICON
Definition: winuser.h:515
Arabic default style
Definition: afstyles.h:93
HBRUSH WINAPI GetSysColorBrush(_In_ int)
HICON icon
Definition: button.c:100
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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

1310 {
1311  RECT rc;
1312 
1313  SetRect(&rc, 0, 0, cx, cy);
1314  DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp);
1315  return TRUE;
1316 }
#define TRUE
Definition: types.h:120
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
HDC hdc
Definition: main.c:9
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
unsigned int UINT
Definition: ndis.h:50
_Out_opt_ int * cx
Definition: commctrl.h:570
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by BUTTON_DrawLabel().

◆ BUTTON_Register()

void BUTTON_Register ( void  )

Definition at line 2122 of file button.c.

2123 {
2124  WNDCLASSW wndClass;
2125 
2126  memset(&wndClass, 0, sizeof(wndClass));
2128  wndClass.lpfnWndProc = BUTTON_WindowProc;
2129  wndClass.cbClsExtra = 0;
2130  wndClass.cbWndExtra = sizeof(BUTTON_INFO *);
2131  wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
2132  wndClass.hbrBackground = NULL;
2133  wndClass.lpszClassName = WC_BUTTONW;
2134  RegisterClassW(&wndClass);
2135 }
UINT style
Definition: winuser.h:3129
#define CS_HREDRAW
Definition: winuser.h:648
int cbClsExtra
Definition: winuser.h:3131
static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: button.c:587
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
WNDPROC lpfnWndProc
Definition: winuser.h:3130
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR lpszClassName
Definition: winuser.h:3138
#define CS_VREDRAW
Definition: winuser.h:653
int cbWndExtra
Definition: winuser.h:3132
#define CS_GLOBALCLASS
Definition: winuser.h:647
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define CS_DBLCLKS
Definition: winuser.h:646
HCURSOR hCursor
Definition: winuser.h:3135
#define WC_BUTTONW
Definition: commctrl.h:4595
HBRUSH hbrBackground
Definition: winuser.h:3136
#define IDC_ARROW
Definition: winuser.h:682
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define memset(x, y, z)
Definition: compat.h:39
#define CS_PARENTDC
Definition: winuser.h:651

Referenced by DllMain().

◆ BUTTON_WindowProc()

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

Definition at line 587 of file button.c.

588 {
589  BUTTON_INFO *infoPtr = (BUTTON_INFO *)GetWindowLongPtrW(hWnd, 0);
590  RECT rect;
591  POINT pt;
593  UINT btn_type = get_button_type( style );
594  LONG state, new_state;
595  HANDLE oldHbitmap;
596  HTHEME theme;
597 
598  if (!IsWindow( hWnd )) return 0;
599 
600  if (!infoPtr && (uMsg != WM_NCCREATE))
601  return DefWindowProcW(hWnd, uMsg, wParam, lParam);
602 
603  pt.x = (short)LOWORD(lParam);
604  pt.y = (short)HIWORD(lParam);
605 
606  switch (uMsg)
607  {
608  case WM_GETDLGCODE:
609  switch(btn_type)
610  {
611  case BS_COMMANDLINK:
612  case BS_USERBUTTON:
614  case BS_DEFCOMMANDLINK:
616  case BS_RADIOBUTTON:
618  case BS_GROUPBOX: return DLGC_STATIC;
621  default: return DLGC_BUTTON;
622  }
623 
624  case WM_ENABLE:
625 #ifndef __REACTOS__
626  theme = GetWindowTheme( hWnd );
627  if (theme)
629  else
630 #endif
631  paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
632  break;
633 
634  case WM_NCCREATE:
635  infoPtr = heap_alloc_zero( sizeof(*infoPtr) );
636  SetWindowLongPtrW( hWnd, 0, (LONG_PTR)infoPtr );
637  infoPtr->hwnd = hWnd;
638 #ifdef __REACTOS__
639  SetRect(&infoPtr->rcTextMargin, 1,1,1,1);
640 #endif
641  return DefWindowProcW(hWnd, uMsg, wParam, lParam);
642 
643  case WM_NCDESTROY:
644  SetWindowLongPtrW( hWnd, 0, 0 );
645  heap_free(infoPtr);
646  break;
647 
648  case WM_CREATE:
649  if (btn_type >= MAX_BTN_TYPE)
650  return -1; /* abort */
651 
652  /* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
653  if (btn_type == BS_USERBUTTON )
654  {
657  }
658  infoPtr->state = BST_UNCHECKED;
660  return 0;
661 
662  case WM_DESTROY:
663  theme = GetWindowTheme( hWnd );
664  CloseThemeData( theme );
665  break;
666 
667  case WM_THEMECHANGED:
668  theme = GetWindowTheme( hWnd );
669  CloseThemeData( theme );
671 #ifdef __REACTOS__
673 #endif
674  break;
675 
676  case WM_ERASEBKGND:
677  if (btn_type == BS_OWNERDRAW)
678  {
679  HDC hdc = (HDC)wParam;
680  RECT rc;
681  HBRUSH hBrush;
683  if (!parent) parent = hWnd;
684  hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hdc, (LPARAM)hWnd);
685  if (!hBrush) /* did the app forget to call defwindowproc ? */
686  hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN,
687  (WPARAM)hdc, (LPARAM)hWnd);
688  GetClientRect(hWnd, &rc);
689  FillRect(hdc, &rc, hBrush);
690  }
691  return 1;
692 
693  case WM_PRINTCLIENT:
694  case WM_PAINT:
695  {
696  PAINTSTRUCT ps;
697  HDC hdc;
698 
699  theme = GetWindowTheme( hWnd );
700  hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
701 
702 #ifdef __REACTOS__
703  if (theme && BUTTON_PaintWithTheme(theme, infoPtr, hdc, uMsg == WM_PRINTCLIENT ? lParam : 0))
704  {
705  if ( !wParam ) EndPaint( hWnd, &ps );
706  return 0;
707  }
708 #else
709  if (theme && btnThemedPaintFunc[btn_type])
710  {
711  ButtonState drawState;
712  UINT dtflags;
713 
714  if (IsWindowEnabled( hWnd ))
715  {
716  if (infoPtr->state & BST_PUSHED) drawState = STATE_PRESSED;
717  else if (infoPtr->state & BST_HOT) drawState = STATE_HOT;
718  else if (infoPtr->state & BST_FOCUS) drawState = STATE_DEFAULTED;
719  else drawState = STATE_NORMAL;
720  }
721  else
722  drawState = STATE_DISABLED;
723 
725  btnThemedPaintFunc[btn_type](theme, infoPtr, hdc, drawState, dtflags, infoPtr->state & BST_FOCUS);
726  }
727 #endif
728  else if (btnPaintFunc[btn_type])
729  {
730  int nOldMode = SetBkMode( hdc, OPAQUE );
731  btnPaintFunc[btn_type]( infoPtr, hdc, ODA_DRAWENTIRE );
732  SetBkMode(hdc, nOldMode); /* reset painting mode */
733  }
734 
735  if ( !wParam ) EndPaint( hWnd, &ps );
736  break;
737  }
738 
739  case WM_KEYDOWN:
740  if (wParam == VK_SPACE)
741  {
743  infoPtr->state |= BUTTON_BTNPRESSED;
744  SetCapture( hWnd );
745  }
746  break;
747 
748  case WM_LBUTTONDBLCLK:
749  if(style & BS_NOTIFY ||
750  btn_type == BS_RADIOBUTTON ||
751  btn_type == BS_USERBUTTON ||
752  btn_type == BS_OWNERDRAW)
753  {
755  break;
756  }
757  /* fall through */
758  case WM_LBUTTONDOWN:
759  SetCapture( hWnd );
760  SetFocus( hWnd );
761  infoPtr->state |= BUTTON_BTNPRESSED;
763  break;
764 
765  case WM_KEYUP:
766  if (wParam != VK_SPACE)
767  break;
768  /* fall through */
769  case WM_LBUTTONUP:
770  state = infoPtr->state;
771  if (!(state & BUTTON_BTNPRESSED)) break;
772  infoPtr->state &= BUTTON_NSTATES;
773  if (!(state & BST_PUSHED))
774  {
775  ReleaseCapture();
776  break;
777  }
779  GetClientRect( hWnd, &rect );
780  if (uMsg == WM_KEYUP || PtInRect( &rect, pt ))
781  {
782  switch(btn_type)
783  {
784  case BS_AUTOCHECKBOX:
785  SendMessageW( hWnd, BM_SETCHECK, !(infoPtr->state & BST_CHECKED), 0 );
786  break;
787  case BS_AUTORADIOBUTTON:
788 #ifdef __REACTOS__
790 #else
792 #endif
793  break;
794  case BS_AUTO3STATE:
795  SendMessageW( hWnd, BM_SETCHECK, (infoPtr->state & BST_INDETERMINATE) ? 0 :
796  ((infoPtr->state & 3) + 1), 0 );
797  break;
798  }
799 #ifdef __REACTOS__
800  // Fix CORE-10194, Notify parent after capture is released.
801  ReleaseCapture();
803 #else
805  ReleaseCapture();
806 #endif
807  }
808  else
809  {
810  ReleaseCapture();
811  }
812 
813  break;
814 
815  case WM_CAPTURECHANGED:
816  TRACE("WM_CAPTURECHANGED %p\n", hWnd);
817  if (hWnd == (HWND)lParam) break;
818  if (infoPtr->state & BUTTON_BTNPRESSED)
819  {
820  infoPtr->state &= BUTTON_NSTATES;
821  if (infoPtr->state & BST_PUSHED)
823  }
824  break;
825 
826  case WM_MOUSEMOVE:
827  {
829  mouse_event.cbSize = sizeof(TRACKMOUSEEVENT);
830  mouse_event.dwFlags = TME_QUERY;
831 
832 #ifdef __REACTOS__
833  if ((infoPtr->state & BST_HOT) == 0)
834  {
835  NMBCHOTITEM nmhotitem;
836 
837  infoPtr->state |= BST_HOT;
838 
839  nmhotitem.hdr.hwndFrom = hWnd;
840  nmhotitem.hdr.idFrom = GetWindowLongPtrW (hWnd, GWLP_ID);
841  nmhotitem.hdr.code = BCN_HOTITEMCHANGE;
842  nmhotitem.dwFlags = HICF_ENTERING;
843  SendMessageW(GetParent(hWnd), WM_NOTIFY, nmhotitem.hdr.idFrom, (LPARAM)&nmhotitem);
844 
846  }
847 
848  if(!TrackMouseEvent(&mouse_event) || !(mouse_event.dwFlags&TME_LEAVE))
849  {
850  mouse_event.dwFlags = TME_LEAVE;
851  mouse_event.hwndTrack = hWnd;
852  mouse_event.dwHoverTime = 1;
854  }
855  break;
856 #else
857 
858  if (!TrackMouseEvent(&mouse_event) || !(mouse_event.dwFlags & (TME_HOVER | TME_LEAVE)))
859  {
860  mouse_event.dwFlags = TME_HOVER | TME_LEAVE;
861  mouse_event.hwndTrack = hWnd;
862  mouse_event.dwHoverTime = 1;
864  }
865 
866  if ((wParam & MK_LBUTTON) && GetCapture() == hWnd)
867  {
868  GetClientRect( hWnd, &rect );
870  }
871  break;
872 #endif
873  }
874 
875 #ifndef __REACTOS__
876  case WM_MOUSEHOVER:
877  {
878  infoPtr->state |= BST_HOT;
880  break;
881  }
882 #endif
883 
884  case WM_MOUSELEAVE:
885  {
886 #ifdef __REACTOS__
887  if (infoPtr->state & BST_HOT)
888  {
889  NMBCHOTITEM nmhotitem;
890 
891  infoPtr->state &= ~BST_HOT;
892 
893  nmhotitem.hdr.hwndFrom = hWnd;
894  nmhotitem.hdr.idFrom = GetWindowLongPtrW (hWnd, GWLP_ID);
895  nmhotitem.hdr.code = BCN_HOTITEMCHANGE;
896  nmhotitem.dwFlags = HICF_LEAVING;
897  SendMessageW(GetParent(hWnd), WM_NOTIFY, nmhotitem.hdr.idFrom, (LPARAM)&nmhotitem);
898 
900  }
901  break;
902 #else
903  infoPtr->state &= ~BST_HOT;
905  break;
906 #endif
907  }
908 
909 #ifdef __REACTOS__
910  case BCM_GETTEXTMARGIN:
911  {
912  RECT* prc = (RECT*)lParam;
913  if (!prc)
914  return FALSE;
915  *prc = infoPtr->rcTextMargin;
916  return TRUE;
917  }
918  case BCM_SETTEXTMARGIN:
919  {
920  RECT* prc = (RECT*)lParam;
921  if (!prc)
922  return FALSE;
923  infoPtr->rcTextMargin = *prc;
924  return TRUE;
925  }
926  case BCM_SETIMAGELIST:
927  {
928  BUTTON_IMAGELIST * pimldata = (BUTTON_IMAGELIST *)lParam;
929  if (!pimldata || !pimldata->himl)
930  return FALSE;
931  infoPtr->imlData = *pimldata;
932  return TRUE;
933  }
934  case BCM_GETIMAGELIST:
935  {
936  BUTTON_IMAGELIST * pimldata = (BUTTON_IMAGELIST *)lParam;
937  if (!pimldata)
938  return FALSE;
939  *pimldata = infoPtr->imlData;
940  return TRUE;
941  }
942  case BCM_GETIDEALSIZE:
943  {
944  HTHEME theme = GetWindowTheme(hWnd);
945  BOOL ret = FALSE;
946  SIZE* pSize = (SIZE*)lParam;
947 
948  if (!pSize)
949  {
950  return FALSE;
951  }
952 
953  if (btn_type == BS_PUSHBUTTON ||
954  btn_type == BS_DEFPUSHBUTTON ||
955  btn_type == BS_USERBUTTON)
956  {
957  ret = BUTTON_GetIdealSize(infoPtr, theme, pSize);
958  }
959 
960  if (!ret)
961  {
963  pSize->cx = rect.right;
964  pSize->cy = rect.bottom;
965  }
966 
967  return TRUE;
968  }
969 #endif
970 
971  case WM_SETTEXT:
972  {
973  /* Clear an old text here as Windows does */
974 #ifdef __REACTOS__
975 //
976 // ReactOS Note :
977 // wine Bug: http://bugs.winehq.org/show_bug.cgi?id=25790
978 // Patch: http://source.winehq.org/patches/data/70889
979 // By: Alexander LAW, Replicate Windows behavior of WM_SETTEXT handler regarding WM_CTLCOLOR*
980 //
981  if (style & WS_VISIBLE)
982 #else
983  if (IsWindowVisible(hWnd))
984 #endif
985  {
986  HDC hdc = GetDC(hWnd);
987  HBRUSH hbrush;
988  RECT client, rc;
990  UINT message = (btn_type == BS_PUSHBUTTON ||
991  btn_type == BS_DEFPUSHBUTTON ||
992  btn_type == BS_USERBUTTON ||
993  btn_type == BS_OWNERDRAW) ?
995 
996  if (!parent) parent = hWnd;
997  hbrush = (HBRUSH)SendMessageW(parent, message,
998  (WPARAM)hdc, (LPARAM)hWnd);
999  if (!hbrush) /* did the app forget to call DefWindowProc ? */
1000  hbrush = (HBRUSH)DefWindowProcW(parent, message,
1001  (WPARAM)hdc, (LPARAM)hWnd);
1002 
1004  rc = client;
1005  /* FIXME: check other BS_* handlers */
1006  if (btn_type == BS_GROUPBOX)
1007  InflateRect(&rc, -7, 1); /* GB_Paint does this */
1008  BUTTON_CalcLabelRect(infoPtr, hdc, &rc);
1009  /* Clip by client rect bounds */
1010  if (rc.right > client.right) rc.right = client.right;
1011  if (rc.bottom > client.bottom) rc.bottom = client.bottom;
1012  FillRect(hdc, &rc, hbrush);
1013  ReleaseDC(hWnd, hdc);
1014  }
1015 
1017  if (btn_type == BS_GROUPBOX) /* Yes, only for BS_GROUPBOX */
1019  else
1020  paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
1021  return 1; /* success. FIXME: check text length */
1022  }
1023 
1024  case WM_SETFONT:
1025  infoPtr->font = (HFONT)wParam;
1027  break;
1028 
1029  case WM_GETFONT:
1030  return (LRESULT)infoPtr->font;
1031 
1032  case WM_SETFOCUS:
1033  TRACE("WM_SETFOCUS %p\n",hWnd);
1034  infoPtr->state |= BST_FOCUS;
1035 #ifdef __REACTOS__
1036  if (btn_type != BS_OWNERDRAW)
1038  else
1039 #endif
1040  paint_button( infoPtr, btn_type, ODA_FOCUS );
1041  if (style & BS_NOTIFY)
1043  break;
1044 
1045  case WM_KILLFOCUS:
1046  TRACE("WM_KILLFOCUS %p\n",hWnd);
1047  infoPtr->state &= ~BST_FOCUS;
1048 #ifndef __REACTOS__
1049  paint_button( infoPtr, btn_type, ODA_FOCUS );
1050 #endif
1051 
1052  if ((infoPtr->state & BUTTON_BTNPRESSED) && GetCapture() == hWnd)
1053  ReleaseCapture();
1054  if (style & BS_NOTIFY)
1056 
1058  break;
1059 
1060  case WM_SYSCOLORCHANGE:
1062  break;
1063 
1064  case BM_SETSTYLE:
1065  btn_type = wParam & BS_TYPEMASK;
1066  style = (style & ~BS_TYPEMASK) | btn_type;
1068 
1069  /* Only redraw if lParam flag is set.*/
1070  if (lParam)
1072 
1073  break;
1074 
1075  case BM_CLICK:
1076 #ifdef __REACTOS__
1077  /* Fix for core CORE-6024 */
1078  if (infoPtr->state & BUTTON_BMCLICK)
1079  break;
1080  infoPtr->state |= BUTTON_BMCLICK;
1081 #endif
1082  SendMessageW( hWnd, WM_LBUTTONDOWN, 0, 0 );
1083  SendMessageW( hWnd, WM_LBUTTONUP, 0, 0 );
1084 #ifdef __REACTOS__
1085  infoPtr->state &= ~BUTTON_BMCLICK;
1086 #endif
1087  break;
1088 
1089  case BM_SETIMAGE:
1090  /* Check that image format matches button style */
1091  switch (style & (BS_BITMAP|BS_ICON))
1092  {
1093  case BS_BITMAP:
1094  if (wParam != IMAGE_BITMAP) return 0;
1095  break;
1096  case BS_ICON:
1097  if (wParam != IMAGE_ICON) return 0;
1098  break;
1099  default:
1100  return 0;
1101  }
1102  oldHbitmap = infoPtr->u.image;
1103  infoPtr->u.image = (HANDLE)lParam;
1105  return (LRESULT)oldHbitmap;
1106 
1107  case BM_GETIMAGE:
1108  return (LRESULT)infoPtr->u.image;
1109 
1110  case BM_GETCHECK:
1111  return infoPtr->state & 3;
1112 
1113  case BM_SETCHECK:
1114  if (wParam > maxCheckState[btn_type]) wParam = maxCheckState[btn_type];
1115  if ((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON))
1116  {
1119  }
1120  if ((infoPtr->state & 3) != wParam)
1121  {
1122  infoPtr->state = (infoPtr->state & ~3) | wParam;
1124  }
1125 #ifndef __REACTOS__
1126  if ((btn_type == BS_AUTORADIOBUTTON) && (wParam == BST_CHECKED) && (style & WS_CHILD))
1128 #endif
1129  break;
1130 
1131  case BM_GETSTATE:
1132  return infoPtr->state;
1133 
1134  case BM_SETSTATE:
1135  state = infoPtr->state;
1136  new_state = wParam ? BST_PUSHED : 0;
1137 
1138  if ((state ^ new_state) & BST_PUSHED)
1139  {
1140  if (wParam)
1141  state |= BST_PUSHED;
1142  else
1143  state &= ~BST_PUSHED;
1144 
1145  if (btn_type == BS_USERBUTTON)
1147  infoPtr->state = state;
1148 
1150  }
1151  break;
1152 
1153 #ifdef __REACTOS__
1154  case WM_UPDATEUISTATE:
1155  DefWindowProcW(hWnd, uMsg, wParam, lParam);
1156 
1157  if (button_update_uistate(infoPtr))
1158  paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
1159  break;
1160 #endif
1161 
1162  case WM_NCHITTEST:
1163  if(btn_type == BS_GROUPBOX) return HTTRANSPARENT;
1164  /* fall through */
1165  default:
1166  return DefWindowProcW(hWnd, uMsg, wParam, lParam);
1167  }
1168  return 0;
1169 }
#define BS_NOTIFY
Definition: winuser.h:268
HIMAGELIST himl
Definition: commctrl.h:4606
#define BM_SETSTATE
Definition: winuser.h:1884
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
#define BS_OWNERDRAW
Definition: pedump.c:661
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
Definition: tftpd.h:59
#define HTTRANSPARENT
Definition: winuser.h:2427
#define TRUE
Definition: types.h:120
#define DLGC_UNDEFPUSHBUTTON
Definition: winuser.h:2570
#define IMAGE_ICON
Definition: winuser.h:212
static HBRUSH hbrush
#define BS_DEFCOMMANDLINK
Definition: commctrl.h:4644
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define BCM_SETTEXTMARGIN
Definition: commctrl.h:4620
#define BS_DEFSPLITBUTTON
Definition: commctrl.h:4642
#define MK_LBUTTON
Definition: winuser.h:2321
HDC WINAPI GetDC(_In_opt_ HWND)
#define BS_RADIOBUTTON
Definition: pedump.c:655
#define pt(x, y)
Definition: drawing.c:79
#define WM_MOUSEHOVER
Definition: commctrl.h:4945
#define BM_GETSTATE
Definition: winuser.h:1881
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1748
#define BCM_GETTEXTMARGIN
Definition: commctrl.h:4622
#define WM_CAPTURECHANGED
Definition: winuser.h:1784
HANDLE image
Definition: button.c:102
static const WORD maxCheckState[MAX_BTN_TYPE]
Definition: button.c:122
static HDC
Definition: imagelist.c:92
#define DLGC_RADIOBUTTON
Definition: winuser.h:2571
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
HWND hWnd
Definition: settings.c:17
#define BUTTON_NSTATES
Definition: button.c:77
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define GWL_EXSTYLE
Definition: winuser.h:845
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_NCHITTEST
Definition: winuser.h:1668
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define GetWindowLongPtrW
Definition: winuser.h:4698
#define RDW_FRAME
Definition: winuser.h:1198
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:293
#define ODA_FOCUS
Definition: winuser.h:2498
#define BM_GETIMAGE
Definition: winuser.h:1880
#define WM_NCCREATE
Definition: winuser.h:1665
#define BM_SETIMAGE
Definition: winuser.h:1883
#define BS_GROUPBOX
Definition: pedump.c:658
#define BN_UNHILITE
Definition: winuser.h:1895
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define BST_INDETERMINATE
Definition: winuser.h:198
#define WM_ENABLE
Definition: winuser.h:1597
#define WM_PRINTCLIENT
Definition: richedit.h:70
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI TrackMouseEvent(_Inout_ LPTRACKMOUSEEVENT)
UINT code
Definition: winuser.h:3112
static const pfPaint btnPaintFunc[MAX_BTN_TYPE]
Definition: button.c:154
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define WM_CTLCOLORBTN
Definition: winuser.h:1745
#define BST_HOT
Definition: commctrl.h:4639
#define HICF_ENTERING
Definition: commctrl.h:1302
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
UINT_PTR idFrom
Definition: winuser.h:3111
ButtonState
Definition: button.c:143
HWND WINAPI GetCapture(void)
Definition: message.c:2879
#define WM_MOUSELEAVE
Definition: commctrl.h:4946
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define HICF_LEAVING
Definition: commctrl.h:1303
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
#define WM_GETFONT
Definition: winuser.h:1633
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
#define BS_AUTO3STATE
Definition: pedump.c:657
LONG cx
Definition: windef.h:319
#define WM_KEYDOWN
Definition: winuser.h:1691
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1879
BOOL WINAPI IsWindowEnabled(_In_ HWND)
static UINT BUTTON_CalcLabelRect(const BUTTON_INFO *infoPtr, HDC hdc, RECT *rc)
Definition: button.c:1181
#define BST_FOCUS
Definition: winuser.h:200
#define WM_SETTEXT
Definition: winuser.h:1599
#define WM_DESTROY
Definition: winuser.h:1591
#define BN_HILITE
Definition: winuser.h:1890
#define BUTTON_NOTIFY_PARENT(hWnd, code)
Definition: button.c:85
#define BM_CLICK
Definition: winuser.h:1878
#define ODA_DRAWENTIRE
Definition: winuser.h:2496
#define DLGC_DEFPUSHBUTTON
Definition: winuser.h:2569
#define BM_SETCHECK
Definition: winuser.h:1882
#define TRACE(s)
Definition: solgame.cpp:4
#define BS_COMMANDLINK
Definition: commctrl.h:4643
#define WM_KILLFOCUS
Definition: winuser.h:1596
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2708
#define BM_SETSTYLE
Definition: winuser.h:1885
#define BST_PUSHED
Definition: winuser.h:201
#define WM_NCDESTROY
Definition: winuser.h:1666
#define WM_KEYUP
Definition: winuser.h:1692
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static UINT BUTTON_BStoDT(DWORD style, DWORD ex_style)
Definition: button.c:262
#define TME_QUERY
Definition: commctrl.h:4954
static FILE * client
Definition: client.c:41
#define BN_CLICKED
Definition: winuser.h:1886
PVOID HANDLE
Definition: typedefs.h:71
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
#define MAX_BTN_TYPE
Definition: button.c:120
static LPARAM
Definition: button.c:42
#define BN_KILLFOCUS
Definition: winuser.h:1891
#define WM_PAINT
Definition: winuser.h:1602
#define BS_SPLITBUTTON
Definition: commctrl.h:4641
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
int ret
#define BS_ICON
Definition: winuser.h:264
#define BCM_GETIMAGELIST
Definition: commctrl.h:4617
#define OPAQUE
Definition: wingdi.h:948
struct tagTRACKMOUSEEVENT TRACKMOUSEEVENT
HDC hdc
Definition: main.c:9
#define BS_BITMAP
Definition: winuser.h:258
static int state
Definition: maze.c:121
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1754
#define WS_TABSTOP
Definition: pedump.c:634
HFONT font
Definition: button.c:97
static UINT get_button_type(LONG window_style)
Definition: button.c:211
HWND hwndFrom
Definition: winuser.h:3110
#define BST_UNCHECKED
Definition: winuser.h:199
#define BUTTON_BTNPRESSED
Definition: button.c:78
#define BS_PUSHBUTTON
Definition: pedump.c:651
LONG state
Definition: button.c:96
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define BN_SETFOCUS
Definition: winuser.h:1894
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define BS_AUTORADIOBUTTON
Definition: pedump.c:660
#define TME_HOVER
Definition: commctrl.h:4951
#define BS_TYPEMASK
Definition: winuser.h:270
#define WC_BUTTONW
Definition: commctrl.h:4595
#define DLGC_BUTTON
Definition: winuser.h:2574
#define TME_LEAVE
Definition: commctrl.h:4952
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_LBUTTONUP
Definition: winuser.h:1753
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define WM_MOUSEMOVE
Definition: winuser.h:1751
#define VK_SPACE
Definition: winuser.h:2173
#define IMAGE_BITMAP
Definition: winuser.h:211
static const pfThemedPaint btnThemedPaintFunc[MAX_BTN_TYPE]
Definition: button.c:191
#define WM_SETFONT
Definition: winuser.h:1632
#define BST_CHECKED
Definition: winuser.h:197
union _BUTTON_INFO::@318 u
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define RDW_UPDATENOW
Definition: winuser.h:1206
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
static void paint_button(BUTTON_INFO *infoPtr, LONG style, UINT action)
Definition: button.c:218
#define WM_CREATE
Definition: winuser.h:1590
static void BUTTON_CheckAutoRadioButton(HWND hwnd)
Definition: button.c:1648
#define HIWORD(l)
Definition: typedefs.h:246
BOOL WINAPI IsWindowVisible(_In_ HWND)
LONG bottom
Definition: windef.h:294
#define BCM_GETIDEALSIZE
Definition: commctrl.h:4611
#define BN_DOUBLECLICKED
Definition: winuser.h:1889
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define BS_USERBUTTON
Definition: pedump.c:659
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define WM_SETFOCUS
Definition: winuser.h:1595
#define BCN_HOTITEMCHANGE
Definition: commctrl.h:4637
LONG_PTR LRESULT
Definition: windef.h:209
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
Arabic default style
Definition: afstyles.h:93
_Out_ LPRECT prc
Definition: ntgdi.h:1658
#define WS_VISIBLE
Definition: pedump.c:620
#define BCM_SETIMAGELIST
Definition: commctrl.h:4614
LONG cy
Definition: windef.h:320
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define GWLP_ID
Definition: winuser.h:854
#define DLGC_WANTARROWS
Definition: winuser.h:2564
#define DLGC_STATIC
Definition: winuser.h:2573
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
#define WM_NOTIFY
Definition: richedit.h:61
#define RDW_INVALIDATE
Definition: winuser.h:1200
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by BUTTON_Register().

◆ CB_Paint()

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

Definition at line 1515 of file button.c.

1516 {
1517  RECT rbox, rtext, client;
1518  HBRUSH hBrush;
1519  int delta, text_offset, checkBoxWidth, checkBoxHeight;
1520  UINT dtFlags;
1521  HFONT hFont;
1522  LONG state = infoPtr->state;
1523  LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1524  LONG ex_style = GetWindowLongW( infoPtr->hwnd, GWL_EXSTYLE );
1525  HWND parent;
1526  HRGN hrgn;
1527 
1528  if (style & BS_PUSHLIKE)
1529  {
1530  PB_Paint( infoPtr, hDC, action );
1531  return;
1532  }
1533 
1534  GetClientRect(infoPtr->hwnd, &client);
1535  rbox = rtext = client;
1536 
1537  checkBoxWidth = 12 * GetDeviceCaps( hDC, LOGPIXELSX ) / 96 + 1;
1538  checkBoxHeight = 12 * GetDeviceCaps( hDC, LOGPIXELSY ) / 96 + 1;
1539 
1540  if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1541  GetCharWidthW( hDC, '0', '0', &text_offset );
1542  text_offset /= 2;
1543 
1544  parent = GetParent(infoPtr->hwnd);
1545  if (!parent) parent = infoPtr->hwnd;
1546  hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1547  if (!hBrush) /* did the app forget to call defwindowproc ? */
1548  hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1550 
1551  if (style & BS_LEFTTEXT || ex_style & WS_EX_RIGHT)
1552  {
1553  rtext.right -= checkBoxWidth + text_offset;
1554  rbox.left = rbox.right - checkBoxWidth;
1555  }
1556  else
1557  {
1558  rtext.left += checkBoxWidth + text_offset;
1559  rbox.right = checkBoxWidth;
1560  }
1561 
1562  /* Since WM_ERASEBKGND does nothing, first prepare background */
1563  if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
1564  if (action == ODA_DRAWENTIRE) FillRect( hDC, &client, hBrush );
1565 
1566  /* Draw label */
1567  client = rtext;
1568  dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &rtext);
1569 
1570  /* Only adjust rbox when rtext is valid */
1571  if (dtFlags != (UINT)-1L)
1572  {
1573  rbox.top = rtext.top;
1574  rbox.bottom = rtext.bottom;
1575  }
1576 
1577  /* Draw the check-box bitmap */
1578  if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
1579  {
1580  UINT flags;
1581 
1582  if ((get_button_type(style) == BS_RADIOBUTTON) ||
1585  else flags = DFCS_BUTTONCHECK;
1586 
1588  if (state & BST_PUSHED) flags |= DFCS_PUSHED;
1589 
1591 
1592  /* rbox must have the correct height */
1593  delta = rbox.bottom - rbox.top - checkBoxHeight;
1594 
1595  if (style & BS_TOP) {
1596  if (delta > 0) {
1597  rbox.bottom = rbox.top + checkBoxHeight;
1598  } else {
1599  rbox.top -= -delta/2 + 1;
1600  rbox.bottom = rbox.top + checkBoxHeight;
1601  }
1602  } else if (style & BS_BOTTOM) {
1603  if (delta > 0) {
1604  rbox.top = rbox.bottom - checkBoxHeight;
1605  } else {
1606  rbox.bottom += -delta/2 + 1;
1607  rbox.top = rbox.bottom - checkBoxHeight;
1608  }
1609  } else { /* Default */
1610  if (delta > 0) {
1611  int ofs = (delta / 2);
1612  rbox.bottom -= ofs + 1;
1613  rbox.top = rbox.bottom - checkBoxHeight;
1614  } else if (delta < 0) {
1615  int ofs = (-delta / 2);
1616  rbox.top -= ofs + 1;
1617  rbox.bottom = rbox.top + checkBoxHeight;
1618  }
1619  }
1620 
1621  DrawFrameControl( hDC, &rbox, DFC_BUTTON, flags );
1622  }
1623 
1624  if (dtFlags == (UINT)-1L) /* Noting to draw */
1625  return;
1626 
1627  if (action == ODA_DRAWENTIRE)
1628  BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &rtext);
1629 
1630  /* ... and focus */
1631  if (action == ODA_FOCUS || (state & BST_FOCUS))
1632  {
1633  rtext.left--;
1634  rtext.right++;
1635  IntersectRect(&rtext, &rtext, &client);
1636  DrawFocusRect( hDC, &rtext );
1637  }
1638  SelectClipRgn( hDC, hrgn );
1639  if (hrgn) DeleteObject( hrgn );
1640 }
#define WS_DISABLED
Definition: pedump.c:621
BOOL WINAPI GetCharWidthW(_In_ HDC hdc, _In_ UINT iFirst, _In_ UINT iLast, _Out_writes_(iLast+1 - iFirst) LPINT lpBuffer)
#define LOGPIXELSX
Definition: wingdi.h:717
static void BUTTON_DrawLabel(const BUTTON_INFO *infoPtr, HDC hdc, UINT dtFlags, const RECT *rc)
Definition: button.c:1324
#define DFC_BUTTON
Definition: winuser.h:476
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define BS_LEFTTEXT
Definition: pedump.c:662
#define DFCS_CHECKED
Definition: winuser.h:504
static void PB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1392
#define BS_RADIOBUTTON
Definition: pedump.c:655
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1748
#define DFCS_BUTTON3STATE
Definition: winuser.h:500
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define DFCS_INACTIVE
Definition: winuser.h:502
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define GWL_EXSTYLE
Definition: winuser.h:845
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
UINT_PTR WPARAM
Definition: windef.h:207
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define ODA_FOCUS
Definition: winuser.h:2498
#define WS_EX_RIGHT
Definition: winuser.h:400
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:239
#define BST_INDETERMINATE
Definition: winuser.h:198
HFONT hFont
Definition: main.c:53
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DFCS_PUSHED
Definition: winuser.h:503
#define DFCS_BUTTONRADIO
Definition: winuser.h:499
long LONG
Definition: pedump.c:60
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
static UINT BUTTON_CalcLabelRect(const BUTTON_INFO *infoPtr, HDC hdc, RECT *rc)
Definition: button.c:1181
#define BST_FOCUS
Definition: winuser.h:200
#define ODA_DRAWENTIRE
Definition: winuser.h:2496
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2708
#define BST_PUSHED
Definition: winuser.h:201
#define BS_TOP
Definition: winuser.h:277
static FILE * client
Definition: client.c:41
GLbitfield flags
Definition: glext.h:7161
static LPARAM
Definition: button.c:42
static const WCHAR L[]
Definition: oid.c:1250
static HRGN hrgn
Definition: win.c:55
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
static int state
Definition: maze.c:121
HFONT font
Definition: button.c:97
static UINT get_button_type(LONG window_style)
Definition: button.c:211
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
LONG state
Definition: button.c:96
#define GWL_STYLE
Definition: winuser.h:846
#define DFCS_BUTTONCHECK
Definition: winuser.h:496
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
#define BS_AUTORADIOBUTTON
Definition: pedump.c:660
const WCHAR * action
Definition: action.c:7783
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define BS_BOTTOM
Definition: winuser.h:259
#define BST_CHECKED
Definition: winuser.h:197
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define BS_PUSHLIKE
Definition: winuser.h:272
LONG bottom
Definition: windef.h:294
#define LOGPIXELSY
Definition: wingdi.h:718
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
Arabic default style
Definition: afstyles.h:93
#define ODA_SELECT
Definition: winuser.h:2497

◆ CB_ThemedPaint()

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

Definition at line 1896 of file button.c.

1898 {
1899  static const int cb_states[3][5] =
1900  {
1904  };
1905 
1906  static const int rb_states[2][5] =
1907  {
1910  };
1911 
1912  SIZE sz;
1913  RECT bgRect, textRect;
1914  HFONT font, hPrevFont = NULL;
1915  int checkState = infoPtr->state & 3;
1916  DWORD dwStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
1917  UINT btn_type = get_button_type( dwStyle );
1918  int part = (btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON) ? BP_RADIOBUTTON : BP_CHECKBOX;
1919  int state = (part == BP_CHECKBOX)
1920  ? cb_states[ checkState ][ drawState ]
1921  : rb_states[ checkState ][ drawState ];
1922  WCHAR *text = get_button_text(infoPtr);
1923  LOGFONTW lf;
1924  BOOL created_font = FALSE;
1925 #ifdef __REACTOS__
1926  HWND parent;
1927  HBRUSH hBrush;
1928  DWORD cdrf;
1929 #endif
1930 
1931  HRESULT hr = GetThemeFont(theme, hDC, part, state, TMT_FONT, &lf);
1932  if (SUCCEEDED(hr)) {
1933  font = CreateFontIndirectW(&lf);
1934  if (!font)
1935  TRACE("Failed to create font\n");
1936  else {
1937  TRACE("font = %s\n", debugstr_w(lf.lfFaceName));
1938  hPrevFont = SelectObject(hDC, font);
1939  created_font = TRUE;
1940  }
1941  } else {
1942 #ifdef __REACTOS__ /* r73885 */
1943  font = infoPtr->font;
1944 #else
1945  font = (HFONT)SendMessageW(infoPtr->hwnd, WM_GETFONT, 0, 0);
1946 #endif
1947  hPrevFont = SelectObject(hDC, font);
1948  }
1949 
1950  if (FAILED(GetThemePartSize(theme, hDC, part, state, NULL, TS_DRAW, &sz)))
1951  sz.cx = sz.cy = 13;
1952 
1953  GetClientRect(infoPtr->hwnd, &bgRect);
1954 
1955 #ifdef __REACTOS__
1956  if (prfFlag == 0)
1957  {
1958  DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
1959  }
1960 
1961  parent = GetParent(infoPtr->hwnd);
1962  if (!parent) parent = infoPtr->hwnd;
1963  hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
1964  (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1965  if (!hBrush) /* did the app forget to call defwindowproc ? */
1966  hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
1967  (WPARAM)hDC, (LPARAM)infoPtr->hwnd );
1968  FillRect( hDC, &bgRect, hBrush );
1969 
1970  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &bgRect);
1971  if (cdrf == CDRF_SKIPDEFAULT)
1972  goto cleanup;
1973 #endif
1974 
1975  GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &textRect);
1976 
1977  if (dtFlags & DT_SINGLELINE) /* Center the checkbox / radio button to the text. */
1978  bgRect.top = bgRect.top + (textRect.bottom - textRect.top - sz.cy) / 2;
1979 
1980  /* adjust for the check/radio marker */
1981  bgRect.bottom = bgRect.top + sz.cy;
1982  bgRect.right = bgRect.left + sz.cx;
1983  textRect.left = bgRect.right + 6;
1984 
1985 #ifdef __REACTOS__
1986  DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
1987 
1988  if (cdrf == CDRF_NOTIFYPOSTERASE)
1989  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &bgRect);
1990 
1991  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &bgRect);
1992  if (cdrf == CDRF_SKIPDEFAULT)
1993  goto cleanup;
1994 
1995 #else
1996  DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
1997  DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
1998 #endif
1999  if (text)
2000  {
2001  DrawThemeText(theme, hDC, part, state, text, lstrlenW(text), dtFlags, 0, &textRect);
2002 
2003  if (focused)
2004  {
2005  RECT focusRect;
2006 
2007  focusRect = textRect;
2008 
2009  DrawTextW(hDC, text, lstrlenW(text), &focusRect, dtFlags | DT_CALCRECT);
2010 
2011  if (focusRect.right < textRect.right) focusRect.right++;
2012  focusRect.bottom = textRect.bottom;
2013 
2014  DrawFocusRect( hDC, &focusRect );
2015  }
2016 
2017  heap_free(text);
2018 #ifdef __REACTOS__
2019  text = NULL;
2020 #endif
2021  }
2022 
2023 #ifdef __REACTOS__
2024  if (cdrf == CDRF_NOTIFYPOSTPAINT)
2025  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
2026 cleanup:
2027  if (text) heap_free(text);
2028 #endif
2029  if (created_font) DeleteObject(font);
2030  if (hPrevFont) SelectObject(hDC, hPrevFont);
2031 }
HRESULT WINAPI GetThemePartSize(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, THEMESIZE eSize, SIZE *psz)
Definition: draw.c:1777
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define CDDS_POSTERASE
Definition: commctrl.h:268
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:259
Definition: mk_font.cpp:20
#define BS_RADIOBUTTON
Definition: pedump.c:655
static WCHAR * get_button_text(const BUTTON_INFO *infoPtr)
Definition: button.c:230
const WCHAR * text
Definition: package.c:1827
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1748
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
LONG top
Definition: windef.h:292
#define CDDS_POSTPAINT
Definition: commctrl.h:266
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, LOGFONTW *pFont)
Definition: property.c:108
LONG left
Definition: windef.h:291
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:255
LONG right
Definition: windef.h:293
#define lstrlenW
Definition: compat.h:407
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DT_CALCRECT
Definition: winuser.h:526
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
RECT textRect
Definition: startmenu.cpp:1392
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define WM_GETFONT
Definition: winuser.h:1633
LONG cx
Definition: windef.h:319
#define TMT_FONT
Definition: vssym32.h:144
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
#define TRACE(s)
Definition: solgame.cpp:4
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2708
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static LPARAM
Definition: button.c:42
#define CDDS_PREPAINT
Definition: commctrl.h:265
static int state
Definition: maze.c:121
HFONT font
Definition: button.c:97
static UINT get_button_type(LONG window_style)
Definition: button.c:211
LONG state
Definition: button.c:96
#define GWL_STYLE
Definition: winuser.h:846
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DT_SINGLELINE
Definition: winuser.h:540
HWND WINAPI GetParent(_In_ HWND)
#define BS_AUTORADIOBUTTON
Definition: pedump.c:660
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define CDRF_NOTIFYPOSTERASE
Definition: commctrl.h:262
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect)
Definition: draw.c:1479
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
LONG bottom
Definition: windef.h:294
char * cleanup(char *str)
Definition: wpickclick.c:99
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
LONG cy
Definition: windef.h:320
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:1377
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define CDDS_PREERASE
Definition: commctrl.h:267
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ GB_Paint()

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

Definition at line 1679 of file button.c.

1680 {
1681  RECT rc, rcFrame;
1682  HBRUSH hbr;
1683  HFONT hFont;
1684  UINT dtFlags;
1685  TEXTMETRICW tm;
1686  LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1687  HWND parent;
1688  HRGN hrgn;
1689 
1690  if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1691  /* GroupBox acts like static control, so it sends CTLCOLORSTATIC */
1692  parent = GetParent(infoPtr->hwnd);
1693  if (!parent) parent = infoPtr->hwnd;
1694  hbr = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1695  if (!hbr) /* did the app forget to call defwindowproc ? */
1696  hbr = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1697  GetClientRect( infoPtr->hwnd, &rc);
1698  rcFrame = rc;
1699  hrgn = set_control_clipping( hDC, &rc );
1700 
1701  GetTextMetricsW (hDC, &tm);
1702  rcFrame.top += (tm.tmHeight / 2) - 1;
1703  DrawEdge (hDC, &rcFrame, EDGE_ETCHED, BF_RECT | ((style & BS_FLAT) ? BF_FLAT : 0));
1704 
1705  InflateRect(&rc, -7, 1);
1706  dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &rc);
1707 
1708  if (dtFlags != (UINT)-1)
1709  {
1710  /* Because buttons have CS_PARENTDC class style, there is a chance
1711  * that label will be drawn out of client rect.
1712  * But Windows doesn't clip label's rect, so do I.
1713  */
1714 
1715  /* There is 1-pixel margin at the left, right, and bottom */
1716  rc.left--; rc.right++; rc.bottom++;
1717  FillRect(hDC, &rc, hbr);
1718  rc.left++; rc.right--; rc.bottom--;
1719 
1720  BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &rc);
1721  }
1722  SelectClipRgn( hDC, hrgn );
1723  if (hrgn) DeleteObject( hrgn );
1724 }
#define BF_FLAT
Definition: winuser.h:471
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
static void BUTTON_DrawLabel(const BUTTON_INFO *infoPtr, HDC hdc, UINT dtFlags, const RECT *rc)
Definition: button.c:1324
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1748
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:239
HFONT hFont
Definition: main.c:53
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BF_RECT
Definition: winuser.h:462
long LONG
Definition: pedump.c:60
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
static UINT BUTTON_CalcLabelRect(const BUTTON_INFO *infoPtr, HDC hdc, RECT *rc)
Definition: button.c:1181
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2708
#define EDGE_ETCHED
Definition: winuser.h:452
static LPARAM
Definition: button.c:42
static HRGN hrgn
Definition: win.c:55
Definition: time.h:76
HFONT font
Definition: button.c:97
#define BS_FLAT
Definition: winuser.h:280
#define GWL_STYLE
Definition: winuser.h:846
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG bottom
Definition: windef.h:294
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
Arabic default style
Definition: afstyles.h:93

◆ GB_ThemedPaint()

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

Definition at line 2036 of file button.c.

2038 {
2039  static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };
2040 
2041  RECT bgRect, textRect, contentRect;
2042  int state = states[ drawState ];
2043  WCHAR *text = get_button_text(infoPtr);
2044  LOGFONTW lf;
2045  HFONT font, hPrevFont = NULL;
2046  BOOL created_font = FALSE;
2047 #ifdef __REACTOS__ /* r74406 */
2048  HWND parent;
2049  HBRUSH hBrush;
2050  RECT clientRect;
2051 #endif
2052 
2053  HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf);
2054  if (SUCCEEDED(hr)) {
2055  font = CreateFontIndirectW(&lf);
2056  if (!font)
2057  TRACE("Failed to create font\n");
2058  else {
2059  hPrevFont = SelectObject(hDC, font);
2060  created_font = TRUE;
2061  }
2062  } else {
2063 #ifdef __REACTOS__ /* r73885 */
2064  font = infoPtr->font;
2065 #else
2066  font = (HFONT)SendMessageW(infoPtr->hwnd, WM_GETFONT, 0, 0);
2067 #endif
2068  hPrevFont = SelectObject(hDC, font);
2069  }
2070 
2071  GetClientRect(infoPtr->hwnd, &bgRect);
2072  textRect = bgRect;
2073 
2074  if (text)
2075  {
2076  SIZE textExtent;
2077  GetTextExtentPoint32W(hDC, text, lstrlenW(text), &textExtent);
2078  bgRect.top += (textExtent.cy / 2);
2079  textRect.left += 10;
2080  textRect.bottom = textRect.top + textExtent.cy;
2081  textRect.right = textRect.left + textExtent.cx + 4;
2082 
2084  }
2085 
2086  GetThemeBackgroundContentRect(theme, hDC, BP_GROUPBOX, state, &bgRect, &contentRect);
2087  ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom);
2088 
2089 #ifdef __REACTOS__ /* r73885 & r74149 */
2090  if (prfFlag == 0)
2091 #endif
2093  DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
2094 
2095 #ifdef __REACTOS__ /* r74406 */
2096  parent = GetParent(infoPtr->hwnd);
2097  if (!parent) parent = infoPtr->hwnd;
2098  hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
2099  (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
2100  if (!hBrush) /* did the app forget to call defwindowproc ? */
2101  hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
2102  (WPARAM)hDC, (LPARAM)infoPtr->hwnd );
2103  GetClientRect(infoPtr->hwnd, &clientRect);
2104  FillRect( hDC, &clientRect, hBrush );
2105 #endif
2106 
2107  DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);
2108 
2110 
2111  if (text)
2112  {
2113  InflateRect(&textRect, -2, 0);
2115  heap_free(text);
2116  }
2117 
2118  if (created_font) DeleteObject(font);
2119  if (hPrevFont) SelectObject(hDC, hPrevFont);
2120 }
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define TRUE
Definition: types.h:120
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
HRESULT hr
Definition: shlfolder.c:183
Definition: mk_font.cpp:20
static WCHAR * get_button_text(const BUTTON_INFO *infoPtr)
Definition: button.c:230
const WCHAR * text
Definition: package.c:1827
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1748
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, LOGFONTW *pFont)
Definition: property.c:108
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define lstrlenW
Definition: compat.h:407
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
Definition: draw.c:1883
unsigned int BOOL
Definition: ntddk_ex.h:94
RECT textRect
Definition: startmenu.cpp:1392
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define WM_GETFONT
Definition: winuser.h:1633
LONG cx
Definition: windef.h:319
#define TMT_FONT
Definition: vssym32.h:144
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
#define TRACE(s)
Definition: solgame.cpp:4
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2708
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static LPARAM
Definition: button.c:42
static int state
Definition: maze.c:121
HFONT font
Definition: button.c:97
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
int WINAPI ExcludeClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect)
Definition: draw.c:1479
LONG bottom
Definition: windef.h:294
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
LONG cy
Definition: windef.h:320
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
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:1377
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ get_button_text()

static WCHAR* get_button_text ( const BUTTON_INFO infoPtr)
inlinestatic

Definition at line 230 of file button.c.

231 {
232  INT len = GetWindowTextLengthW( infoPtr->hwnd );
233  WCHAR *buffer = heap_alloc( (len + 1) * sizeof(WCHAR) );
234  if (buffer)
235  GetWindowTextW( infoPtr->hwnd, buffer, len + 1 );
236  return buffer;
237 }
GLuint buffer
Definition: glext.h:5915
int32_t INT
Definition: typedefs.h:56
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
HWND hwnd
Definition: button.c:95
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetWindowTextLengthW(_In_ HWND)
GLenum GLsizei len
Definition: glext.h:6722
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378

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

212 {
213  return (window_style & BS_TYPEMASK);
214 }
#define BS_TYPEMASK
Definition: winuser.h:270

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

◆ OB_Paint()

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

Definition at line 1773 of file button.c.

1774 {
1775  LONG state = infoPtr->state;
1776  DRAWITEMSTRUCT dis;
1777  LONG_PTR id = GetWindowLongPtrW( infoPtr->hwnd, GWLP_ID );
1778  HWND parent;
1779  HFONT hFont;
1780  HRGN hrgn;
1781 
1782  dis.CtlType = ODT_BUTTON;
1783  dis.CtlID = id;
1784  dis.itemID = 0;
1785  dis.itemAction = action;
1786  dis.itemState = ((state & BST_FOCUS) ? ODS_FOCUS : 0) |
1787  ((state & BST_PUSHED) ? ODS_SELECTED : 0) |
1788  (IsWindowEnabled(infoPtr->hwnd) ? 0: ODS_DISABLED);
1789  dis.hwndItem = infoPtr->hwnd;
1790  dis.hDC = hDC;
1791  dis.itemData = 0;
1792  GetClientRect( infoPtr->hwnd, &dis.rcItem );
1793 
1794  if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1795  parent = GetParent(infoPtr->hwnd);
1796  if (!parent) parent = infoPtr->hwnd;
1798 
1799  hrgn = set_control_clipping( hDC, &dis.rcItem );
1800 
1801  SendMessageW( GetParent(infoPtr->hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
1802  SelectClipRgn( hDC, hrgn );
1803  if (hrgn) DeleteObject( hrgn );
1804 }
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
ULONG_PTR itemData
Definition: winuser.h:3046
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ODS_FOCUS
Definition: winuser.h:2503
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4698
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:239
HFONT hFont
Definition: main.c:53
#define WM_CTLCOLORBTN
Definition: winuser.h:1745
long LONG
Definition: pedump.c:60
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define BST_FOCUS
Definition: winuser.h:200
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2708
#define ODS_DISABLED
Definition: winuser.h:2501
#define BST_PUSHED
Definition: winuser.h:201
static HRGN hrgn
Definition: win.c:55
static int state
Definition: maze.c:121
HFONT font
Definition: button.c:97
LONG state
Definition: button.c:96
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
const WCHAR * action
Definition: action.c:7783
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WM_DRAWITEM
Definition: winuser.h:1627
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define ODS_SELECTED
Definition: winuser.h:2499
#define ODT_BUTTON
Definition: winuser.h:2494
GLenum GLuint id
Definition: glext.h:5579
#define GWLP_ID
Definition: winuser.h:854

◆ paint_button()

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

Definition at line 218 of file button.c.

219 {
220  if (btnPaintFunc[style] && IsWindowVisible(infoPtr->hwnd))
221  {
222  HDC hdc = GetDC( infoPtr->hwnd );
223  btnPaintFunc[style]( infoPtr, hdc, action );
224  ReleaseDC( infoPtr->hwnd, hdc );
225  }
226 }
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
static const pfPaint btnPaintFunc[MAX_BTN_TYPE]
Definition: button.c:154
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND hwnd
Definition: button.c:95
HDC hdc
Definition: main.c:9
const WCHAR * action
Definition: action.c:7783
BOOL WINAPI IsWindowVisible(_In_ HWND)
Arabic default style
Definition: afstyles.h:93

Referenced by BUTTON_WindowProc().

◆ PB_Paint()

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

Definition at line 1392 of file button.c.

1393 {
1394  RECT rc, r;
1395  UINT dtFlags, uState;
1396  HPEN hOldPen, hpen;
1397  HBRUSH hOldBrush;
1398  INT oldBkMode;
1399  COLORREF oldTxtColor;
1400  HFONT hFont;
1401  LONG state = infoPtr->state;
1402  LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1403  BOOL pushedState = (state & BST_PUSHED);
1404  HWND parent;
1405  HRGN hrgn;
1406 #ifdef __REACTOS__
1407  DWORD cdrf;
1408 #endif
1409 
1410  GetClientRect( infoPtr->hwnd, &rc );
1411 
1412  /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
1413  if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1414  parent = GetParent(infoPtr->hwnd);
1415  if (!parent) parent = infoPtr->hwnd;
1417 
1418  hrgn = set_control_clipping( hDC, &rc );
1419 
1421  hOldPen = SelectObject(hDC, hpen);
1423  oldBkMode = SetBkMode(hDC, TRANSPARENT);
1424 
1425 #ifdef __REACTOS__
1426  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &rc);
1427  if (cdrf == CDRF_SKIPDEFAULT)
1428  goto cleanup;
1429 #endif
1430 
1432  {
1433  if (action != ODA_FOCUS)
1434  Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
1435  InflateRect( &rc, -1, -1 );
1436  }
1437 
1438  /* completely skip the drawing if only focus has changed */
1439  if (action == ODA_FOCUS) goto draw_focus;
1440 
1441  uState = DFCS_BUTTONPUSH;
1442 
1443  if (style & BS_FLAT)
1444  uState |= DFCS_MONO;
1445  else if (pushedState)
1446  {
1448  uState |= DFCS_FLAT;
1449  else
1450  uState |= DFCS_PUSHED;
1451  }
1452 
1454  uState |= DFCS_CHECKED;
1455 
1456  DrawFrameControl( hDC, &rc, DFC_BUTTON, uState );
1457 
1458 #ifdef __REACTOS__
1459  if (cdrf == CDRF_NOTIFYPOSTERASE)
1460  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &rc);
1461 
1462  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &rc);
1463  if (cdrf == CDRF_SKIPDEFAULT)
1464  goto cleanup;
1465 #endif
1466 
1467  /* draw button label */
1468  r = rc;
1469  dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &r);
1470 
1471  if (dtFlags == (UINT)-1L)
1472  goto cleanup;
1473 
1474  if (pushedState)
1475  OffsetRect(&r, 1, 1);
1476 
1477  oldTxtColor = SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) );
1478 
1479  BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &r);
1480 
1481  SetTextColor( hDC, oldTxtColor );
1482 
1483 #ifdef __REACTOS__
1484  if (cdrf == CDRF_NOTIFYPOSTPAINT)
1485  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &rc);
1486 #endif
1487 
1488 draw_focus:
1489  if (action == ODA_FOCUS || (state & BST_FOCUS))
1490  {
1491 #ifdef __REACTOS__
1492  if (!(infoPtr->ui_state & UISF_HIDEFOCUS))
1493  {
1494 #endif
1495  InflateRect( &rc, -2, -2 );
1496  DrawFocusRect( hDC, &rc );
1497 #ifdef __REACTOS__
1498  }
1499 #endif
1500  }
1501 
1502  cleanup:
1503  SelectObject( hDC, hOldPen );
1504  SelectObject( hDC, hOldBrush );
1505  SetBkMode(hDC, oldBkMode);
1506  SelectClipRgn( hDC, hrgn );
1507  if (hrgn) DeleteObject( hrgn );
1508  DeleteObject( hpen );
1509 }
#define DFCS_FLAT
Definition: winuser.h:510
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
static void BUTTON_DrawLabel(const BUTTON_INFO *infoPtr, HDC hdc, UINT dtFlags, const RECT *rc)
Definition: button.c:1324
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define DFC_BUTTON
Definition: winuser.h:476
#define COLOR_WINDOWFRAME
Definition: winuser.h:909
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define CDDS_POSTERASE
Definition: commctrl.h:268
#define DFCS_CHECKED
Definition: winuser.h:504
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:259
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
LONG top
Definition: windef.h:292
#define CDDS_POSTPAINT
Definition: commctrl.h:266
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
UINT_PTR WPARAM
Definition: windef.h:207
static HPEN hpen
LONG left
Definition: windef.h:291
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:255
LONG right
Definition: windef.h:293
#define ODA_FOCUS
Definition: winuser.h:2498
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:239
int32_t INT
Definition: typedefs.h:56
DWORD WINAPI GetSysColor(_In_ int)
#define BST_INDETERMINATE
Definition: winuser.h:198
HFONT hFont
Definition: main.c:53
#define PS_SOLID
Definition: wingdi.h:585
#define DFCS_PUSHED
Definition: winuser.h:503
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define WM_CTLCOLORBTN
Definition: winuser.h:1745
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define TRANSPARENT
Definition: wingdi.h:949
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
LONG_PTR LPARAM
Definition: windef.h:208
static UINT BUTTON_CalcLabelRect(const BUTTON_INFO *infoPtr, HDC hdc, RECT *rc)
Definition: button.c:1181
#define BST_FOCUS
Definition: winuser.h:200
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2708
#define BST_PUSHED
Definition: winuser.h:201
DWORD COLORREF
Definition: windef.h:285
#define DFCS_MONO
Definition: winuser.h:511
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CDDS_PREPAINT
Definition: commctrl.h:265
static const WCHAR L[]
Definition: oid.c:1250
#define COLOR_BTNFACE
Definition: winuser.h:918
static HRGN hrgn
Definition: win.c:55
static int state
Definition: maze.c:121
HFONT font
Definition: button.c:97
static UINT get_button_type(LONG window_style)
Definition: button.c:211
LONG state
Definition: button.c:96
#define BS_FLAT
Definition: winuser.h:280
#define GWL_STYLE
Definition: winuser.h:846
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:886
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
const WCHAR * action
Definition: action.c:7783
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define CDRF_NOTIFYPOSTERASE
Definition: commctrl.h:262
#define BST_CHECKED
Definition: winuser.h:197
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG bottom
Definition: windef.h:294
char * cleanup(char *str)
Definition: wpickclick.c:99
#define COLOR_BTNTEXT
Definition: winuser.h:923
Arabic default style
Definition: afstyles.h:93
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define CDDS_PREERASE
Definition: commctrl.h:267

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

1811 {
1812  static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED };
1813 
1814  RECT bgRect, textRect;
1815  HFONT font = infoPtr->font;
1816  HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
1817  int state = states[ drawState ];
1818  WCHAR *text = get_button_text(infoPtr);
1819 #ifdef __REACTOS__
1820  HWND parent;
1821  DWORD cdrf;
1822 
1823  GetClientRect(infoPtr->hwnd, &bgRect);
1825 
1826  if (prfFlag == 0)
1827  {
1829  DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
1830  }
1831 
1832  parent = GetParent(infoPtr->hwnd);
1833  if (!parent) parent = infoPtr->hwnd;
1835 
1836  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &bgRect);
1837  if (cdrf == CDRF_SKIPDEFAULT)
1838  goto cleanup;
1839 
1840  DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
1841 
1842  if (cdrf == CDRF_NOTIFYPOSTERASE)
1843  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &bgRect);
1844 
1845  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &bgRect);
1846  if (cdrf == CDRF_SKIPDEFAULT)
1847  goto cleanup;
1848 
1849  BUTTON_DrawIml(hDC, &infoPtr->imlData, &textRect, FALSE, drawState);
1850 #else
1851  GetClientRect(infoPtr->hwnd, &bgRect);
1853 
1855  DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
1856 
1857  DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
1858 #endif
1859 
1860  if (text)
1861  {
1862  DrawThemeText(theme, hDC, BP_PUSHBUTTON, state, text, lstrlenW(text), dtFlags, 0, &textRect);
1863  heap_free(text);
1864 #ifdef __REACTOS__
1865  text = NULL;
1866 #endif
1867  }
1868 
1869  if (focused)
1870  {
1871  MARGINS margins;
1872  RECT focusRect = bgRect;
1873 
1875 
1876  focusRect.left += margins.cxLeftWidth;
1877  focusRect.top += margins.cyTopHeight;
1878  focusRect.right -= margins.cxRightWidth;
1879  focusRect.bottom -= margins.cyBottomHeight;
1880 
1881  DrawFocusRect( hDC, &focusRect );
1882  }
1883 
1884 #ifdef __REACTOS__
1885  if (cdrf == CDRF_NOTIFYPOSTPAINT)
1886  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
1887 cleanup:
1888  if (text) heap_free(text);
1889 #endif
1890  if (hPrevFont) SelectObject(hDC, hPrevFont);
1891 }
#define CDDS_POSTERASE
Definition: commctrl.h:268
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:259
Definition: mk_font.cpp:20
static WCHAR * get_button_text(const BUTTON_INFO *infoPtr)
Definition: button.c:230
const WCHAR * text
Definition: package.c:1827
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
LONG top
Definition: windef.h:292
#define CDDS_POSTPAINT
Definition: commctrl.h:266
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
UINT_PTR WPARAM
Definition: windef.h:207
LONG left
Definition: windef.h:291
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:255
LONG right
Definition: windef.h:293
#define lstrlenW
Definition: compat.h:407
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
Definition: misc.c:279
BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
Definition: draw.c:1883
#define WM_CTLCOLORBTN
Definition: winuser.h:1745
#define TMT_CONTENTMARGINS
Definition: vssym32.h:324
RECT textRect
Definition: startmenu.cpp:1392
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2708
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CDDS_PREPAINT
Definition: commctrl.h:265
static int state
Definition: maze.c:121
HFONT font
Definition: button.c:97
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
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CDRF_NOTIFYPOSTERASE
Definition: commctrl.h:262
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect)
Definition: draw.c:1479
LONG bottom
Definition: windef.h:294
char * cleanup(char *str)
Definition: wpickclick.c:99
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:1377
#define CDDS_PREERASE
Definition: commctrl.h:267
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ set_control_clipping()

HRGN set_control_clipping ( HDC  hdc,
const RECT rect 
)

Definition at line 239 of file button.c.

240 {
241  RECT rc = *rect;
242  HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
243 
244  if (GetClipRgn( hdc, hrgn ) != 1)
245  {
246  DeleteObject( hrgn );
247  hrgn = 0;
248  }
249  DPtoLP( hdc, (POINT *)&rc, 2 );
250  if (GetLayout( hdc ) & LAYOUT_RTL) /* compensate for the shifting done by IntersectClipRect */
251  {
252  rc.left++;
253  rc.right++;
254  }
255  IntersectClipRect( hdc, rc.left, rc.top, rc.right, rc.bottom );
256  return hrgn;
257 }
#define LAYOUT_RTL
Definition: wingdi.h:1353
LONG top
Definition: windef.h:292
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
BOOL WINAPI DPtoLP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
& rect
Definition: startmenu.cpp:1413
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
HDC hdc
Definition: main.c:9
static HRGN hrgn
Definition: win.c:55
DWORD WINAPI GetLayout(_In_ HDC hdc)
Definition: coord.c:741
LONG bottom
Definition: windef.h:294
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)

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

1732 {
1733  RECT rc;
1734  HBRUSH hBrush;
1735  HFONT hFont;
1736  LONG state = infoPtr->state;
1737  HWND parent;
1738 
1739  GetClientRect( infoPtr->hwnd, &rc);
1740 
1741  if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1742 
1743  parent = GetParent(infoPtr->hwnd);
1744  if (!parent) parent = infoPtr->hwnd;
1745  hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1746  if (!hBrush) /* did the app forget to call defwindowproc ? */
1747  hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1748 
1749  FillRect( hDC, &rc, hBrush );
1750  if (action == ODA_FOCUS || (state & BST_FOCUS))
1751  DrawFocusRect( hDC, &rc );
1752 
1753  switch (action)
1754  {
1755  case ODA_FOCUS:
1757  break;
1758 
1759  case ODA_SELECT:
1761  break;
1762 
1763  default:
1764  break;
1765  }
1766 }
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
UINT_PTR WPARAM
Definition: windef.h:207
#define ODA_FOCUS
Definition: winuser.h:2498
#define BN_UNHILITE
Definition: winuser.h:1895
HFONT hFont
Definition: main.c:53
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CTLCOLORBTN
Definition: winuser.h:1745
long LONG
Definition: pedump.c:60
#define BST_FOCUS
Definition: winuser.h:200
#define BN_HILITE
Definition: winuser.h:1890
#define BUTTON_NOTIFY_PARENT(hWnd, code)
Definition: button.c:85
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2708
#define BST_PUSHED
Definition: winuser.h:201
static LPARAM
Definition: button.c:42
#define BN_KILLFOCUS
Definition: winuser.h:1891
static int state
Definition: maze.c:121
HFONT font
Definition: button.c:97
LONG state
Definition: button.c:96
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define BN_SETFOCUS
Definition: winuser.h:1894
HWND WINAPI GetParent(_In_ HWND)
const WCHAR * action
Definition: action.c:7783
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define ODA_SELECT
Definition: winuser.h:2497

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( button  )

Variable Documentation

◆ btnPaintFunc

const pfPaint btnPaintFunc[MAX_BTN_TYPE]
static
Initial value:
=
{
NULL,
}
static void PB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1392
static void CB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1515
static void OB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1773
static void GB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1679
smooth NULL
Definition: ftsmooth.c:416
static void UB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1731

Definition at line 154 of file button.c.

Referenced by BUTTON_WindowProc(), and paint_button().

◆ btnThemedPaintFunc

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

Definition at line 191 of file button.c.

Referenced by BUTTON_WindowProc().

◆ maxCheckState