int m_scrollOffsetX;
int m_buttonHeight;
+ bool m_vetoColumnDrag;
bool m_delayedUpdate;
wxImageList *m_imageList;
m_scrollOffsetX = 0;
m_delayedUpdate = false;
+ m_vetoColumnDrag = false;
m_buttonHeight = wxRendererNative::Get().GetHeaderButtonHeight( this );
int x = pos.x == wxDefaultCoord ? 0 : pos.x,
NMHEADER *nmHDR = (NMHEADER *)nmhdr;
switch ( nmhdr->code )
{
+ case NM_RELEASEDCAPTURE:
+ {
+ // user has released the mouse
+ m_vetoColumnDrag = false;
+ }
+ break;
+
case HDN_BEGINTRACK:
// user has started to resize a column:
// do we need to veto it?
break;
case HDN_BEGINDRAG:
- // user has started to reorder a column
- if ((nmHDR->iItem != -1) && (!GetColumn(nmHDR->iItem)->IsReorderable()))
+ // valid column
+ if (nmHDR->iItem != -1)
+ {
+ // user has started to reorder a valid column
+ if ((m_vetoColumnDrag == true) || (!GetColumn(nmHDR->iItem)->IsReorderable()))
+ {
+ // veto it!
+ *result = TRUE;
+ m_vetoColumnDrag = true;
+ }
+ }
+ else
{
// veto it!
- *result = TRUE;
+ m_vetoColumnDrag = true;
}
break;
void wxDataViewCtrl::ColumnMoved( wxDataViewColumn* col, unsigned int new_pos )
{
if (new_pos > m_cols.GetCount()) return;
+
+ // Exchange position
+ m_cols.DeleteContents(false);
m_cols.DeleteObject( col );
m_cols.Insert( new_pos, col );
+ m_cols.DeleteContents(true);
m_clientArea->UpdateDisplay();
}