ReactOS  0.4.15-dev-449-g64abd9f
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:3984
HWND hWnd
Definition: settings.c:17
#define GetWindowLongPtrW
Definition: winuser.h:4804
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_COMMAND
Definition: winuser.h:1722
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 1185 of file button.c.

1186 {
1187  LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1188  LONG ex_style = GetWindowLongW( infoPtr->hwnd, GWL_EXSTYLE );
1189  WCHAR *text;
1190  ICONINFO iconInfo;
1191  BITMAP bm;
1192  UINT dtStyle = BUTTON_BStoDT( style, ex_style );
1193  RECT r = *rc;
1194  INT n;
1195 #ifdef __REACTOS__
1196  BOOL bHasIml = BUTTON_DrawIml(hdc, &infoPtr->imlData, &r, TRUE, 0);
1197 #endif
1198 
1199  /* Calculate label rectangle according to label type */
1200  switch (style & (BS_ICON|BS_BITMAP))
1201  {
1202  case BS_TEXT:
1203  {
1204  HFONT hFont, hPrevFont = 0;
1205 
1206  if (!(text = get_button_text( infoPtr ))) goto empty_rect;
1207  if (!text[0])
1208  {
1209  heap_free( text );
1210  goto empty_rect;
1211  }
1212 
1213  if ((hFont = infoPtr->font)) hPrevFont = SelectObject( hdc, hFont );
1214 #ifdef __REACTOS__
1215  DrawTextW(hdc, text, -1, &r, ((dtStyle | DT_CALCRECT) & ~(DT_VCENTER | DT_BOTTOM)));
1216 #else
1217  DrawTextW(hdc, text, -1, &r, dtStyle | DT_CALCRECT);
1218 #endif
1219  if (hPrevFont) SelectObject( hdc, hPrevFont );
1220  heap_free( text );
1221 #ifdef __REACTOS__
1222  if (infoPtr->ui_state & UISF_HIDEACCEL)
1223  dtStyle |= DT_HIDEPREFIX;
1224 #endif
1225  break;
1226  }
1227 
1228  case BS_ICON:
1229  if (!GetIconInfo(infoPtr->u.icon, &iconInfo))
1230  goto empty_rect;
1231 
1232  GetObjectW (iconInfo.hbmColor, sizeof(BITMAP), &bm);
1233 
1234  r.right = r.left + bm.bmWidth;
1235  r.bottom = r.top + bm.bmHeight;
1236 
1237  DeleteObject(iconInfo.hbmColor);
1238  DeleteObject(iconInfo.hbmMask);
1239  break;
1240 
1241  case BS_BITMAP:
1242  if (!GetObjectW( infoPtr->u.bitmap, sizeof(BITMAP), &bm))
1243  goto empty_rect;
1244 
1245  r.right = r.left + bm.bmWidth;
1246  r.bottom = r.top + bm.bmHeight;
1247  break;
1248 
1249  default:
1250  empty_rect:
1251 #ifdef __REACTOS__
1252  if (bHasIml)
1253  break;
1254 #endif
1255  rc->right = r.left;
1256  rc->bottom = r.top;
1257  return (UINT)-1;
1258  }
1259 
1260 #ifdef __REACTOS__
1261  if (bHasIml)
1262  {
1263  if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_LEFT)
1264  r.left = infoPtr->imlData.margin.left;
1265  else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_RIGHT)
1266  r.right = infoPtr->imlData.margin.right;
1267  else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_TOP)
1268  r.top = infoPtr->imlData.margin.top;
1269  else if (infoPtr->imlData.uAlign == BUTTON_IMAGELIST_ALIGN_BOTTOM)
1270  r.bottom = infoPtr->imlData.margin.bottom;
1271  }
1272 #endif
1273 
1274  /* Position label inside bounding rectangle according to
1275  * alignment flags. (calculated rect is always left-top aligned).
1276  * If label is aligned to any side - shift label in opposite
1277  * direction to leave extra space for focus rectangle.
1278  */
1279  switch (dtStyle & (DT_CENTER|DT_RIGHT))
1280  {
1281  case DT_LEFT: r.left++; r.right++; break;
1282  case DT_CENTER: n = r.right - r.left;
1283  r.left = rc->left + ((rc->right - rc->left) - n) / 2;
1284  r.right = r.left + n; break;
1285  case DT_RIGHT: n = r.right - r.left;
1286  r.right = rc->right - 1;
1287  r.left = r.right - n;
1288  break;
1289  }
1290 
1291  switch (dtStyle & (DT_VCENTER|DT_BOTTOM))
1292  {
1293  case DT_TOP: r.top++; r.bottom++; break;
1294  case DT_VCENTER: n = r.bottom - r.top;
1295 #ifdef __REACTOS__
1296  r.top = rc->top + ((rc->bottom - 1 - rc->top) - n) / 2;
1297 #else
1298  r.top = rc->top + ((rc->bottom - rc->top) - n) / 2;
1299 #endif
1300  r.bottom = r.top + n; break;
1301  case DT_BOTTOM: n = r.bottom - r.top;
1302  r.bottom = rc->bottom - 1;
1303  r.top = r.bottom - n;
1304  break;
1305  }
1306 
1307  *rc = r;
1308  return dtStyle;
1309 }
#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:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define BUTTON_IMAGELIST_ALIGN_TOP
Definition: commctrl.h:4625
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:306
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:57
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:3101
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
HBITMAP hbmColor
Definition: winuser.h:3102
#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:4623
#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:4626
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:4624
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG bottom
Definition: windef.h:309
#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
union _BUTTON_INFO::@330 u

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

◆ BUTTON_CheckAutoRadioButton()

static void BUTTON_CheckAutoRadioButton ( HWND  hwnd)
static

Definition at line 1656 of file button.c.

1657 {
1658  HWND parent, sibling, start;
1659 
1660  parent = GetParent(hwnd);
1661  /* make sure that starting control is not disabled or invisible */
1662 #ifdef __REACTOS__
1663  start = sibling = hwnd;
1664 #else
1665  start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
1666 #endif
1667  do
1668  {
1669  if (!sibling) break;
1670 #ifdef __REACTOS__
1671  if (SendMessageW( sibling, WM_GETDLGCODE, 0, 0 ) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
1672  SendMessageW( sibling, BM_SETCHECK, sibling == hwnd ? BST_CHECKED : BST_UNCHECKED, 0 );
1673 #else
1674  if ((hwnd != sibling) &&
1676  SendMessageW( sibling, BM_SETCHECK, BST_UNCHECKED, 0 );
1677 #endif
1678  sibling = GetNextDlgGroupItem( parent, sibling, FALSE );
1679  } while (sibling != start);
1680 }
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:2592
HWND WINAPI GetNextDlgGroupItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define BM_SETCHECK
Definition: winuser.h:1903
r parent
Definition: btrfs.c:2944
#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:2595
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 1332 of file button.c.

1333 {
1334  DRAWSTATEPROC lpOutputProc = NULL;
1335  LPARAM lp;
1336  WPARAM wp = 0;
1337  HBRUSH hbr = 0;
1339  LONG state = infoPtr->state;
1340  LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1341  WCHAR *text = NULL;
1342 
1343  /* FIXME: To draw disabled label in Win31 look-and-feel, we probably
1344  * must use DSS_MONO flag and COLOR_GRAYTEXT brush (or maybe DSS_UNION).
1345  * I don't have Win31 on hand to verify that, so I leave it as is.
1346  */
1347 
1348 #ifdef __REACTOS__
1349  RECT rcText = *rc;
1350  BUTTON_DrawIml(hdc, &infoPtr->imlData, &rcText, FALSE, 0);
1351 #endif
1352 
1353  if ((style & BS_PUSHLIKE) && (state & BST_INDETERMINATE))
1354  {
1356  flags |= DSS_MONO;
1357  }
1358 
1359  switch (style & (BS_ICON|BS_BITMAP))
1360  {
1361  case BS_TEXT:
1362  /* DST_COMPLEX -- is 0 */
1363  lpOutputProc = BUTTON_DrawTextCallback;
1364  if (!(text = get_button_text( infoPtr ))) return;
1365  lp = (LPARAM)text;
1366  wp = dtFlags;
1367 #ifdef __REACTOS__
1368  if (dtFlags & DT_HIDEPREFIX)
1369  flags |= DSS_HIDEPREFIX;
1370 #endif
1371  break;
1372 
1373  case BS_ICON:
1374  flags |= DST_ICON;
1375  lp = (LPARAM)infoPtr->u.icon;
1376  break;
1377 
1378  case BS_BITMAP:
1379  flags |= DST_BITMAP;
1380  lp = (LPARAM)infoPtr->u.bitmap;
1381  break;
1382 
1383  default:
1384  return;
1385  }
1386 
1387 #ifdef __REACTOS__
1388  DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rcText.left, rcText.top,
1389  rcText.right - rcText.left, rcText.bottom - rcText.top, flags);
1390 #else
1391  DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top,
1392  rc->right - rc->left, rc->bottom - rc->top, flags);
1393 #endif
1394  heap_free( text );
1395 }
#define DT_HIDEPREFIX
Definition: winuser.h:547
static WCHAR * get_button_text(const BUTTON_INFO *infoPtr)
Definition: button.c:230
UINT state
Definition: button.c:168
const WCHAR * text
Definition: package.c:1827
#define BS_TEXT
Definition: winuser.h:276
LONG top
Definition: windef.h:307
BOOL(CALLBACK * DRAWSTATEPROC)(HDC, LPARAM, WPARAM, int, int)
Definition: winuser.h:2882
UINT_PTR WPARAM
Definition: windef.h:207
HBITMAP bitmap
Definition: button.c:101
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#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
LONG state
Definition: button.c:96
#define GWL_STYLE
Definition: winuser.h:846
unsigned int UINT
Definition: ndis.h:50
#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:309
static BOOL CALLBACK BUTTON_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy)
Definition: button.c:1317
#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
union _BUTTON_INFO::@330 u

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

1318 {
1319  RECT rc;
1320 
1321  SetRect(&rc, 0, 0, cx, cy);
1322  DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp);
1323  return TRUE;
1324 }
#define TRUE
Definition: types.h:120
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
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:581
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 2130 of file button.c.

2131 {
2132  WNDCLASSW wndClass;
2133 
2134  memset(&wndClass, 0, sizeof(wndClass));
2136  wndClass.lpfnWndProc = BUTTON_WindowProc;
2137  wndClass.cbClsExtra = 0;
2138  wndClass.cbWndExtra = sizeof(BUTTON_INFO *);
2139  wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
2140  wndClass.hbrBackground = NULL;
2141  wndClass.lpszClassName = WC_BUTTONW;
2142  RegisterClassW(&wndClass);
2143 }
UINT style
Definition: winuser.h:3151
#define CS_HREDRAW
Definition: winuser.h:648
int cbClsExtra
Definition: winuser.h:3153
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:3152
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR lpszClassName
Definition: winuser.h:3160
#define CS_VREDRAW
Definition: winuser.h:653
int cbWndExtra
Definition: winuser.h:3154
#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:3157
#define WC_BUTTONW
Definition: commctrl.h:4619
HBRUSH hbrBackground
Definition: winuser.h:3158
#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 
845  theme = GetWindowTheme( hWnd );
846  if (theme)
848  }
849 
850  if(!TrackMouseEvent(&mouse_event) || !(mouse_event.dwFlags&TME_LEAVE))
851  {
852  mouse_event.dwFlags = TME_LEAVE;
853  mouse_event.hwndTrack = hWnd;
854  mouse_event.dwHoverTime = 1;
856  }
857  break;
858 #else
859 
860  if (!TrackMouseEvent(&mouse_event) || !(mouse_event.dwFlags & (TME_HOVER | TME_LEAVE)))
861  {
862  mouse_event.dwFlags = TME_HOVER | TME_LEAVE;
863  mouse_event.hwndTrack = hWnd;
864  mouse_event.dwHoverTime = 1;
866  }
867 
868  if ((wParam & MK_LBUTTON) && GetCapture() == hWnd)
869  {
870  GetClientRect( hWnd, &rect );
872  }
873  break;
874 #endif
875  }
876 
877 #ifndef __REACTOS__
878  case WM_MOUSEHOVER:
879  {
880  infoPtr->state |= BST_HOT;
882  break;
883  }
884 #endif
885 
886  case WM_MOUSELEAVE:
887  {
888 #ifdef __REACTOS__
889  if (infoPtr->state & BST_HOT)
890  {
891  NMBCHOTITEM nmhotitem;
892 
893  infoPtr->state &= ~BST_HOT;
894 
895  nmhotitem.hdr.hwndFrom = hWnd;
896  nmhotitem.hdr.idFrom = GetWindowLongPtrW (hWnd, GWLP_ID);
897  nmhotitem.hdr.code = BCN_HOTITEMCHANGE;
898  nmhotitem.dwFlags = HICF_LEAVING;
899  SendMessageW(GetParent(hWnd), WM_NOTIFY, nmhotitem.hdr.idFrom, (LPARAM)&nmhotitem);
900 
901  theme = GetWindowTheme( hWnd );
902  if (theme)
904  }
905  break;
906 #else
907  infoPtr->state &= ~BST_HOT;
909  break;
910 #endif
911  }
912 
913 #ifdef __REACTOS__
914  case BCM_GETTEXTMARGIN:
915  {
916  RECT* prc = (RECT*)lParam;
917  if (!prc)
918  return FALSE;
919  *prc = infoPtr->rcTextMargin;
920  return TRUE;
921  }
922  case BCM_SETTEXTMARGIN:
923  {
924  RECT* prc = (RECT*)lParam;
925  if (!prc)
926  return FALSE;
927  infoPtr->rcTextMargin = *prc;
928  return TRUE;
929  }
930  case BCM_SETIMAGELIST:
931  {
932  BUTTON_IMAGELIST * pimldata = (BUTTON_IMAGELIST *)lParam;
933  if (!pimldata || !pimldata->himl)
934  return FALSE;
935  infoPtr->imlData = *pimldata;
936  return TRUE;
937  }
938  case BCM_GETIMAGELIST:
939  {
940  BUTTON_IMAGELIST * pimldata = (BUTTON_IMAGELIST *)lParam;
941  if (!pimldata)
942  return FALSE;
943  *pimldata = infoPtr->imlData;
944  return TRUE;
945  }
946  case BCM_GETIDEALSIZE:
947  {
948  HTHEME theme = GetWindowTheme(hWnd);
949  BOOL ret = FALSE;
950  SIZE* pSize = (SIZE*)lParam;
951 
952  if (!pSize)
953  {
954  return FALSE;
955  }
956 
957  if (btn_type == BS_PUSHBUTTON ||
958  btn_type == BS_DEFPUSHBUTTON ||
959  btn_type == BS_USERBUTTON)
960  {
961  ret = BUTTON_GetIdealSize(infoPtr, theme, pSize);
962  }
963 
964  if (!ret)
965  {
967  pSize->cx = rect.right;
968  pSize->cy = rect.bottom;
969  }
970 
971  return TRUE;
972  }
973 #endif
974 
975  case WM_SETTEXT:
976  {
977  /* Clear an old text here as Windows does */
978 #ifdef __REACTOS__
979 //
980 // ReactOS Note :
981 // wine Bug: http://bugs.winehq.org/show_bug.cgi?id=25790
982 // Patch: http://source.winehq.org/patches/data/70889
983 // By: Alexander LAW, Replicate Windows behavior of WM_SETTEXT handler regarding WM_CTLCOLOR*
984 //
985  if (style & WS_VISIBLE)
986 #else
987  if (IsWindowVisible(hWnd))
988 #endif
989  {
990  HDC hdc = GetDC(hWnd);
991  HBRUSH hbrush;
992  RECT client, rc;
994  UINT message = (btn_type == BS_PUSHBUTTON ||
995  btn_type == BS_DEFPUSHBUTTON ||
996  btn_type == BS_USERBUTTON ||
997  btn_type == BS_OWNERDRAW) ?
999 
1000  if (!parent) parent = hWnd;
1001  hbrush = (HBRUSH)SendMessageW(parent, message,
1002  (WPARAM)hdc, (LPARAM)hWnd);
1003  if (!hbrush) /* did the app forget to call DefWindowProc ? */
1004  hbrush = (HBRUSH)DefWindowProcW(parent, message,
1005  (WPARAM)hdc, (LPARAM)hWnd);
1006 
1008  rc = client;
1009  /* FIXME: check other BS_* handlers */
1010  if (btn_type == BS_GROUPBOX)
1011  InflateRect(&rc, -7, 1); /* GB_Paint does this */
1012  BUTTON_CalcLabelRect(infoPtr, hdc, &rc);
1013  /* Clip by client rect bounds */
1014  if (rc.right > client.right) rc.right = client.right;
1015  if (rc.bottom > client.bottom) rc.bottom = client.bottom;
1016  FillRect(hdc, &rc, hbrush);
1017  ReleaseDC(hWnd, hdc);
1018  }
1019 
1021  if (btn_type == BS_GROUPBOX) /* Yes, only for BS_GROUPBOX */
1023  else
1024  paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
1025  return 1; /* success. FIXME: check text length */
1026  }
1027 
1028  case WM_SETFONT:
1029  infoPtr->font = (HFONT)wParam;
1031  break;
1032 
1033  case WM_GETFONT:
1034  return (LRESULT)infoPtr->font;
1035 
1036  case WM_SETFOCUS:
1037  TRACE("WM_SETFOCUS %p\n",hWnd);
1038  infoPtr->state |= BST_FOCUS;
1039 #ifdef __REACTOS__
1040  if (btn_type != BS_OWNERDRAW)
1042  else
1043 #endif
1044  paint_button( infoPtr, btn_type, ODA_FOCUS );
1045  if (style & BS_NOTIFY)
1047  break;
1048 
1049  case WM_KILLFOCUS:
1050  TRACE("WM_KILLFOCUS %p\n",hWnd);
1051  infoPtr->state &= ~BST_FOCUS;
1052 #ifndef __REACTOS__
1053  paint_button( infoPtr, btn_type, ODA_FOCUS );
1054 #endif
1055 
1056  if ((infoPtr->state & BUTTON_BTNPRESSED) && GetCapture() == hWnd)
1057  ReleaseCapture();
1058  if (style & BS_NOTIFY)
1060 
1062  break;
1063 
1064  case WM_SYSCOLORCHANGE:
1066  break;
1067 
1068  case BM_SETSTYLE:
1069  btn_type = wParam & BS_TYPEMASK;
1070  style = (style & ~BS_TYPEMASK) | btn_type;
1072 
1073  /* Only redraw if lParam flag is set.*/
1074  if (lParam)
1076 
1077  break;
1078 
1079  case BM_CLICK:
1080 #ifdef __REACTOS__
1081  /* Fix for core CORE-6024 */
1082  if (infoPtr->state & BUTTON_BMCLICK)
1083  break;
1084  infoPtr->state |= BUTTON_BMCLICK;
1085 #endif
1086  SendMessageW( hWnd, WM_LBUTTONDOWN, 0, 0 );
1087  SendMessageW( hWnd, WM_LBUTTONUP, 0, 0 );
1088 #ifdef __REACTOS__
1089  infoPtr->state &= ~BUTTON_BMCLICK;
1090 #endif
1091  break;
1092 
1093  case BM_SETIMAGE:
1094  /* Check that image format matches button style */
1095  switch (style & (BS_BITMAP|BS_ICON))
1096  {
1097  case BS_BITMAP:
1098  if (wParam != IMAGE_BITMAP) return 0;
1099  break;
1100  case BS_ICON:
1101  if (wParam != IMAGE_ICON) return 0;
1102  break;
1103  default:
1104  return 0;
1105  }
1106  oldHbitmap = infoPtr->u.image;
1107  infoPtr->u.image = (HANDLE)lParam;
1109  return (LRESULT)oldHbitmap;
1110 
1111  case BM_GETIMAGE:
1112  return (LRESULT)infoPtr->u.image;
1113 
1114  case BM_GETCHECK:
1115  return infoPtr->state & 3;
1116 
1117  case BM_SETCHECK:
1118  if (wParam > maxCheckState[btn_type]) wParam = maxCheckState[btn_type];
1119  if ((btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON))
1120  {
1123  }
1124  if ((infoPtr->state & 3) != wParam)
1125  {
1126  infoPtr->state = (infoPtr->state & ~3) | wParam;
1128  }
1129 #ifndef __REACTOS__
1130  if ((btn_type == BS_AUTORADIOBUTTON) && (wParam == BST_CHECKED) && (style & WS_CHILD))
1132 #endif
1133  break;
1134 
1135  case BM_GETSTATE:
1136  return infoPtr->state;
1137 
1138  case BM_SETSTATE:
1139  state = infoPtr->state;
1140  new_state = wParam ? BST_PUSHED : 0;
1141 
1142  if ((state ^ new_state) & BST_PUSHED)
1143  {
1144  if (wParam)
1145  state |= BST_PUSHED;
1146  else
1147  state &= ~BST_PUSHED;
1148 
1149  if (btn_type == BS_USERBUTTON)
1151  infoPtr->state = state;
1152 
1154  }
1155  break;
1156 
1157 #ifdef __REACTOS__
1158  case WM_UPDATEUISTATE:
1159  DefWindowProcW(hWnd, uMsg, wParam, lParam);
1160 
1161  if (button_update_uistate(infoPtr))
1162  paint_button( infoPtr, btn_type, ODA_DRAWENTIRE );
1163  break;
1164 #endif
1165 
1166  case WM_NCHITTEST:
1167  if(btn_type == BS_GROUPBOX) return HTTRANSPARENT;
1168  /* fall through */
1169  default:
1170  return DefWindowProcW(hWnd, uMsg, wParam, lParam);
1171  }
1172  return 0;
1173 }
#define BS_NOTIFY
Definition: winuser.h:268
HIMAGELIST himl
Definition: commctrl.h:4630
#define BM_SETSTATE
Definition: winuser.h:1905
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:2448
#define TRUE
Definition: types.h:120
#define DLGC_UNDEFPUSHBUTTON
Definition: winuser.h:2591
#define IMAGE_ICON
Definition: winuser.h:212
static HBRUSH hbrush
#define BS_DEFCOMMANDLINK
Definition: commctrl.h:4669
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define BCM_SETTEXTMARGIN
Definition: commctrl.h:4644
#define BS_DEFSPLITBUTTON
Definition: commctrl.h:4667
#define MK_LBUTTON
Definition: winuser.h:2342
HDC WINAPI GetDC(_In_opt_ HWND)
#define BS_RADIOBUTTON
Definition: pedump.c:655
UINT state
Definition: button.c:168
#define pt(x, y)
Definition: drawing.c:79
#define WM_MOUSEHOVER
Definition: commctrl.h:4970
#define BM_GETSTATE
Definition: winuser.h:1902
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
#define BCM_GETTEXTMARGIN
Definition: commctrl.h:4646
#define WM_CAPTURECHANGED
Definition: winuser.h:1790
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:2592
#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:4804
#define RDW_FRAME
Definition: winuser.h:1198
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:308
#define ODA_FOCUS
Definition: winuser.h:2519
#define BM_GETIMAGE
Definition: winuser.h:1901
#define WM_NCCREATE
Definition: winuser.h:1665
#define BM_SETIMAGE
Definition: winuser.h:1904
#define BS_GROUPBOX
Definition: pedump.c:658
#define BN_UNHILITE
Definition: winuser.h:1916
& 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:3134
static const pfPaint btnPaintFunc[MAX_BTN_TYPE]
Definition: button.c:154
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define BST_HOT
Definition: commctrl.h:4664
#define HICF_ENTERING
Definition: commctrl.h:1326
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:3133
ButtonState
Definition: button.c:143
HWND WINAPI GetCapture(void)
Definition: message.c:2880
#define WM_MOUSELEAVE
Definition: commctrl.h:4971
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define HICF_LEAVING
Definition: commctrl.h:1327
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:334
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1900
BOOL WINAPI IsWindowEnabled(_In_ HWND)
static UINT BUTTON_CalcLabelRect(const BUTTON_INFO *infoPtr, HDC hdc, RECT *rc)
Definition: button.c:1185
#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:1911
#define BUTTON_NOTIFY_PARENT(hWnd, code)
Definition: button.c:85
#define BM_CLICK
Definition: winuser.h:1899
#define ODA_DRAWENTIRE
Definition: winuser.h:2517
#define DLGC_DEFPUSHBUTTON
Definition: winuser.h:2590
#define BM_SETCHECK
Definition: winuser.h:1903
#define TRACE(s)
Definition: solgame.cpp:4
#define BS_COMMANDLINK
Definition: commctrl.h:4668
#define WM_KILLFOCUS
Definition: winuser.h:1596
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2944
#define BM_SETSTYLE
Definition: winuser.h:1906
#define BST_PUSHED
Definition: winuser.h:201
#define WM_NCDESTROY
Definition: winuser.h:1666
#define WM_KEYUP
Definition: winuser.h:1698
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:4979
static FILE * client
Definition: client.c:41
#define BN_CLICKED
Definition: winuser.h:1907
PVOID HANDLE
Definition: typedefs.h:72
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:1912
#define WM_PAINT
Definition: winuser.h:1602
#define BS_SPLITBUTTON
Definition: commctrl.h:4666
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
#define BS_ICON
Definition: winuser.h:264
#define BCM_GETIMAGELIST
Definition: commctrl.h:4641
#define OPAQUE
Definition: wingdi.h:948
struct tagTRACKMOUSEEVENT TRACKMOUSEEVENT
HDC hdc
Definition: main.c:9
#define BS_BITMAP
Definition: winuser.h:258
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
#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:3132
#define BST_UNCHECKED
Definition: winuser.h:199
DWORD ret
Definition: button.c:169
#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:1915
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:4976
#define BS_TYPEMASK
Definition: winuser.h:270
#define WC_BUTTONW
Definition: commctrl.h:4619
#define DLGC_BUTTON
Definition: winuser.h:2595
#define TME_LEAVE
Definition: commctrl.h:4977
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_LBUTTONUP
Definition: winuser.h:1759
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define WM_MOUSEMOVE
Definition: winuser.h:1757
#define VK_SPACE
Definition: winuser.h:2194
#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
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:2889
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:1656
#define HIWORD(l)
Definition: typedefs.h:246
BOOL WINAPI IsWindowVisible(_In_ HWND)
LONG bottom
Definition: windef.h:309
#define BCM_GETIDEALSIZE
Definition: commctrl.h:4635
#define BN_DOUBLECLICKED
Definition: winuser.h:1910
#define SetWindowLongPtrW
Definition: winuser.h:5321
#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:256
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:4638
LONG cy
Definition: windef.h:335
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:2585
#define DLGC_STATIC
Definition: winuser.h:2594
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
union _BUTTON_INFO::@330 u

Referenced by BUTTON_Register().

◆ CB_Paint()

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

Definition at line 1523 of file button.c.

1524 {
1525  RECT rbox, rtext, client;
1526  HBRUSH hBrush;
1527  int delta, text_offset, checkBoxWidth, checkBoxHeight;
1528  UINT dtFlags;
1529  HFONT hFont;
1530  LONG state = infoPtr->state;
1531  LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1532  LONG ex_style = GetWindowLongW( infoPtr->hwnd, GWL_EXSTYLE );
1533  HWND parent;
1534  HRGN hrgn;
1535 
1536  if (style & BS_PUSHLIKE)
1537  {
1538  PB_Paint( infoPtr, hDC, action );
1539  return;
1540  }
1541 
1542  GetClientRect(infoPtr->hwnd, &client);
1543  rbox = rtext = client;
1544 
1545  checkBoxWidth = 12 * GetDeviceCaps( hDC, LOGPIXELSX ) / 96 + 1;
1546  checkBoxHeight = 12 * GetDeviceCaps( hDC, LOGPIXELSY ) / 96 + 1;
1547 
1548  if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1549  GetCharWidthW( hDC, '0', '0', &text_offset );
1550  text_offset /= 2;
1551 
1552  parent = GetParent(infoPtr->hwnd);
1553  if (!parent) parent = infoPtr->hwnd;
1554  hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1555  if (!hBrush) /* did the app forget to call defwindowproc ? */
1556  hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1558 
1559  if (style & BS_LEFTTEXT || ex_style & WS_EX_RIGHT)
1560  {
1561  rtext.right -= checkBoxWidth + text_offset;
1562  rbox.left = rbox.right - checkBoxWidth;
1563  }
1564  else
1565  {
1566  rtext.left += checkBoxWidth + text_offset;
1567  rbox.right = checkBoxWidth;
1568  }
1569 
1570  /* Since WM_ERASEBKGND does nothing, first prepare background */
1571  if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
1572  if (action == ODA_DRAWENTIRE) FillRect( hDC, &client, hBrush );
1573 
1574  /* Draw label */
1575  client = rtext;
1576  dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &rtext);
1577 
1578  /* Only adjust rbox when rtext is valid */
1579  if (dtFlags != (UINT)-1L)
1580  {
1581  rbox.top = rtext.top;
1582  rbox.bottom = rtext.bottom;
1583  }
1584 
1585  /* Draw the check-box bitmap */
1586  if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
1587  {
1588  UINT flags;
1589 
1590  if ((get_button_type(style) == BS_RADIOBUTTON) ||
1593  else flags = DFCS_BUTTONCHECK;
1594 
1596  if (state & BST_PUSHED) flags |= DFCS_PUSHED;
1597 
1599 
1600  /* rbox must have the correct height */
1601  delta = rbox.bottom - rbox.top - checkBoxHeight;
1602 
1603  if (style & BS_TOP) {
1604  if (delta > 0) {
1605  rbox.bottom = rbox.top + checkBoxHeight;
1606  } else {
1607  rbox.top -= -delta/2 + 1;
1608  rbox.bottom = rbox.top + checkBoxHeight;
1609  }
1610  } else if (style & BS_BOTTOM) {
1611  if (delta > 0) {
1612  rbox.top = rbox.bottom - checkBoxHeight;
1613  } else {
1614  rbox.bottom += -delta/2 + 1;
1615  rbox.top = rbox.bottom - checkBoxHeight;
1616  }
1617  } else { /* Default */
1618  if (delta > 0) {
1619  int ofs = (delta / 2);
1620  rbox.bottom -= ofs + 1;
1621  rbox.top = rbox.bottom - checkBoxHeight;
1622  } else if (delta < 0) {
1623  int ofs = (-delta / 2);
1624  rbox.top -= ofs + 1;
1625  rbox.bottom = rbox.top + checkBoxHeight;
1626  }
1627  }
1628 
1629  DrawFrameControl( hDC, &rbox, DFC_BUTTON, flags );
1630  }
1631 
1632  if (dtFlags == (UINT)-1L) /* Noting to draw */
1633  return;
1634 
1635  if (action == ODA_DRAWENTIRE)
1636  BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &rtext);
1637 
1638  /* ... and focus */
1639  if (action == ODA_FOCUS || (state & BST_FOCUS))
1640  {
1641  rtext.left--;
1642  rtext.right++;
1643  IntersectRect(&rtext, &rtext, &client);
1644  DrawFocusRect( hDC, &rtext );
1645  }
1646  SelectClipRgn( hDC, hrgn );
1647  if (hrgn) DeleteObject( hrgn );
1648 }
#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:1332
#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:1400
#define BS_RADIOBUTTON
Definition: pedump.c:655
UINT state
Definition: button.c:168
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
#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:307
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:306
LONG right
Definition: windef.h:308
#define ODA_FOCUS
Definition: winuser.h:2519
#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:1185
#define BST_FOCUS
Definition: winuser.h:200
#define ODA_DRAWENTIRE
Definition: winuser.h:2517
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2944
#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)
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:309
#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:2518

◆ CB_ThemedPaint()

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

Definition at line 1904 of file button.c.

1906 {
1907  static const int cb_states[3][5] =
1908  {
1912  };
1913 
1914  static const int rb_states[2][5] =
1915  {
1918  };
1919 
1920  SIZE sz;
1921  RECT bgRect, textRect;
1922  HFONT font, hPrevFont = NULL;
1923  int checkState = infoPtr->state & 3;
1924  DWORD dwStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
1925  UINT btn_type = get_button_type( dwStyle );
1926  int part = (btn_type == BS_RADIOBUTTON) || (btn_type == BS_AUTORADIOBUTTON) ? BP_RADIOBUTTON : BP_CHECKBOX;
1927  int state = (part == BP_CHECKBOX)
1928  ? cb_states[ checkState ][ drawState ]
1929  : rb_states[ checkState ][ drawState ];
1930  WCHAR *text = get_button_text(infoPtr);
1931  LOGFONTW lf;
1932  BOOL created_font = FALSE;
1933 #ifdef __REACTOS__
1934  HWND parent;
1935  HBRUSH hBrush;
1936  DWORD cdrf;
1937 #endif
1938 
1939  HRESULT hr = GetThemeFont(theme, hDC, part, state, TMT_FONT, &lf);
1940  if (SUCCEEDED(hr)) {
1941  font = CreateFontIndirectW(&lf);
1942  if (!font)
1943  TRACE("Failed to create font\n");
1944  else {
1945  TRACE("font = %s\n", debugstr_w(lf.lfFaceName));
1946  hPrevFont = SelectObject(hDC, font);
1947  created_font = TRUE;
1948  }
1949  } else {
1950 #ifdef __REACTOS__ /* r73885 */
1951  font = infoPtr->font;
1952 #else
1953  font = (HFONT)SendMessageW(infoPtr->hwnd, WM_GETFONT, 0, 0);
1954 #endif
1955  hPrevFont = SelectObject(hDC, font);
1956  }
1957 
1958  if (FAILED(GetThemePartSize(theme, hDC, part, state, NULL, TS_DRAW, &sz)))
1959  sz.cx = sz.cy = 13;
1960 
1961  GetClientRect(infoPtr->hwnd, &bgRect);
1962 
1963 #ifdef __REACTOS__
1964  if (prfFlag == 0)
1965  {
1966  DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
1967  }
1968 
1969  parent = GetParent(infoPtr->hwnd);
1970  if (!parent) parent = infoPtr->hwnd;
1971  hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
1972  (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1973  if (!hBrush) /* did the app forget to call defwindowproc ? */
1974  hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
1975  (WPARAM)hDC, (LPARAM)infoPtr->hwnd );
1976  FillRect( hDC, &bgRect, hBrush );
1977 
1978  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &bgRect);
1979  if (cdrf == CDRF_SKIPDEFAULT)
1980  goto cleanup;
1981 #endif
1982 
1983  GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &textRect);
1984 
1985  if (dtFlags & DT_SINGLELINE) /* Center the checkbox / radio button to the text. */
1986  bgRect.top = bgRect.top + (textRect.bottom - textRect.top - sz.cy) / 2;
1987 
1988  /* adjust for the check/radio marker */
1989  bgRect.bottom = bgRect.top + sz.cy;
1990  bgRect.right = bgRect.left + sz.cx;
1991  textRect.left = bgRect.right + 6;
1992 
1993 #ifdef __REACTOS__
1994  DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
1995 
1996  if (cdrf == CDRF_NOTIFYPOSTERASE)
1997  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &bgRect);
1998 
1999  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &bgRect);
2000  if (cdrf == CDRF_SKIPDEFAULT)
2001  goto cleanup;
2002 
2003 #else
2004  DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
2005  DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL);
2006 #endif
2007  if (text)
2008  {
2009  DrawThemeText(theme, hDC, part, state, text, lstrlenW(text), dtFlags, 0, &textRect);
2010 
2011  if (focused)
2012  {
2013  RECT focusRect;
2014 
2015  focusRect = textRect;
2016 
2017  DrawTextW(hDC, text, lstrlenW(text), &focusRect, dtFlags | DT_CALCRECT);
2018 
2019  if (focusRect.right < textRect.right) focusRect.right++;
2020  focusRect.bottom = textRect.bottom;
2021 
2022  DrawFocusRect( hDC, &focusRect );
2023  }
2024 
2025  heap_free(text);
2026 #ifdef __REACTOS__
2027  text = NULL;
2028 #endif
2029  }
2030 
2031 #ifdef __REACTOS__
2032  if (cdrf == CDRF_NOTIFYPOSTPAINT)
2033  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
2034 cleanup:
2035  if (text) heap_free(text);
2036 #endif
2037  if (created_font) DeleteObject(font);
2038  if (hPrevFont) SelectObject(hDC, hPrevFont);
2039 }
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:279
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:270
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
UINT state
Definition: button.c:168
const WCHAR * text
Definition: package.c:1827
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
LONG top
Definition: windef.h:307
#define CDDS_POSTPAINT
Definition: commctrl.h:277
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:306
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:266
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:416
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:334
#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:2944
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
unsigned long DWORD
Definition: ntddk_ex.h:95
static LPARAM
Definition: button.c:42
#define CDDS_PREPAINT
Definition: commctrl.h:276
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:273
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:309
char * cleanup(char *str)
Definition: wpickclick.c:99
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
LONG cy
Definition: windef.h:335
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:278
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 1687 of file button.c.

1688 {
1689  RECT rc, rcFrame;
1690  HBRUSH hbr;
1691  HFONT hFont;
1692  UINT dtFlags;
1693  TEXTMETRICW tm;
1694  LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1695  HWND parent;
1696  HRGN hrgn;
1697 
1698  if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1699  /* GroupBox acts like static control, so it sends CTLCOLORSTATIC */
1700  parent = GetParent(infoPtr->hwnd);
1701  if (!parent) parent = infoPtr->hwnd;
1702  hbr = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1703  if (!hbr) /* did the app forget to call defwindowproc ? */
1704  hbr = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1705  GetClientRect( infoPtr->hwnd, &rc);
1706  rcFrame = rc;
1707  hrgn = set_control_clipping( hDC, &rc );
1708 
1709  GetTextMetricsW (hDC, &tm);
1710  rcFrame.top += (tm.tmHeight / 2) - 1;
1711  DrawEdge (hDC, &rcFrame, EDGE_ETCHED, BF_RECT | ((style & BS_FLAT) ? BF_FLAT : 0));
1712 
1713  InflateRect(&rc, -7, 1);
1714  dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &rc);
1715 
1716  if (dtFlags != (UINT)-1)
1717  {
1718  /* Because buttons have CS_PARENTDC class style, there is a chance
1719  * that label will be drawn out of client rect.
1720  * But Windows doesn't clip label's rect, so do I.
1721  */
1722 
1723  /* There is 1-pixel margin at the left, right, and bottom */
1724  rc.left--; rc.right++; rc.bottom++;
1725  FillRect(hDC, &rc, hbr);
1726  rc.left++; rc.right--; rc.bottom--;
1727 
1728  BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &rc);
1729  }
1730  SelectClipRgn( hDC, hrgn );
1731  if (hrgn) DeleteObject( hrgn );
1732 }
#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:1332
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:1754
LONG top
Definition: windef.h:307
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:306
LONG right
Definition: windef.h:308
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:1185
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2944
#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:309
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 2044 of file button.c.

2046 {
2047  static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };
2048 
2049  RECT bgRect, textRect, contentRect;
2050  int state = states[ drawState ];
2051  WCHAR *text = get_button_text(infoPtr);
2052  LOGFONTW lf;
2053  HFONT font, hPrevFont = NULL;
2054  BOOL created_font = FALSE;
2055 #ifdef __REACTOS__ /* r74406 */
2056  HWND parent;
2057  HBRUSH hBrush;
2058  RECT clientRect;
2059 #endif
2060 
2061  HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf);
2062  if (SUCCEEDED(hr)) {
2063  font = CreateFontIndirectW(&lf);
2064  if (!font)
2065  TRACE("Failed to create font\n");
2066  else {
2067  hPrevFont = SelectObject(hDC, font);
2068  created_font = TRUE;
2069  }
2070  } else {
2071 #ifdef __REACTOS__ /* r73885 */
2072  font = infoPtr->font;
2073 #else
2074  font = (HFONT)SendMessageW(infoPtr->hwnd, WM_GETFONT, 0, 0);
2075 #endif
2076  hPrevFont = SelectObject(hDC, font);
2077  }
2078 
2079  GetClientRect(infoPtr->hwnd, &bgRect);
2080  textRect = bgRect;
2081 
2082  if (text)
2083  {
2084  SIZE textExtent;
2085  GetTextExtentPoint32W(hDC, text, lstrlenW(text), &textExtent);
2086  bgRect.top += (textExtent.cy / 2);
2087  textRect.left += 10;
2088  textRect.bottom = textRect.top + textExtent.cy;
2089  textRect.right = textRect.left + textExtent.cx + 4;
2090 
2092  }
2093 
2094  GetThemeBackgroundContentRect(theme, hDC, BP_GROUPBOX, state, &bgRect, &contentRect);
2095  ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom);
2096 
2097 #ifdef __REACTOS__ /* r73885 & r74149 */
2098  if (prfFlag == 0)
2099 #endif
2101  DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
2102 
2103 #ifdef __REACTOS__ /* r74406 */
2104  parent = GetParent(infoPtr->hwnd);
2105  if (!parent) parent = infoPtr->hwnd;
2106  hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
2107  (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
2108  if (!hBrush) /* did the app forget to call defwindowproc ? */
2109  hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC,
2110  (WPARAM)hDC, (LPARAM)infoPtr->hwnd );
2111  GetClientRect(infoPtr->hwnd, &clientRect);
2112  FillRect( hDC, &clientRect, hBrush );
2113 #endif
2114 
2115  DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL);
2116 
2118 
2119  if (text)
2120  {
2121  InflateRect(&textRect, -2, 0);
2123  heap_free(text);
2124  }
2125 
2126  if (created_font) DeleteObject(font);
2127  if (hPrevFont) SelectObject(hDC, hPrevFont);
2128 }
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
UINT state
Definition: button.c:168
const WCHAR * text
Definition: package.c:1827
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
LONG top
Definition: windef.h:307
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:306
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:416
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:334
#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:2944
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
static LPARAM
Definition: button.c:42
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:309
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
LONG cy
Definition: windef.h:335
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:57
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:1412

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

1782 {
1783  LONG state = infoPtr->state;
1784  DRAWITEMSTRUCT dis;
1785  LONG_PTR id = GetWindowLongPtrW( infoPtr->hwnd, GWLP_ID );
1786  HWND parent;
1787  HFONT hFont;
1788  HRGN hrgn;
1789 
1790  dis.CtlType = ODT_BUTTON;
1791  dis.CtlID = id;
1792  dis.itemID = 0;
1793  dis.itemAction = action;
1794  dis.itemState = ((state & BST_FOCUS) ? ODS_FOCUS : 0) |
1795  ((state & BST_PUSHED) ? ODS_SELECTED : 0) |
1796  (IsWindowEnabled(infoPtr->hwnd) ? 0: ODS_DISABLED);
1797  dis.hwndItem = infoPtr->hwnd;
1798  dis.hDC = hDC;
1799  dis.itemData = 0;
1800  GetClientRect( infoPtr->hwnd, &dis.rcItem );
1801 
1802  if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1803  parent = GetParent(infoPtr->hwnd);
1804  if (!parent) parent = infoPtr->hwnd;
1806 
1807  hrgn = set_control_clipping( hDC, &dis.rcItem );
1808 
1809  SendMessageW( GetParent(infoPtr->hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
1810  SelectClipRgn( hDC, hrgn );
1811  if (hrgn) DeleteObject( hrgn );
1812 }
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
UINT state
Definition: button.c:168
ULONG_PTR itemData
Definition: winuser.h:3068
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ODS_FOCUS
Definition: winuser.h:2524
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4804
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:1751
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:2944
#define ODS_DISABLED
Definition: winuser.h:2522
#define BST_PUSHED
Definition: winuser.h:201
static HRGN hrgn
Definition: win.c:55
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:2520
#define ODT_BUTTON
Definition: winuser.h:2515
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 1400 of file button.c.

1401 {
1402  RECT rc, r;
1403  UINT dtFlags, uState;
1404  HPEN hOldPen, hpen;
1405  HBRUSH hOldBrush;
1406  INT oldBkMode;
1407  COLORREF oldTxtColor;
1408  HFONT hFont;
1409  LONG state = infoPtr->state;
1410  LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE );
1411  BOOL pushedState = (state & BST_PUSHED);
1412  HWND parent;
1413  HRGN hrgn;
1414 #ifdef __REACTOS__
1415  DWORD cdrf;
1416 #endif
1417 
1418  GetClientRect( infoPtr->hwnd, &rc );
1419 
1420  /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
1421  if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1422  parent = GetParent(infoPtr->hwnd);
1423  if (!parent) parent = infoPtr->hwnd;
1425 
1426  hrgn = set_control_clipping( hDC, &rc );
1427 
1429  hOldPen = SelectObject(hDC, hpen);
1431  oldBkMode = SetBkMode(hDC, TRANSPARENT);
1432 
1433 #ifdef __REACTOS__
1434  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &rc);
1435  if (cdrf == CDRF_SKIPDEFAULT)
1436  goto cleanup;
1437 #endif
1438 
1440  {
1441  if (action != ODA_FOCUS)
1442  Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
1443  InflateRect( &rc, -1, -1 );
1444  }
1445 
1446  /* completely skip the drawing if only focus has changed */
1447  if (action == ODA_FOCUS) goto draw_focus;
1448 
1449  uState = DFCS_BUTTONPUSH;
1450 
1451  if (style & BS_FLAT)
1452  uState |= DFCS_MONO;
1453  else if (pushedState)
1454  {
1456  uState |= DFCS_FLAT;
1457  else
1458  uState |= DFCS_PUSHED;
1459  }
1460 
1462  uState |= DFCS_CHECKED;
1463 
1464  DrawFrameControl( hDC, &rc, DFC_BUTTON, uState );
1465 
1466 #ifdef __REACTOS__
1467  if (cdrf == CDRF_NOTIFYPOSTERASE)
1468  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &rc);
1469 
1470  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &rc);
1471  if (cdrf == CDRF_SKIPDEFAULT)
1472  goto cleanup;
1473 #endif
1474 
1475  /* draw button label */
1476  r = rc;
1477  dtFlags = BUTTON_CalcLabelRect(infoPtr, hDC, &r);
1478 
1479  if (dtFlags == (UINT)-1L)
1480  goto cleanup;
1481 
1482  if (pushedState)
1483  OffsetRect(&r, 1, 1);
1484 
1485  oldTxtColor = SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) );
1486 
1487  BUTTON_DrawLabel(infoPtr, hDC, dtFlags, &r);
1488 
1489  SetTextColor( hDC, oldTxtColor );
1490 
1491 #ifdef __REACTOS__
1492  if (cdrf == CDRF_NOTIFYPOSTPAINT)
1493  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &rc);
1494 #endif
1495 
1496 draw_focus:
1497  if (action == ODA_FOCUS || (state & BST_FOCUS))
1498  {
1499 #ifdef __REACTOS__
1500  if (!(infoPtr->ui_state & UISF_HIDEFOCUS))
1501  {
1502 #endif
1503  InflateRect( &rc, -2, -2 );
1504  DrawFocusRect( hDC, &rc );
1505 #ifdef __REACTOS__
1506  }
1507 #endif
1508  }
1509 
1510  cleanup:
1511  SelectObject( hDC, hOldPen );
1512  SelectObject( hDC, hOldBrush );
1513  SetBkMode(hDC, oldBkMode);
1514  SelectClipRgn( hDC, hrgn );
1515  if (hrgn) DeleteObject( hrgn );
1516  DeleteObject( hpen );
1517 }
#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:1332
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:279
#define DFCS_CHECKED
Definition: winuser.h:504
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:270
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
UINT state
Definition: button.c:168
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:307
#define CDDS_POSTPAINT
Definition: commctrl.h:277
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:306
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:266
LONG right
Definition: windef.h:308
#define ODA_FOCUS
Definition: winuser.h:2519
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:239
int32_t INT
Definition: typedefs.h:57
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:1751
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:1185
#define BST_FOCUS
Definition: winuser.h:200
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2944
#define BST_PUSHED
Definition: winuser.h:201
DWORD COLORREF
Definition: windef.h:300
#define DFCS_MONO
Definition: winuser.h:511
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CDDS_PREPAINT
Definition: commctrl.h:276
static const WCHAR L[]
Definition: oid.c:1250
#define COLOR_BTNFACE
Definition: winuser.h:918
static HRGN hrgn
Definition: win.c:55
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:888
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:273
#define BST_CHECKED
Definition: winuser.h:197
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG bottom
Definition: windef.h:309
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:278

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

1819 {
1820  static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED };
1821 
1822  RECT bgRect, textRect;
1823  HFONT font = infoPtr->font;
1824  HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
1825  int state = states[ drawState ];
1826  WCHAR *text = get_button_text(infoPtr);
1827 #ifdef __REACTOS__
1828  HWND parent;
1829  DWORD cdrf;
1830 
1831  GetClientRect(infoPtr->hwnd, &bgRect);
1833 
1834  if (prfFlag == 0)
1835  {
1837  DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
1838  }
1839 
1840  parent = GetParent(infoPtr->hwnd);
1841  if (!parent) parent = infoPtr->hwnd;
1843 
1844  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREERASE, &bgRect);
1845  if (cdrf == CDRF_SKIPDEFAULT)
1846  goto cleanup;
1847 
1848  DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
1849 
1850  if (cdrf == CDRF_NOTIFYPOSTERASE)
1851  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTERASE, &bgRect);
1852 
1853  cdrf = BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_PREPAINT, &bgRect);
1854  if (cdrf == CDRF_SKIPDEFAULT)
1855  goto cleanup;
1856 
1857  BUTTON_DrawIml(hDC, &infoPtr->imlData, &textRect, FALSE, drawState);
1858 #else
1859  GetClientRect(infoPtr->hwnd, &bgRect);
1861 
1863  DrawThemeParentBackground(infoPtr->hwnd, hDC, NULL);
1864 
1865  DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL);
1866 #endif
1867 
1868  if (text)
1869  {
1870  DrawThemeText(theme, hDC, BP_PUSHBUTTON, state, text, lstrlenW(text), dtFlags, 0, &textRect);
1871  heap_free(text);
1872 #ifdef __REACTOS__
1873  text = NULL;
1874 #endif
1875  }
1876 
1877  if (focused)
1878  {
1879  MARGINS margins;
1880  RECT focusRect = bgRect;
1881 
1883 
1884  focusRect.left += margins.cxLeftWidth;
1885  focusRect.top += margins.cyTopHeight;
1886  focusRect.right -= margins.cxRightWidth;
1887  focusRect.bottom -= margins.cyBottomHeight;
1888 
1889  DrawFocusRect( hDC, &focusRect );
1890  }
1891 
1892 #ifdef __REACTOS__
1893  if (cdrf == CDRF_NOTIFYPOSTPAINT)
1894  BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
1895 cleanup:
1896  if (text) heap_free(text);
1897 #endif
1898  if (hPrevFont) SelectObject(hDC, hPrevFont);
1899 }
#define CDDS_POSTERASE
Definition: commctrl.h:279
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:270
Definition: mk_font.cpp:20
static WCHAR * get_button_text(const BUTTON_INFO *infoPtr)
Definition: button.c:230
UINT state
Definition: button.c:168
const WCHAR * text
Definition: package.c:1827
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
LONG top
Definition: windef.h:307
#define CDDS_POSTPAINT
Definition: commctrl.h:277
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
UINT_PTR WPARAM
Definition: windef.h:207
LONG left
Definition: windef.h:306
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:266
LONG right
Definition: windef.h:308
#define lstrlenW
Definition: compat.h:416
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:1751
#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:2944
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CDDS_PREPAINT
Definition: commctrl.h:276
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:273
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:309
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:278
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:1370
LONG top
Definition: windef.h:307
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
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:750
LONG bottom
Definition: windef.h:309
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 1739 of file button.c.

1740 {
1741  RECT rc;
1742  HBRUSH hBrush;
1743  HFONT hFont;
1744  LONG state = infoPtr->state;
1745  HWND parent;
1746 
1747  GetClientRect( infoPtr->hwnd, &rc);
1748 
1749  if ((hFont = infoPtr->font)) SelectObject( hDC, hFont );
1750 
1751  parent = GetParent(infoPtr->hwnd);
1752  if (!parent) parent = infoPtr->hwnd;
1753  hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1754  if (!hBrush) /* did the app forget to call defwindowproc ? */
1755  hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
1756 
1757  FillRect( hDC, &rc, hBrush );
1758  if (action == ODA_FOCUS || (state & BST_FOCUS))
1759  DrawFocusRect( hDC, &rc );
1760 
1761  switch (action)
1762  {
1763  case ODA_FOCUS:
1765  break;
1766 
1767  case ODA_SELECT:
1769  break;
1770 
1771  default:
1772  break;
1773  }
1774 }
UINT state
Definition: button.c:168
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:2519
#define BN_UNHILITE
Definition: winuser.h:1916
HFONT hFont
Definition: main.c:53
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
long LONG
Definition: pedump.c:60
#define BST_FOCUS
Definition: winuser.h:200
#define BN_HILITE
Definition: winuser.h:1911
#define BUTTON_NOTIFY_PARENT(hWnd, code)
Definition: button.c:85
HWND hwnd
Definition: button.c:95
r parent
Definition: btrfs.c:2944
#define BST_PUSHED
Definition: winuser.h:201
static LPARAM
Definition: button.c:42
#define BN_KILLFOCUS
Definition: winuser.h:1912
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:1915
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:2518

◆ 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:1400
static void CB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1523
static void OB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1781
static void GB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1687
smooth NULL
Definition: ftsmooth.c:416
static void UB_Paint(const BUTTON_INFO *infoPtr, HDC hDC, UINT action)
Definition: button.c:1739

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:1904
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:1817
static void GB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hdc, ButtonState drawState, UINT dtflags, BOOL focused)
Definition: button.c:2044

Definition at line 191 of file button.c.

Referenced by BUTTON_WindowProc().

◆ maxCheckState