From 20db5469a0fb70d2540110acf44f144606d90f4f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 10 Dec 2008 16:09:58 +0000 Subject: [PATCH] provide Do[GS]etColumnsOrder() stubs for the generic wxHeaderCtrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57234 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/headerctrlg.h | 7 +++++++ src/generic/headerctrlg.cpp | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/wx/generic/headerctrlg.h b/include/wx/generic/headerctrlg.h index 127f798c40..dd943a8deb 100644 --- a/include/wx/generic/headerctrlg.h +++ b/include/wx/generic/headerctrlg.h @@ -56,6 +56,9 @@ private: virtual void DoScrollHorz(int dx); + virtual void DoSetColumnsOrder(const wxArrayInt& order); + virtual wxArrayInt DoGetColumnsOrder() const; + // override wxWindow methods which must be implemented by a new control virtual wxSize DoGetBestSize() const; @@ -129,6 +132,10 @@ private: // the overlay display used during the dragging operations wxOverlay m_overlay; + // the indices of the column appearing at the given position on the display + // (its size is always m_numColumns) + wxArrayInt m_colIndices; + DECLARE_EVENT_TABLE() DECLARE_NO_COPY_CLASS(wxHeaderCtrl) diff --git a/src/generic/headerctrlg.cpp b/src/generic/headerctrlg.cpp index 9c4aaeb89a..6b9c1a399b 100644 --- a/src/generic/headerctrlg.cpp +++ b/src/generic/headerctrlg.cpp @@ -91,6 +91,7 @@ wxHeaderCtrl::~wxHeaderCtrl() void wxHeaderCtrl::DoSetCount(unsigned int count) { m_numColumns = count; + m_colIndices.resize(count); Refresh(); } @@ -320,6 +321,21 @@ void wxHeaderCtrl::EndResizing(int xPhysical) m_colBeingResized = COL_NONE; } +// ---------------------------------------------------------------------------- +// wxHeaderCtrl column reordering +// ---------------------------------------------------------------------------- + +void wxHeaderCtrl::DoSetColumnsOrder(const wxArrayInt& order) +{ + m_colIndices = order; + Refresh(); +} + +wxArrayInt wxHeaderCtrl::DoGetColumnsOrder() const +{ + return m_colIndices; +} + // ---------------------------------------------------------------------------- // wxHeaderCtrl event handlers // ---------------------------------------------------------------------------- -- 2.45.2