]> git.saurik.com Git - wxWidgets.git/commitdiff
Refresh() didn't work as it wasn't passed to subwindows
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 8 Jul 2003 11:19:10 +0000 (11:19 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 8 Jul 2003 11:19:10 +0000 (11:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/generic/listctrl.h
src/generic/listctrl.cpp

index c23f143cd728bbb736d17c4a505fb9422b759a00..f094d7013bfafcffdde56e0095fe56f9fb057ce6 100644 (file)
@@ -124,6 +124,7 @@ wxGTK:
 - added wxTextCtrl::SetSelection implementation for GTK+ 2
 - fixed wxTextCtrl::IsEditable() for GTK+ 2
 - don't consume 100% CPU when showing a poup menu
+- implemented wxListCtrl::Refresh() (Norbert Berzen)
 
 wxMac:
 
index 31c38e9638587306db5f5d28044d710f76dac2c3..6a7dc88036e14f2d8db5f22b7493c5f8b5980eea 100644 (file)
@@ -148,8 +148,8 @@ public:
     long InsertItem( long index, int imageIndex );
     long InsertItem( long index, const wxString& label, int imageIndex );
     long InsertColumn( long col, wxListItem& info );
-    long InsertColumn( long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT,
-      int width = -1 );
+    long InsertColumn( long col, const wxString& heading,
+                       int format = wxLIST_FORMAT_LEFT, int width = -1 );
     bool ScrollList( int dx, int dy );
     bool SortItems( wxListCtrlCompare fn, long data );
     bool Update( long item );
@@ -168,6 +168,8 @@ public:
     void OnSize( wxSizeEvent &event );
 
     // We have to hand down a few functions
+    virtual void Refresh(bool eraseBackground = TRUE,
+                         const wxRect *rect = NULL);
 
     virtual void Freeze();
     virtual void Thaw();
index 0a9299f9df0053ff6010aff82d76180a4866325c..c80ade054d17a0f82bfad14db991648651d94fba 100644 (file)
@@ -5168,6 +5168,57 @@ void wxGenericListCtrl::RefreshItems(long itemFrom, long itemTo)
     m_mainWin->RefreshLines(itemFrom, itemTo);
 }
 
+/*
+ * Generic wxListCtrl is more or less a container for two other
+ * windows which drawings are done upon. These are namely
+ * 'm_headerWin' and 'm_mainWin'.
+ * Here we override 'virtual wxWindow::Refresh()' to mimic the
+ * behaviour wxListCtrl has under wxMSW.
+ */
+void wxGenericListCtrl::Refresh(bool eraseBackground, const wxRect *rect)
+{
+    if (!rect)
+    {
+        // The easy case, no rectangle specified.
+        if (m_headerWin)
+            m_headerWin->Refresh(eraseBackground);
+
+        if (m_mainWin)
+            m_mainWin->Refresh(eraseBackground);
+    }
+    else
+    {
+        // Refresh the header window
+        if (m_headerWin)
+        {
+            wxRect rectHeader = m_headerWin->GetRect();
+            rectHeader.Intersect(*rect);
+            if (rectHeader.GetWidth() && rectHeader.GetHeight())
+            {
+                int x, y;
+                m_headerWin->GetPosition(&x, &y);
+                rectHeader.Offset(-x, -y);
+                m_headerWin->Refresh(eraseBackground, &rectHeader);
+            }
+
+        }
+
+        // Refresh the main window
+        if (m_mainWin)
+        {
+            wxRect rectMain = m_mainWin->GetRect();
+            rectMain.Intersect(*rect);
+            if (rectMain.GetWidth() && rectMain.GetHeight())
+            {
+                int x, y;
+                m_mainWin->GetPosition(&x, &y);
+                rectMain.Offset(-x, -y);
+                m_mainWin->Refresh(eraseBackground, &rectMain);
+            }
+        }
+    }
+}
+
 void wxGenericListCtrl::Freeze()
 {
     m_mainWin->Freeze();