]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxHeaderCtrl::OnColumnCountChanging()
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 11 Dec 2008 17:15:43 +0000 (17:15 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 11 Dec 2008 17:15:43 +0000 (17:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57255 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/headerctrl.h
interface/wx/headerctrl.h
src/common/headerctrlcmn.cpp

index d3223c713143958502f71d42e4f1b495c7360d14..b242b9c920a9ed3b0c574d8a31969c3d75237e9d 100644 (file)
@@ -70,7 +70,7 @@ public:
     // set the number of columns in the control
     //
     // this also calls UpdateColumn() for all columns
-    void SetColumnCount(unsigned int count) { DoSetCount(count); }
+    void SetColumnCount(unsigned int count);
 
     // return the number of columns in the control as set by SetColumnCount()
     unsigned int GetColumnCount() const { return DoGetCount(); }
@@ -124,6 +124,11 @@ protected:
         return false;
     }
 
+    // this method can be overridden in the derived classes to do something
+    // (e.g. update/resize some internal data structures) before the number of
+    // columns in the control changes
+    virtual void OnColumnCountChanging(unsigned int WXUNUSED(count)) { }
+
 private:
     // methods implementing our public API and defined in platform-specific
     // implementations
index ce8dd8b2ca2283d81bac047a28eef657d87acf69..1feaa0d01fb02bca769faddb32a41db61ec1041d 100644 (file)
@@ -337,6 +337,18 @@ protected:
             meaning that the control didn't reach to the separator double click.
      */
     virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle);
+
+    /**
+        Can be overridden in the derived class to update internal data
+        structures when the number of the columns in the control changes.
+
+        This method is called by SetColumnCount() before effectively changing
+        the number of columns.
+
+        The base class version does nothing but it is good practice to still
+        call it from the overridden version in the derived class.
+     */
+    virtual void OnColumnCountChanging(unsigned int count);
 };
 
 
index 2cc69b4566a2ba7f6e1f14a43ab00994d0b990e6..75239d815123c4352dcb7f551fd8a2e335775892 100644 (file)
@@ -64,6 +64,13 @@ void wxHeaderCtrlBase::ScrollWindow(int dx,
     DoScrollHorz(dx);
 }
 
+void wxHeaderCtrlBase::SetColumnCount(unsigned int count)
+{
+    OnColumnCountChanging(count);
+
+    DoSetCount(count);
+}
+
 // ----------------------------------------------------------------------------
 // wxHeaderCtrlBase event handling
 // ----------------------------------------------------------------------------