From: Vadim Zeitlin Date: Tue, 16 Dec 2008 15:53:38 +0000 (+0000) Subject: added wxGrid::SetColumnsOrder() too X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/31ec8b4e151a0dc6f4423bb1bf1420d2af1137fa?ds=inline added wxGrid::SetColumnsOrder() too git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57371 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 6873ca0de5..07d55f9d68 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -1532,6 +1532,10 @@ public: // only the display and hit testing code really cares about display // positions at all + // set the positions of all columns at once (this method uses the same + // conventions as wxHeaderCtrl::SetColumnsOrder() for the order array) + void SetColumnsOrder(const wxArrayInt& order); + // return the column index corresponding to the given (valid) position int GetColAt(int pos) const { diff --git a/interface/wx/grid.h b/interface/wx/grid.h index 0601bf6031..0f4e06e2a7 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -2305,6 +2305,15 @@ public: */ void SetColPos(int colID, int newPos); + /** + Sets the positions of all columns at once. + + This method takes an array containing the indices of the columns in + their display order, i.e. uses the same convention as + wxHeaderCtrl::SetColumnsOrder(). + */ + void SetColumnsOrder(const wxArrayInt& order); + /** Resets the position of the columns to the default. */ diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 316bd1d2c3..1fd5af31a5 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -278,7 +278,6 @@ private: GetOwner()->SendEvent(wxEVT_GRID_COL_SIZE, -1, idx); } - // event handlers forwarding wxHeaderCtrl events to wxGrid void OnClick(wxHeaderCtrlEvent& event) { @@ -6885,6 +6884,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