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,
|
wxDC& dc,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0) wxOVERRIDE = 0;
|
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,
|
const wxRect& rect,
|
||||||
int WXUNUSED(flags))
|
int WXUNUSED(flags))
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc = ConvertToRECT(dc, rect);
|
||||||
wxCopyRectToRECT(rect, rc);
|
|
||||||
|
|
||||||
::DrawFocusRect(GetHdcOf(dc.GetTempHDC()), &rc);
|
::DrawFocusRect(GetHdcOf(dc.GetTempHDC()), &rc);
|
||||||
}
|
}
|
||||||
@@ -411,10 +420,7 @@ wxRendererMSW::DrawComboBoxDropButton(wxWindow * WXUNUSED(win),
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
||||||
|
|
||||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
RECT r = ConvertToRECT(dc, rect);
|
||||||
|
|
||||||
RECT r;
|
|
||||||
wxCopyRectToRECT(adjustedRect, r);
|
|
||||||
|
|
||||||
int style = DFCS_SCROLLCOMBOBOX;
|
int style = DFCS_SCROLLCOMBOBOX;
|
||||||
if ( flags & wxCONTROL_DISABLED )
|
if ( flags & wxCONTROL_DISABLED )
|
||||||
@@ -435,10 +441,7 @@ wxRendererMSW::DoDrawFrameControl(UINT type,
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
||||||
|
|
||||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
RECT r = ConvertToRECT(dc, rect);
|
||||||
|
|
||||||
RECT r;
|
|
||||||
wxCopyRectToRECT(adjustedRect, r);
|
|
||||||
|
|
||||||
int style = kind;
|
int style = kind;
|
||||||
if ( flags & wxCONTROL_CHECKED )
|
if ( flags & wxCONTROL_CHECKED )
|
||||||
@@ -613,10 +616,7 @@ wxRendererXP::DrawComboBoxDropButton(wxWindow * win,
|
|||||||
|
|
||||||
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
||||||
|
|
||||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
RECT r = ConvertToRECT(dc, rect);
|
||||||
|
|
||||||
RECT r;
|
|
||||||
wxCopyRectToRECT(adjustedRect, r);
|
|
||||||
|
|
||||||
int state;
|
int state;
|
||||||
if ( flags & wxCONTROL_PRESSED )
|
if ( flags & wxCONTROL_PRESSED )
|
||||||
@@ -656,10 +656,7 @@ wxRendererXP::DrawHeaderButton(wxWindow *win,
|
|||||||
|
|
||||||
wxCHECK_MSG( dc.GetImpl(), -1, wxT("Invalid wxDC") );
|
wxCHECK_MSG( dc.GetImpl(), -1, wxT("Invalid wxDC") );
|
||||||
|
|
||||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
RECT r = ConvertToRECT(dc, rect);
|
||||||
|
|
||||||
RECT r;
|
|
||||||
wxCopyRectToRECT(adjustedRect, r);
|
|
||||||
|
|
||||||
int state;
|
int state;
|
||||||
if ( flags & wxCONTROL_PRESSED )
|
if ( flags & wxCONTROL_PRESSED )
|
||||||
@@ -702,10 +699,7 @@ wxRendererXP::DrawTreeItemButton(wxWindow *win,
|
|||||||
|
|
||||||
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
||||||
|
|
||||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
RECT r = ConvertToRECT(dc, rect);
|
||||||
|
|
||||||
RECT r;
|
|
||||||
wxCopyRectToRECT(adjustedRect, r);
|
|
||||||
|
|
||||||
int state = flags & wxCONTROL_EXPANDED ? GLPS_OPENED : GLPS_CLOSED;
|
int state = flags & wxCONTROL_EXPANDED ? GLPS_OPENED : GLPS_CLOSED;
|
||||||
::DrawThemeBackground
|
::DrawThemeBackground
|
||||||
@@ -744,10 +738,7 @@ wxRendererXP::DoDrawButtonLike(HTHEME htheme,
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
wxCHECK_RET( dc.GetImpl(), wxT("Invalid wxDC") );
|
||||||
|
|
||||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
RECT r = ConvertToRECT(dc, rect);
|
||||||
|
|
||||||
RECT r;
|
|
||||||
wxCopyRectToRECT(adjustedRect, r);
|
|
||||||
|
|
||||||
// the base state is always 1, whether it is PBS_NORMAL,
|
// the base state is always 1, whether it is PBS_NORMAL,
|
||||||
// {CBS,RBS}_UNCHECKEDNORMAL or CBS_NORMAL
|
// {CBS,RBS}_UNCHECKEDNORMAL or CBS_NORMAL
|
||||||
@@ -876,10 +867,7 @@ wxRendererXP::DrawCollapseButton(wxWindow *win,
|
|||||||
if (flags & wxCONTROL_EXPANDED)
|
if (flags & wxCONTROL_EXPANDED)
|
||||||
flags |= wxCONTROL_CHECKED;
|
flags |= wxCONTROL_CHECKED;
|
||||||
|
|
||||||
wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
|
RECT r = ConvertToRECT(dc, rect);
|
||||||
|
|
||||||
RECT r;
|
|
||||||
wxCopyRectToRECT(adjustedRect, r);
|
|
||||||
|
|
||||||
::DrawThemeBackground
|
::DrawThemeBackground
|
||||||
(
|
(
|
||||||
@@ -930,8 +918,8 @@ wxRendererXP::DrawItemSelectionRect(wxWindow *win,
|
|||||||
|
|
||||||
if ( ::IsThemePartDefined(hTheme, LVP_LISTITEM, 0) )
|
if ( ::IsThemePartDefined(hTheme, LVP_LISTITEM, 0) )
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc = ConvertToRECT(dc, rect);
|
||||||
wxCopyRectToRECT(rect, rc);
|
|
||||||
if ( ::IsThemeBackgroundPartiallyTransparent(hTheme, LVP_LISTITEM, itemState) )
|
if ( ::IsThemeBackgroundPartiallyTransparent(hTheme, LVP_LISTITEM, itemState) )
|
||||||
::DrawThemeParentBackground(GetHwndOf(win), GetHdcOf(dc.GetTempHDC()), &rc);
|
::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
|
if ( s_DrawThemeTextEx && // Might be not available if we're under XP
|
||||||
::IsThemePartDefined(hTheme, LVP_LISTITEM, 0) )
|
::IsThemePartDefined(hTheme, LVP_LISTITEM, 0) )
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc = ConvertToRECT(dc, rect);
|
||||||
wxCopyRectToRECT(rect, rc);
|
|
||||||
|
|
||||||
WXDTTOPTS textOpts;
|
WXDTTOPTS textOpts;
|
||||||
textOpts.dwSize = sizeof(textOpts);
|
textOpts.dwSize = sizeof(textOpts);
|
||||||
@@ -1092,8 +1079,7 @@ void wxRendererXP::DrawGauge(wxWindow* win,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RECT r;
|
RECT r = ConvertToRECT(dc, rect);
|
||||||
wxCopyRectToRECT(rect, r);
|
|
||||||
|
|
||||||
::DrawThemeBackground(
|
::DrawThemeBackground(
|
||||||
hTheme,
|
hTheme,
|
||||||
|
Reference in New Issue
Block a user