- Fix some indentation problems.
- Handle correctly the alignement of the checkboxes if the BS_TOP/BS_BOTTOM flags are set.
This commit is contained in:
parent
812b4f46e9
commit
7ba2a371d3
@ -862,6 +862,12 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
|
|||||||
rbox.right = checkBoxWidth;
|
rbox.right = checkBoxWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Draw label */
|
||||||
|
client = rtext;
|
||||||
|
dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &rtext);
|
||||||
|
|
||||||
|
rbox.top = rtext.top;
|
||||||
|
rbox.bottom = rtext.bottom;
|
||||||
/* Draw the check-box bitmap */
|
/* Draw the check-box bitmap */
|
||||||
if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
|
if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
|
||||||
{
|
{
|
||||||
@ -871,29 +877,29 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
|
|||||||
|
|
||||||
if( TWEAK_WineLook == WIN31_LOOK )
|
if( TWEAK_WineLook == WIN31_LOOK )
|
||||||
{
|
{
|
||||||
HDC hMemDC = CreateCompatibleDC( hDC );
|
HDC hMemDC = CreateCompatibleDC( hDC );
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
delta = (rbox.bottom - rbox.top - checkBoxHeight) / 2;
|
delta = (rbox.bottom - rbox.top - checkBoxHeight) / 2;
|
||||||
|
|
||||||
/* Check in case the client area is smaller than the checkbox bitmap */
|
/* Check in case the client area is smaller than the checkbox bitmap */
|
||||||
if (delta < 0) delta = 0;
|
if (delta < 0) delta = 0;
|
||||||
|
|
||||||
if (state & BUTTON_HIGHLIGHTED) x += 2 * checkBoxWidth;
|
if (state & BUTTON_HIGHLIGHTED) x += 2 * checkBoxWidth;
|
||||||
if (state & (BUTTON_CHECKED | BUTTON_3STATE)) x += checkBoxWidth;
|
if (state & (BUTTON_CHECKED | BUTTON_3STATE)) x += checkBoxWidth;
|
||||||
if ((get_button_type(style) == BS_RADIOBUTTON) ||
|
if ((get_button_type(style) == BS_RADIOBUTTON) ||
|
||||||
(get_button_type(style) == BS_AUTORADIOBUTTON)) y += checkBoxHeight;
|
(get_button_type(style) == BS_AUTORADIOBUTTON)) y += checkBoxHeight;
|
||||||
else if (state & BUTTON_3STATE) y += 2 * checkBoxHeight;
|
else if (state & BUTTON_3STATE) y += 2 * checkBoxHeight;
|
||||||
|
|
||||||
/* The bitmap for the radio button is not aligned with the
|
/* The bitmap for the radio button is not aligned with the
|
||||||
* left of the window, it is 1 pixel off. */
|
* left of the window, it is 1 pixel off. */
|
||||||
if ((get_button_type(style) == BS_RADIOBUTTON) ||
|
if ((get_button_type(style) == BS_RADIOBUTTON) ||
|
||||||
(get_button_type(style) == BS_AUTORADIOBUTTON))
|
(get_button_type(style) == BS_AUTORADIOBUTTON))
|
||||||
rbox.left += 1;
|
rbox.left += 1;
|
||||||
|
|
||||||
SelectObject( hMemDC, hbitmapCheckBoxes );
|
SelectObject( hMemDC, hbitmapCheckBoxes );
|
||||||
BitBlt( hDC, rbox.left, rbox.top + delta, checkBoxWidth,
|
BitBlt( hDC, rbox.left, rbox.top + delta, checkBoxWidth,
|
||||||
checkBoxHeight, hMemDC, x, y, SRCCOPY );
|
checkBoxHeight, hMemDC, x, y, SRCCOPY );
|
||||||
DeleteDC( hMemDC );
|
DeleteDC( hMemDC );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -910,28 +916,41 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
|
|||||||
if (style & WS_DISABLED) flags |= DFCS_INACTIVE;
|
if (style & WS_DISABLED) flags |= DFCS_INACTIVE;
|
||||||
|
|
||||||
/* rbox must have the correct height */
|
/* rbox must have the correct height */
|
||||||
delta = rbox.bottom - rbox.top - checkBoxHeight;
|
delta = rbox.bottom - rbox.top - checkBoxHeight;
|
||||||
if (delta > 0)
|
|
||||||
{
|
if (style & BS_TOP) {
|
||||||
int ofs = (abs(delta) / 2);
|
if (delta > 0) {
|
||||||
rbox.bottom -= ofs + 1;
|
|
||||||
rbox.top = rbox.bottom - checkBoxHeight;
|
|
||||||
}
|
|
||||||
else if (delta < 0)
|
|
||||||
{
|
|
||||||
int ofs = (abs(delta) / 2);
|
|
||||||
rbox.top -= ofs + 1;
|
|
||||||
rbox.bottom = rbox.top + checkBoxHeight;
|
rbox.bottom = rbox.top + checkBoxHeight;
|
||||||
|
} else {
|
||||||
|
rbox.top -= -delta/2 + 1;
|
||||||
|
rbox.bottom += rbox.top + checkBoxHeight;
|
||||||
|
}
|
||||||
|
} else if (style & BS_BOTTOM) {
|
||||||
|
if (delta > 0) {
|
||||||
|
rbox.top = rbox.bottom - checkBoxHeight;
|
||||||
|
} else {
|
||||||
|
rbox.bottom += -delta/2 + 1;
|
||||||
|
rbox.top = rbox.bottom -= checkBoxHeight;
|
||||||
|
}
|
||||||
|
} else { /* Default */
|
||||||
|
if (delta > 0)
|
||||||
|
{
|
||||||
|
int ofs = (delta / 2);
|
||||||
|
rbox.bottom -= ofs + 1;
|
||||||
|
rbox.top = rbox.bottom - checkBoxHeight;
|
||||||
|
}
|
||||||
|
else if (delta < 0)
|
||||||
|
{
|
||||||
|
int ofs = (-delta / 2);
|
||||||
|
rbox.top -= ofs + 1;
|
||||||
|
rbox.bottom = rbox.top + checkBoxHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawFrameControl( hDC, &rbox, DFC_BUTTON, flags );
|
DrawFrameControl( hDC, &rbox, DFC_BUTTON, flags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw label */
|
|
||||||
client = rtext;
|
|
||||||
dtFlags = BUTTON_CalcLabelRect(hwnd, hDC, &rtext);
|
|
||||||
|
|
||||||
if (dtFlags == (UINT)-1L) /* Noting to draw */
|
if (dtFlags == (UINT)-1L) /* Noting to draw */
|
||||||
return;
|
return;
|
||||||
hRgn = CreateRectRgn(client.left, client.top, client.right, client.bottom);
|
hRgn = CreateRectRgn(client.left, client.top, client.right, client.bottom);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user