Removed checkbox bitmap loading code and hardcoded checkbox size.

Checkboxes are visible now.

svn path=/trunk/; revision=6007
This commit is contained in:
Eric Kohl 2003-09-07 13:16:55 +00:00
parent 1a1d4a8874
commit 4d237d4e7c

View file

@ -1,4 +1,4 @@
/* $Id: button.c,v 1.9 2003/08/17 17:32:58 royce Exp $
/* $Id: button.c,v 1.10 2003/09/07 13:16:55 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS User32
@ -75,7 +75,6 @@ static const pfPaint btnPaintFunc[MAX_BTN_TYPE] =
OB_Paint /* BS_OWNERDRAW */
};
static HBITMAP hbitmapCheckBoxes = 0;
static WORD checkBoxWidth = 0, checkBoxHeight = 0;
@ -184,15 +183,9 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
case WM_CREATE:
DbgPrint("[button] WM_CREATE\n");
if (!hbitmapCheckBoxes)
{
BITMAP bmp;
DbgPrint("[button] Loading bitmaps\n");
hbitmapCheckBoxes = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_CHECKBOXES));
GetObjectW( hbitmapCheckBoxes, sizeof(bmp), &bmp );
checkBoxWidth = bmp.bmWidth / 4;
checkBoxHeight = bmp.bmHeight / 3;
}
checkBoxWidth = 14;
checkBoxHeight = 13;
if (btn_type >= MAX_BTN_TYPE)
return -1; /* abort */
set_button_state( hWnd, BUTTON_UNCHECKED );
@ -841,7 +834,8 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
GetClientRect(hwnd, &client);
rbox = rtext = client;
if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
if ((hFont = get_button_font( hwnd )))
SelectObject( hDC, hFont );
hBrush = (HBRUSH)SendMessageW(GetParent(hwnd), WM_CTLCOLORSTATIC,
(WPARAM)hDC, (LPARAM)hwnd);
@ -863,8 +857,10 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
}
/* Since WM_ERASEBKGND does nothing, first prepare background */
if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
if (action == ODA_DRAWENTIRE) FillRect( hDC, &client, hBrush );
if (action == ODA_SELECT)
FillRect( hDC, &rbox, hBrush );
if (action == ODA_DRAWENTIRE)
FillRect( hDC, &client, hBrush );
/* Draw label */
client = rtext;
@ -878,33 +874,51 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
UINT flags;
if ((get_button_type(style) == BS_RADIOBUTTON) ||
(get_button_type(style) == BS_AUTORADIOBUTTON)) flags = DFCS_BUTTONRADIO;
else if (state & BUTTON_3STATE) flags = DFCS_BUTTON3STATE;
else flags = DFCS_BUTTONCHECK;
(get_button_type(style) == BS_AUTORADIOBUTTON))
flags = DFCS_BUTTONRADIO;
else if (state & BUTTON_3STATE)
flags = DFCS_BUTTON3STATE;
else
flags = DFCS_BUTTONCHECK;
if (state & (BUTTON_CHECKED | BUTTON_3STATE)) flags |= DFCS_CHECKED;
if (state & BUTTON_HIGHLIGHTED) flags |= DFCS_PUSHED;
if (state & (BUTTON_CHECKED | BUTTON_3STATE))
flags |= DFCS_CHECKED;
if (state & BUTTON_HIGHLIGHTED)
flags |= DFCS_PUSHED;
if (style & WS_DISABLED) flags |= DFCS_INACTIVE;
if (style & WS_DISABLED)
flags |= DFCS_INACTIVE;
/* rbox must have the correct height */
delta = rbox.bottom - rbox.top - checkBoxHeight;
if (style & BS_TOP) {
if (delta > 0) {
if (style & BS_TOP)
{
if (delta > 0)
{
rbox.bottom = rbox.top + checkBoxHeight;
} else {
}
else
{
rbox.top -= -delta/2 + 1;
rbox.bottom += rbox.top + checkBoxHeight;
}
} else if (style & BS_BOTTOM) {
if (delta > 0) {
}
else if (style & BS_BOTTOM)
{
if (delta > 0)
{
rbox.top = rbox.bottom - checkBoxHeight;
} else {
}
else
{
rbox.bottom += -delta/2 + 1;
rbox.top = rbox.bottom -= checkBoxHeight;
}
} else { /* Default */
}
else
{
/* Default */
if (delta > 0)
{
int ofs = (delta / 2);
@ -924,6 +938,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
if (dtFlags == (UINT)-1L) /* Noting to draw */
return;
hRgn = CreateRectRgn(client.left, client.top, client.right, client.bottom);
SelectClipRgn(hDC, hRgn);
DeleteObject(hRgn);
@ -997,7 +1012,6 @@ static void GB_Paint( HWND hwnd, HDC hDC, UINT action )
rcFrame.top += (tm.tmHeight / 2) - 1;
DrawEdge (hDC, &rcFrame, EDGE_ETCHED, BF_RECT | ((style & BS_FLAT) ? BF_FLAT : 0));
InflateRect(&rc, -7, 1);
dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &rc);