From 309bd665c44bc33b8da7749e81e7b7b3ec18117a Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Wed, 26 Dec 2007 21:37:03 +0000 Subject: [PATCH] Some reorder code for MSW's dataviewctrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50921 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index ae4feb9d10..86f1fe9550 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -1201,7 +1201,10 @@ void wxDataViewColumn::SetSortable( bool sortable ) void wxDataViewColumn::SetReorderable( bool reorderable ) { - // TODO + if (reorderable) + m_flags |= wxDATAVIEW_COL_REORDERABLE; + else + m_flags &= ~wxDATAVIEW_COL_REORDERABLE; } void wxDataViewColumn::SetSortOrder( bool ascending ) @@ -1440,8 +1443,19 @@ bool wxDataViewHeaderWindowMSW::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARA case HDN_BEGINDRAG: // user has started to reorder a column + if (!GetColumn(nmHDR->iItem)->IsReorderable()) + { + // veto it! + *result = TRUE; + } break; + case HDN_ENDDRAG: // user has finished reordering a column + { + // TODO: How to query the new position here? + } + break; + case HDN_ITEMCHANGING: if (nmHDR->pitem != NULL && (nmHDR->pitem->mask & HDI_WIDTH) != 0) @@ -1458,7 +1472,6 @@ bool wxDataViewHeaderWindowMSW::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARA case HDN_ITEMCHANGED: // user is resizing a column case HDN_ENDTRACK: // user has finished resizing a column - case HDN_ENDDRAG: // user has finished reordering a column // update the width of the modified column: if (nmHDR->pitem != NULL &&