]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
handle actions of the columns popup menu in wxHeaderCtrl itself (but the derived...
[wxWidgets.git] / src / generic / grid.cpp
index 7257f41aa048f09c740e071e8c8c48d0b12b48f2..316bd1d2c3ee3d79bb9656b7b3f133668de4de61 100644 (file)
@@ -224,7 +224,8 @@ public:
                        wxID_ANY,
                        wxDefaultPosition,
                        wxDefaultSize,
-                       owner->CanDragColMove() ? wxHD_DRAGDROP : 0)
+                       wxHD_ALLOW_HIDE |
+                       (owner->CanDragColMove() ? wxHD_ALLOW_REORDER : 0))
     {
     }
 
@@ -267,6 +268,16 @@ private:
         return true;
     }
 
+    // overridden to react to the actions using the columns popup menu
+    virtual void UpdateColumnVisibility(unsigned int idx, bool show)
+    {
+        GetOwner()->SetColSize(idx, show ? wxGRID_AUTOSIZE : 0);
+
+        // as this is done by the user we should notify the main program about
+        // it
+        GetOwner()->SendEvent(wxEVT_GRID_COL_SIZE, -1, idx);
+    }
+
 
     // event handlers forwarding wxHeaderCtrl events to wxGrid
     void OnClick(wxHeaderCtrlEvent& event)