no real changes, just use AutoHXXX classes instead of manually creating/deleting objects in owner drawing code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -983,12 +983,12 @@ void DrawButtonFrame(HDC hdc, const RECT& rectBtn,
|
|||||||
RECT r;
|
RECT r;
|
||||||
CopyRect(&r, &rectBtn);
|
CopyRect(&r, &rectBtn);
|
||||||
|
|
||||||
HPEN hpenBlack = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW)),
|
AutoHPEN hpenBlack(GetSysColor(COLOR_3DDKSHADOW)),
|
||||||
hpenGrey = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW)),
|
hpenGrey(GetSysColor(COLOR_3DSHADOW)),
|
||||||
hpenLightGr = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)),
|
hpenLightGr(GetSysColor(COLOR_3DLIGHT)),
|
||||||
hpenWhite = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
|
hpenWhite(GetSysColor(COLOR_3DHILIGHT));
|
||||||
|
|
||||||
HPEN hpenOld = (HPEN)SelectObject(hdc, hpenBlack);
|
SelectInHDC selectPen(hdc, hpenBlack);
|
||||||
|
|
||||||
r.right--;
|
r.right--;
|
||||||
r.bottom--;
|
r.bottom--;
|
||||||
@@ -1026,12 +1026,6 @@ void DrawButtonFrame(HDC hdc, const RECT& rectBtn,
|
|||||||
wxDrawLine(hdc, r.left + 1, r.bottom - 1, r.right - 1, r.bottom - 1);
|
wxDrawLine(hdc, r.left + 1, r.bottom - 1, r.right - 1, r.bottom - 1);
|
||||||
wxDrawLine(hdc, r.right - 1, r.bottom - 1, r.right - 1, r.top);
|
wxDrawLine(hdc, r.right - 1, r.bottom - 1, r.right - 1, r.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)SelectObject(hdc, hpenOld);
|
|
||||||
DeleteObject(hpenWhite);
|
|
||||||
DeleteObject(hpenLightGr);
|
|
||||||
DeleteObject(hpenGrey);
|
|
||||||
DeleteObject(hpenBlack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_UXTHEME
|
#if wxUSE_UXTHEME
|
||||||
@@ -1096,12 +1090,11 @@ void MSWDrawXPBackground(wxButton *button, WXDRAWITEMSTRUCT *wxdis)
|
|||||||
if ( button->UseBgCol() )
|
if ( button->UseBgCol() )
|
||||||
{
|
{
|
||||||
COLORREF colBg = wxColourToRGB(button->GetBackgroundColour());
|
COLORREF colBg = wxColourToRGB(button->GetBackgroundColour());
|
||||||
HBRUSH hbrushBackground = ::CreateSolidBrush(colBg);
|
AutoHBRUSH hbrushBackground(colBg);
|
||||||
|
|
||||||
// don't overwrite the focus rect
|
// don't overwrite the focus rect
|
||||||
::InflateRect(&rectClient, -1, -1);
|
::InflateRect(&rectClient, -1, -1);
|
||||||
FillRect(hdc, &rectClient, hbrushBackground);
|
FillRect(hdc, &rectClient, hbrushBackground);
|
||||||
::DeleteObject(hbrushBackground);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // wxUSE_UXTHEME
|
#endif // wxUSE_UXTHEME
|
||||||
@@ -1172,9 +1165,8 @@ bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
|
|||||||
COLORREF colBg = wxColourToRGB(GetBackgroundColour());
|
COLORREF colBg = wxColourToRGB(GetBackgroundColour());
|
||||||
|
|
||||||
// first, draw the background
|
// first, draw the background
|
||||||
HBRUSH hbrushBackground = ::CreateSolidBrush(colBg);
|
AutoHBRUSH hbrushBackground(colBg);
|
||||||
FillRect(hdc, &rectBtn, hbrushBackground);
|
FillRect(hdc, &rectBtn, hbrushBackground);
|
||||||
::DeleteObject(hbrushBackground);
|
|
||||||
|
|
||||||
// draw the border for the current state
|
// draw the border for the current state
|
||||||
bool selected = (state & ODS_SELECTED) != 0;
|
bool selected = (state & ODS_SELECTED) != 0;
|
||||||
|
Reference in New Issue
Block a user