]> git.saurik.com Git - wxWidgets.git/commitdiff
allow using wxBG_STYLE_CUSTOM even with the native controls and use it in wxTreeCtrl...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 25 Jan 2009 11:40:41 +0000 (11:40 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 25 Jan 2009 11:40:41 +0000 (11:40 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/treectrl.cpp
src/msw/window.cpp

index d358be2f328155f21f264b872c8c273e5c7f47da..df434131aa920f7f6f3ea141fefd76cc56672ace 100644 (file)
@@ -734,6 +734,10 @@ bool wxTreeCtrl::Create(wxWindow *parent,
     if ( !MSWCreateControl(WC_TREEVIEW, wstyle, pos, size) )
         return false;
 
+    // this significantly reduces flicker when refreshing the control, for some
+    // reason the native control itself doesn't avoid background repainting
+    SetBackgroundStyle(wxBG_STYLE_CUSTOM);
+
 #if wxUSE_COMCTL32_SAFELY
     wxWindow::SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
     wxWindow::SetForegroundColour(wxWindow::GetParent()->GetForegroundColour());
index 3707a1bad723a588ff0669d463198f6b6bfe16e9..e808841ca4c65c18321b1e8aece1aca63b4e0684 100644 (file)
@@ -4722,6 +4722,14 @@ bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
 
 void wxWindowMSW::OnEraseBackground(wxEraseEvent& event)
 {
+    if ( GetBackgroundStyle() == wxBG_STYLE_CUSTOM )
+    {
+        // don't skip the event here, custom background means that the app
+        // is drawing it itself in its OnPaint(), so don't draw it at all
+        // now to avoid flicker
+        return;
+    }
+
     // standard non top level controls (i.e. except the dialogs) always erase
     // their background themselves in HandleCtlColor() or have some control-
     // specific ways to set the colours (common controls)
@@ -4731,14 +4739,6 @@ void wxWindowMSW::OnEraseBackground(wxEraseEvent& event)
         return;
     }
 
-    if ( GetBackgroundStyle() == wxBG_STYLE_CUSTOM )
-    {
-        // don't skip the event here, custom background means that the app
-        // is drawing it itself in its OnPaint(), so don't draw it at all
-        // now to avoid flicker
-        return;
-    }
-
     wxDC *dc = event.GetDC();
     if (!dc) return;
     wxMSWDCImpl *impl = (wxMSWDCImpl*) dc->GetImpl();