]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/datavgen.cpp
VC6 compilation fix: using access declaration can only be used with immediate base...
[wxWidgets.git] / src / generic / datavgen.cpp
index 4cd77421b2e3b911689b95ace6eb683f90ea513d..9e1f5f7d43f4f517feff852d2443263c3d0a5eb6 100644 (file)
@@ -168,6 +168,7 @@ protected:
 
     int          m_scrollOffsetX;
     int          m_buttonHeight;
+    bool         m_vetoColumnDrag;
     bool         m_delayedUpdate;
     wxImageList *m_imageList;
 
@@ -1327,6 +1328,7 @@ bool wxDataViewHeaderWindowMSW::Create( wxDataViewCtrl *parent, wxWindowID id,
 
     m_scrollOffsetX = 0;
     m_delayedUpdate = false;
+    m_vetoColumnDrag = false;
     m_buttonHeight = wxRendererNative::Get().GetHeaderButtonHeight( this );
 
     int x = pos.x == wxDefaultCoord ? 0 : pos.x,
@@ -1506,6 +1508,13 @@ bool wxDataViewHeaderWindowMSW::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARA
     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?
@@ -1517,11 +1526,21 @@ bool wxDataViewHeaderWindowMSW::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARA
             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;