X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3039ade95dbad1ee5a5ed03c25e3ed9241907850..824eec7e595ba4d1022900f24173f335ba723f8c:/src/generic/grid.cpp diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 7257f41aa0..1b1ed6c604 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -224,12 +224,13 @@ public: wxID_ANY, wxDefaultPosition, wxDefaultSize, - owner->CanDragColMove() ? wxHD_DRAGDROP : 0) + wxHD_ALLOW_HIDE | + (owner->CanDragColMove() ? wxHD_ALLOW_REORDER : 0)) { } protected: - virtual wxHeaderColumn& GetColumn(unsigned int idx) + virtual const wxHeaderColumn& GetColumn(unsigned int idx) const { return m_columns[idx]; } @@ -267,6 +268,23 @@ 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); + } + + // overridden to react to the columns order changes in the customization + // dialog + virtual void UpdateColumnsOrder(const wxArrayInt& order) + { + GetOwner()->SetColumnsOrder(order); + } + // event handlers forwarding wxHeaderCtrl events to wxGrid void OnClick(wxHeaderCtrlEvent& event) @@ -6874,6 +6892,13 @@ void wxGrid::RefreshAfterColPosChange() m_gridWin->Refresh(); } +void wxGrid::SetColumnsOrder(const wxArrayInt& order) +{ + m_colAt = order; + + RefreshAfterColPosChange(); +} + void wxGrid::SetColPos(int idx, int pos) { // we're going to need m_colAt now, initialize it if needed