Merge branch 'msw-themed-borders'
Fix border drawing when using some non-standard MSW themes. See https://github.com/wxWidgets/wxWidgets/pull/1105 Closes https://github.com/wxWidgets/wxWidgets/pull/1141
This commit is contained in:
@@ -3738,20 +3738,25 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
|
|||||||
hTheme,
|
hTheme,
|
||||||
GetHdcOf(*impl),
|
GetHdcOf(*impl),
|
||||||
EP_EDITTEXT,
|
EP_EDITTEXT,
|
||||||
ETS_NORMAL,
|
IsEnabled() ? ETS_NORMAL : ETS_DISABLED,
|
||||||
rect,
|
rect,
|
||||||
&rcClient) == S_OK )
|
&rcClient) != S_OK )
|
||||||
{
|
{
|
||||||
InflateRect(&rcClient, -1, -1);
|
// If GetThemeBackgroundContentRect() failed, as can
|
||||||
if (wParam)
|
// happen with at least some custom themes, just use
|
||||||
csparam->rgrc[0] = rcClient;
|
// the original client rectangle.
|
||||||
else
|
rcClient = *rect;
|
||||||
*((RECT*)lParam) = rcClient;
|
|
||||||
|
|
||||||
// WVR_REDRAW triggers a bug whereby child windows are moved up and left,
|
|
||||||
// so don't use.
|
|
||||||
// rc.result = WVR_REDRAW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InflateRect(&rcClient, -1, -1);
|
||||||
|
if (wParam)
|
||||||
|
csparam->rgrc[0] = rcClient;
|
||||||
|
else
|
||||||
|
*((RECT*)lParam) = rcClient;
|
||||||
|
|
||||||
|
// WVR_REDRAW triggers a bug whereby child windows are moved up and left,
|
||||||
|
// so don't use.
|
||||||
|
// rc.result = WVR_REDRAW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -3774,28 +3779,37 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
|
|||||||
wxCopyRectToRECT(GetSize(), rcBorder);
|
wxCopyRectToRECT(GetSize(), rcBorder);
|
||||||
|
|
||||||
RECT rcClient;
|
RECT rcClient;
|
||||||
::GetThemeBackgroundContentRect(
|
|
||||||
hTheme, GetHdcOf(*impl), EP_EDITTEXT, ETS_NORMAL, &rcBorder, &rcClient);
|
const int nState = IsEnabled() ? ETS_NORMAL : ETS_DISABLED;
|
||||||
|
|
||||||
|
if ( ::GetThemeBackgroundContentRect
|
||||||
|
(
|
||||||
|
hTheme,
|
||||||
|
GetHdcOf(*impl),
|
||||||
|
EP_EDITTEXT,
|
||||||
|
nState,
|
||||||
|
&rcBorder,
|
||||||
|
&rcClient
|
||||||
|
) != S_OK )
|
||||||
|
{
|
||||||
|
// As above in WM_NCCALCSIZE, fall back on something
|
||||||
|
// reasonable for themes which don't implement this
|
||||||
|
// function.
|
||||||
|
rcClient = rcBorder;
|
||||||
|
}
|
||||||
|
|
||||||
InflateRect(&rcClient, -1, -1);
|
InflateRect(&rcClient, -1, -1);
|
||||||
|
|
||||||
::ExcludeClipRect(GetHdcOf(*impl), rcClient.left, rcClient.top,
|
::ExcludeClipRect(GetHdcOf(*impl), rcClient.left, rcClient.top,
|
||||||
rcClient.right, rcClient.bottom);
|
rcClient.right, rcClient.bottom);
|
||||||
|
|
||||||
// Make sure the background is in a proper state
|
// Make sure the background is in a proper state
|
||||||
if (::IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
|
if (::IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, nState))
|
||||||
{
|
{
|
||||||
::DrawThemeParentBackground(GetHwnd(), GetHdcOf(*impl), &rcBorder);
|
::DrawThemeParentBackground(GetHwnd(), GetHdcOf(*impl), &rcBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the border
|
// Draw the border
|
||||||
int nState;
|
|
||||||
if ( !IsEnabled() )
|
|
||||||
nState = ETS_DISABLED;
|
|
||||||
// should we check this?
|
|
||||||
//else if ( ::GetWindowLong(GetHwnd(), GWL_STYLE) & ES_READONLY)
|
|
||||||
// nState = ETS_READONLY;
|
|
||||||
else
|
|
||||||
nState = ETS_NORMAL;
|
|
||||||
::DrawThemeBackground(hTheme, GetHdcOf(*impl), EP_EDITTEXT, nState, &rcBorder, NULL);
|
::DrawThemeBackground(hTheme, GetHdcOf(*impl), EP_EDITTEXT, nState, &rcBorder, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user