* - Button_SetImageList
* - Button_SetTextMargin
*/
+
#include <user32.h>
-#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(button);
/* GetWindowLong offsets for window extra information */
#define STATE_GWL_OFFSET 0
-#define HFONT_GWL_OFFSET (sizeof(LONG))
-#define HIMAGE_GWL_OFFSET (HFONT_GWL_OFFSET+sizeof(HFONT))
-#define UISTATE_GWL_OFFSET (HIMAGE_GWL_OFFSET+sizeof(HFONT))
-#define NB_EXTRA_BYTES (UISTATE_GWL_OFFSET+sizeof(LONG))
+#define BUTTON_HFONT_GWL_OFFSET (sizeof(LONG))
+#define HIMAGE_GWL_OFFSET (BUTTON_HFONT_GWL_OFFSET+sizeof(HFONT))
+#define BUTTON_UISTATE_GWL_OFFSET (HIMAGE_GWL_OFFSET+sizeof(HFONT))
+#define NB_EXTRA_BYTES (BUTTON_UISTATE_GWL_OFFSET+sizeof(LONG))
/* undocumented flags */
#define BUTTON_NSTATES 0x0F
BST_UNCHECKED /* BS_OWNERDRAW */
};
-typedef void (*pfPaint)( HWND hwnd, HDC hdc, UINT action );
+typedef void (*pfButtonPaint)( HWND hwnd, HDC hdc, UINT action );
-static const pfPaint btnPaintFunc[MAX_BTN_TYPE] =
+static const pfButtonPaint btnPaintFunc[MAX_BTN_TYPE] =
{
PB_Paint, /* BS_PUSHBUTTON */
PB_Paint, /* BS_DEFPUSHBUTTON */
static __inline void set_ui_state( HWND hwnd, LONG flags )
{
- SetWindowLongPtrW( hwnd, UISTATE_GWL_OFFSET, flags );
+ SetWindowLongPtrW( hwnd, BUTTON_UISTATE_GWL_OFFSET, flags );
}
static __inline LONG get_ui_state( HWND hwnd )
{
- return GetWindowLongPtrW( hwnd, UISTATE_GWL_OFFSET );
+ return GetWindowLongPtrW( hwnd, BUTTON_UISTATE_GWL_OFFSET );
}
#endif /* __REACTOS__ */
static inline HFONT get_button_font( HWND hwnd )
{
- return (HFONT)GetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET );
+ return (HFONT)GetWindowLongPtrW( hwnd, BUTTON_HFONT_GWL_OFFSET );
}
static inline void set_button_font( HWND hwnd, HFONT font )
{
- SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, (LONG_PTR)font );
+ SetWindowLongPtrW( hwnd, BUTTON_HFONT_GWL_OFFSET, (LONG_PTR)font );
}
static inline UINT get_button_type( LONG window_style )
SendMessageW( hWnd, BM_SETCHECK, !(state & BST_CHECKED), 0 );
break;
case BS_AUTORADIOBUTTON:
- SendMessageW( hWnd, BM_SETCHECK, TRUE, 0 );
+ BUTTON_CheckAutoRadioButton( hWnd );
break;
case BS_AUTO3STATE:
SendMessageW( hWnd, BM_SETCHECK,
set_button_state( hWnd, (state & ~3) | wParam );
paint_button( hWnd, btn_type, ODA_SELECT );
}
- if ((btn_type == BS_AUTORADIOBUTTON) && (wParam == BST_CHECKED) && (style & WS_CHILD))
- BUTTON_CheckAutoRadioButton( hWnd );
break;
case BM_GETSTATE:
{
case DT_TOP: r.top++; r.bottom++; break;
case DT_VCENTER: n = r.bottom - r.top;
+#ifdef __REACTOS__
+ r.top = rc->top + ((rc->bottom - 1 - rc->top) - n) / 2;
+#else
r.top = rc->top + ((rc->bottom - rc->top) - n) / 2;
+#endif
r.bottom = r.top + n; break;
case DT_BOTTOM: n = r.bottom - r.top;
r.bottom = rc->bottom - 1;
parent = GetParent(hwnd);
/* make sure that starting control is not disabled or invisible */
- start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
+ start = sibling = hwnd;
do
{
if (!sibling) break;
- if ((hwnd != sibling) &&
- ((GetWindowLongPtrW( sibling, GWL_STYLE) & BS_TYPEMASK) == BS_AUTORADIOBUTTON))
- SendMessageW( sibling, BM_SETCHECK, BST_UNCHECKED, 0 );
+ if (SendMessageW( sibling, WM_GETDLGCODE, 0, 0 ) == (DLGC_BUTTON | DLGC_RADIOBUTTON))
+ SendMessageW( sibling, BM_SETCHECK, sibling == hwnd ? BST_CHECKED : BST_UNCHECKED, 0 );
sibling = GetNextDlgGroupItem( parent, sibling, FALSE );
} while (sibling != start);
}