From 1c14c2ce9e36412666c6bf8c5d39036c808a20dc Mon Sep 17 00:00:00 2001 From: Arrigo Marchiori Date: Mon, 5 Feb 2018 14:29:17 +0100 Subject: [PATCH] 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. --- src/msw/anybutton.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/msw/anybutton.cpp b/src/msw/anybutton.cpp index d896566b6f..2202432834 100644 --- a/src/msw/anybutton.cpp +++ b/src/msw/anybutton.cpp @@ -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