Fix disabled owner-drawn buttons look with classic MSW theme

Don't grey out the buttons text when they're implicitly disabled because
the parent TLW is disabled by MSW while showing a modal dialog, this
looked bad. Only grey the buttons text when they're really disabled at
wx level.

Closes #18011.
This commit is contained in:
Arrigo Marchiori
2018-02-05 14:29:17 +01:00
committed by Vadim Zeitlin
parent eee4f5969f
commit 1c14c2ce9e

View File

@@ -842,7 +842,13 @@ void DrawButtonText(HDC hdc,
// To get a native look for owner-drawn button in disabled state (without
// theming) we must use DrawState() to draw the text label.
if ( !wxUxThemeIsActive() && !btn->IsEnabled() )
//
// Notice that we use the enabled state at MSW, not wx, level because we
// don't want to grey it out when it's disabled just because its parent is
// disabled by MSW as it happens when showing a modal dialog, but we do
// want to grey it out if either it or its parent are explicitly disabled
// at wx level, see #18011.
if ( !wxUxThemeIsActive() && !::IsWindowEnabled(GetHwndOf(btn)) )
{
// However using DrawState() has some drawbacks:
// 1. It generally doesn't support alignment flags (except right