]> git.saurik.com Git - wxWidgets.git/commitdiff
Never refresh controls from EVT_PAINT handler in wxPropertyGrid.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 5 Feb 2012 01:20:00 +0000 (01:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 5 Feb 2012 01:20:00 +0000 (01:20 +0000)
Refreshing the controls after finishing repainting the grid results in an
infinite stream of paint events, so don't do this, especially as this doesn't
seem to have any bad consequences under wxGTK which was the only major
platform where this behaviour was enabled.

Also rename wxPG_REFRESH_CONTROLS_AFTER_REPAINT to just wxPG_REFRESH_CONTROLS
and keep the control refreshing code for wxGTK only in a couple of places
outside of EVT_PAINT handler to be on the safe side.

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

include/wx/propgrid/propgriddefs.h
src/propgrid/propgrid.cpp

index 0049da3d800238e3c232f557031dae3a9d88985f..f462f29e155836c2f721877f21ac56731777157f 100644 (file)
@@ -56,8 +56,8 @@
     #define wxPG_NAT_BUTTON_BORDER_X            1
     #define wxPG_NAT_BUTTON_BORDER_Y            1
 
-    // If 1 then controls are refreshed after selected was drawn.
-    #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
+    // If 1 then controls are refreshed explicitly in a few places
+    #define wxPG_REFRESH_CONTROLS 0
 
 #elif defined(__WXGTK__)
 
@@ -90,7 +90,7 @@
     #define wxPG_NAT_BUTTON_BORDER_Y        1
 
     // If 1 then controls are refreshed after selected was drawn.
-    #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
+    #define wxPG_REFRESH_CONTROLS 1
 
 #elif defined(__WXMAC__)
 
     #define wxPG_NAT_BUTTON_BORDER_Y        0
 
     // If 1 then controls are refreshed after selected was drawn.
-    #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
+    #define wxPG_REFRESH_CONTROLS 0
 
 #else // defaults
 
     #define wxPG_NAT_BUTTON_BORDER_Y        0
 
     // If 1 then controls are refreshed after selected was drawn.
-    #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
+    #define wxPG_REFRESH_CONTROLS 0
 #endif // platform
 
 
index 4904e109364313d2df134f7242f468eeb5ddaddf..67959fbb7a36ab342194ac4eea9ce9c65dda702d 100644 (file)
@@ -668,9 +668,7 @@ void wxPropertyGrid::Thaw()
     {
         wxControl::Thaw();
         RecalculateVirtualSize();
-    #if wxPG_REFRESH_CONTROLS_AFTER_REPAINT
         Refresh();
-    #endif
 
         // Force property re-selection
         // NB: We must copy the selection.
@@ -2139,10 +2137,6 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
     const wxPropertyGridPageState* state = m_pState;
     const wxArrayInt& colWidths = state->m_colWidths;
 
-#if wxPG_REFRESH_CONTROLS_AFTER_REPAINT
-    bool wasSelectedPainted = false;
-#endif
-
     // TODO: Only render columns that are within clipping region.
 
     dc.SetFont(normalFont);
@@ -2270,11 +2264,6 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
         }
         else
         {
-#if wxPG_REFRESH_CONTROLS_AFTER_REPAINT
-            if ( p == firstSelected )
-                wasSelectedPainted = true;
-#endif
-
             renderFlags |= wxPGCellRenderer::Selected;
 
             if ( !p->IsCategory() )
@@ -2511,18 +2500,6 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
         y += rowHeight;
     }
 
-    // Refresh editor controls (seems not needed on msw)
-    // NOTE: This code is mandatory for GTK!
-#if wxPG_REFRESH_CONTROLS_AFTER_REPAINT
-    if ( wasSelectedPainted )
-    {
-        if ( m_wndEditor )
-            m_wndEditor->Refresh();
-        if ( m_wndEditor2 )
-            m_wndEditor2->Refresh();
-    }
-#endif
-
     return y;
 }
 
@@ -2662,7 +2639,7 @@ void wxPropertyGrid::Refresh( bool WXUNUSED(eraseBackground),
 
     wxWindow::Refresh(false, rect);
 
-#if wxPG_REFRESH_CONTROLS_AFTER_REPAINT
+#if wxPG_REFRESH_CONTROLS
     // I think this really helps only GTK+1.2
     if ( m_wndEditor ) m_wndEditor->Refresh();
     if ( m_wndEditor2 ) m_wndEditor2->Refresh();
@@ -3429,7 +3406,7 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
     }
     else
     {
-#if wxPG_REFRESH_CONTROLS_AFTER_REPAINT
+#if wxPG_REFRESH_CONTROLS
         if ( m_wndEditor ) m_wndEditor->Refresh();
         if ( m_wndEditor2 ) m_wndEditor2->Refresh();
 #endif
@@ -4876,7 +4853,7 @@ bool wxPropertyGrid::HandleMouseClick( int x, unsigned int y, wxMouseEvent &even
                             m_draggedSplitter = splitterHit;
                             m_dragOffset = splitterHitOffset;
 
-                        #if wxPG_REFRESH_CONTROLS_AFTER_REPAINT
+                        #if wxPG_REFRESH_CONTROLS
                             // Fixes button disappearance bug
                             if ( m_wndEditor2 )
                                 m_wndEditor2->Show ( false );
@@ -5241,7 +5218,7 @@ bool wxPropertyGrid::HandleMouseUp( int x, unsigned int WXUNUSED(y),
             m_wndEditor->Show ( true );
         }
 
-    #if wxPG_REFRESH_CONTROLS_AFTER_REPAINT
+    #if wxPG_REFRESH_CONTROLS
         // Fixes button disappearance bug
         if ( m_wndEditor2 )
             m_wndEditor2->Show ( true );