Merge branch 'msw-renderer-rect'
A couple of fixes to rectangles used in wxMSW wxRenderer code See https://github.com/wxWidgets/wxWidgets/pull/711
This commit is contained in:
@@ -99,6 +99,16 @@ public:
|
||||
wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags = 0) wxOVERRIDE = 0;
|
||||
|
||||
protected:
|
||||
// Helper function returning the MSW RECT corresponding to the wxRect
|
||||
// adjusted for the given wxDC.
|
||||
static RECT ConvertToRECT(wxDC& dc, const wxRect& rect)
|
||||
{
|
||||
RECT rc;
|
||||
wxCopyRectToRECT(dc.GetImpl()->MSWApplyGDIPlusTransform(rect), rc);
|
||||
return rc;
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -312,8 +322,7 @@ void wxRendererMSWBase::DrawFocusRect(wxWindow * WXUNUSED(win),
|
||||
const wxRect& rect,
|
||||
int WXUNUSED(flags))
|
||||
{
|
||||
RECT rc;
|
||||
wxCopyRectToRECT(rect, rc);
|
||||
RECT rc = ConvertToRECT(dc, rect);
|
||||
|
||||
::DrawFocusRect(GetHdcOf(dc.GetTempHDC()), &rc);
|
||||
}
|
||||
@@ -411,10 +420,7 @@ wxRendererMSW::DrawComboBoxDropButton(wxWindow * WXUNUSED(win),
|
||||
{
|
||||
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
||||
|
||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
||||
|
||||
RECT r;
|
||||
wxCopyRectToRECT(adjustedRect, r);
|
||||
RECT r = ConvertToRECT(dc, rect);
|
||||
|
||||
int style = DFCS_SCROLLCOMBOBOX;
|
||||
if ( flags & wxCONTROL_DISABLED )
|
||||
@@ -435,10 +441,7 @@ wxRendererMSW::DoDrawFrameControl(UINT type,
|
||||
{
|
||||
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
||||
|
||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
||||
|
||||
RECT r;
|
||||
wxCopyRectToRECT(adjustedRect, r);
|
||||
RECT r = ConvertToRECT(dc, rect);
|
||||
|
||||
int style = kind;
|
||||
if ( flags & wxCONTROL_CHECKED )
|
||||
@@ -613,10 +616,7 @@ wxRendererXP::DrawComboBoxDropButton(wxWindow * win,
|
||||
|
||||
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
||||
|
||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
||||
|
||||
RECT r;
|
||||
wxCopyRectToRECT(adjustedRect, r);
|
||||
RECT r = ConvertToRECT(dc, rect);
|
||||
|
||||
int state;
|
||||
if ( flags & wxCONTROL_PRESSED )
|
||||
@@ -656,10 +656,7 @@ wxRendererXP::DrawHeaderButton(wxWindow *win,
|
||||
|
||||
wxCHECK_MSG( dc.GetImpl(), -1, wxT("Invalid wxDC") );
|
||||
|
||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
||||
|
||||
RECT r;
|
||||
wxCopyRectToRECT(adjustedRect, r);
|
||||
RECT r = ConvertToRECT(dc, rect);
|
||||
|
||||
int state;
|
||||
if ( flags & wxCONTROL_PRESSED )
|
||||
@@ -702,10 +699,7 @@ wxRendererXP::DrawTreeItemButton(wxWindow *win,
|
||||
|
||||
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
||||
|
||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
||||
|
||||
RECT r;
|
||||
wxCopyRectToRECT(adjustedRect, r);
|
||||
RECT r = ConvertToRECT(dc, rect);
|
||||
|
||||
int state = flags & wxCONTROL_EXPANDED ? GLPS_OPENED : GLPS_CLOSED;
|
||||
::DrawThemeBackground
|
||||
@@ -744,10 +738,7 @@ wxRendererXP::DoDrawButtonLike(HTHEME htheme,
|
||||
{
|
||||
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
||||
|
||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
||||
|
||||
RECT r;
|
||||
wxCopyRectToRECT(adjustedRect, r);
|
||||
RECT r = ConvertToRECT(dc, rect);
|
||||
|
||||
// the base state is always 1, whether it is PBS_NORMAL,
|
||||
// {CBS,RBS}_UNCHECKEDNORMAL or CBS_NORMAL
|
||||
@@ -876,10 +867,7 @@ wxRendererXP::DrawCollapseButton(wxWindow *win,
|
||||
if (flags & wxCONTROL_EXPANDED)
|
||||
flags |= wxCONTROL_CHECKED;
|
||||
|
||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
||||
|
||||
RECT r;
|
||||
wxCopyRectToRECT(adjustedRect, r);
|
||||
RECT r = ConvertToRECT(dc, rect);
|
||||
|
||||
::DrawThemeBackground
|
||||
(
|
||||
@@ -930,8 +918,8 @@ wxRendererXP::DrawItemSelectionRect(wxWindow *win,
|
||||
|
||||
if ( ::IsThemePartDefined(hTheme, LVP_LISTITEM, 0) )
|
||||
{
|
||||
RECT rc;
|
||||
wxCopyRectToRECT(rect, rc);
|
||||
RECT rc = ConvertToRECT(dc, rect);
|
||||
|
||||
if ( ::IsThemeBackgroundPartiallyTransparent(hTheme, LVP_LISTITEM, itemState) )
|
||||
::DrawThemeParentBackground(GetHwndOf(win), GetHdcOf(dc.GetTempHDC()), &rc);
|
||||
|
||||
@@ -967,8 +955,7 @@ void wxRendererXP::DrawItemText(wxWindow* win,
|
||||
if ( s_DrawThemeTextEx && // Might be not available if we're under XP
|
||||
::IsThemePartDefined(hTheme, LVP_LISTITEM, 0) )
|
||||
{
|
||||
RECT rc;
|
||||
wxCopyRectToRECT(rect, rc);
|
||||
RECT rc = ConvertToRECT(dc, rect);
|
||||
|
||||
WXDTTOPTS textOpts;
|
||||
textOpts.dwSize = sizeof(textOpts);
|
||||
@@ -1092,8 +1079,7 @@ void wxRendererXP::DrawGauge(wxWindow* win,
|
||||
return;
|
||||
}
|
||||
|
||||
RECT r;
|
||||
wxCopyRectToRECT(rect, r);
|
||||
RECT r = ConvertToRECT(dc, rect);
|
||||
|
||||
::DrawThemeBackground(
|
||||
hTheme,
|
||||
|
Reference in New Issue
Block a user