]> git.saurik.com Git - wxWidgets.git/commitdiff
A fix for flicker when the top-level window is disabled or enabled (e.g. by modal...
authorJulian Smart <julian@anthemion.co.uk>
Sun, 11 Mar 2012 05:31:06 +0000 (05:31 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 11 Mar 2012 05:31:06 +0000 (05:31 +0000)
Achieved by using IsThisEnabled to determine the visual disabled state and thus requiring no refresh on top-level window enabling/disabling.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/choice.cpp
src/msw/combo.cpp
src/msw/textctrl.cpp
src/msw/toplevel.cpp

index ee5f46167e75aceb6cbe391f544562c44c4832eb..74ec10a47b64bc9887e8ecfafe1f17ab6cdbc5de 100644 (file)
@@ -758,7 +758,7 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
 
 WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC, WXHWND hWnd)
 {
 
 WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC, WXHWND hWnd)
 {
-    if ( !IsEnabled() )
+    if ( !IsThisEnabled() )
         return MSWControlColorDisabled(hDC);
 
     return wxChoiceBase::MSWControlColor(hDC, hWnd);
         return MSWControlColorDisabled(hDC);
 
     return wxChoiceBase::MSWControlColor(hDC, hWnd);
index 12db6bf584c1a4db9f6353af51cc388621aac069..51bad16e5cf49e3545a9c46499f299eb44d9ff65 100644 (file)
@@ -294,7 +294,7 @@ wxComboCtrl::PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const
     if ( !(flags & wxCONTROL_ISSUBMENU) )
     {
         // Drawing control
     if ( !(flags & wxCONTROL_ISSUBMENU) )
     {
         // Drawing control
-        isEnabled = IsEnabled();
+        isEnabled = IsThisEnabled();
         doDrawFocusRect = ShouldDrawFocus();
 
 #if wxUSE_UXTHEME
         doDrawFocusRect = ShouldDrawFocus();
 
 #if wxUSE_UXTHEME
@@ -429,7 +429,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
     wxColour bgCol = GetBackgroundColour();
 
 #if wxUSE_UXTHEME
     wxColour bgCol = GetBackgroundColour();
 
 #if wxUSE_UXTHEME
-    const bool isEnabled = IsEnabled();
+    const bool isEnabled = IsThisEnabled();
 
     wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
     HDC hDc = GetHdcOf(*impl);
 
     wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
     HDC hDc = GetHdcOf(*impl);
index 659cf210775db924a1d959d38f9a31ff1c47672c..4f02fbaf851dcff7a0caddcf50034a0d83e3d074 100644 (file)
@@ -2055,7 +2055,7 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
 
 WXHBRUSH wxTextCtrl::MSWControlColor(WXHDC hDC, WXHWND hWnd)
 {
 
 WXHBRUSH wxTextCtrl::MSWControlColor(WXHDC hDC, WXHWND hWnd)
 {
-    if ( !IsEnabled() && !HasFlag(wxTE_MULTILINE) )
+    if ( !IsThisEnabled() && !HasFlag(wxTE_MULTILINE) )
         return MSWControlColorDisabled(hDC);
 
     return wxTextCtrlBase::MSWControlColor(hDC, hWnd);
         return MSWControlColorDisabled(hDC);
 
     return wxTextCtrlBase::MSWControlColor(hDC, hWnd);
index 1db870f1e886c4403ab4642f831854304506306e..85c221a45b1f3b7f2d36a447fda764f57dbf1bc7 100644 (file)
@@ -1344,7 +1344,21 @@ void wxTopLevelWindowMSW::DoEnable(bool enable)
     // so we have to issue explicit refresh to avoid rendering artifacts.
     //
     // TODO: find out just what exactly is wrong here
     // so we have to issue explicit refresh to avoid rendering artifacts.
     //
     // TODO: find out just what exactly is wrong here
-    Refresh();
+    //Refresh();
+
+    // JS: From observing other application behaviour, such as VS 2010, controls such
+    // as text fields and comboboxes do not indicate a disabled state when the parent
+    // is disabled due to a modal dialog being shown. Therefore I have changed these
+    // controls' behaviour to only indicate a disabled state when IsThisEnabled returns false,
+    // i.e. the application has specifically disabled each control. Since the colour
+    // no longer changes when the top-level window is disabled, this means we can avoid
+    // doing a refresh that causes a distracting flicker in some controls.
+    // Windows should probably be sending a paint event to each child control just in
+    // case the state change requires a refresh, but this would cause flicker so perhaps
+    // it's as well that it doesn't.
+    // The result of this change is to remove the flicker and also remove the distraction
+    // of individual controls greying-out due to a dialog being shown, which I think was
+    // the wrong behaviour.
 }
 
 void wxTopLevelWindowMSW::DoFreeze()
 }
 
 void wxTopLevelWindowMSW::DoFreeze()