]> git.saurik.com Git - wxWidgets.git/commitdiff
Made toolbars sticky, i.e. you need to drag them
authorRobert Roebling <robert@roebling.de>
Sun, 27 Aug 2006 15:19:39 +0000 (15:19 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 27 Aug 2006 15:19:39 +0000 (15:19 +0000)
    several (and not just one) pixels away from the
    docking area to make them undock/float. This
    removes some more toolbar jumping.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40873 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/aui/framemanager.h
src/aui/framemanager.cpp

index 65a3dc7d7ec7e0bf779cd92932ff9ad802bfad01..b19cd3e26caf7b5428dde1626b36b1ece2cf8e7d 100644 (file)
@@ -555,6 +555,8 @@ protected:
     wxDockUIPart* m_action_part; // ptr to the part the action happened to
     wxWindow* m_action_window;   // action frame or window (NULL if none)
     wxRect m_action_hintrect;    // hint rectangle for the action
+    bool m_skipping;
+    wxRect m_last_rect;
     wxDockUIPart* m_hover_button;// button uipart being hovered over
     wxRect m_last_hint;          // last hint rectangle
     wxPoint m_last_mouse_move;   // last mouse move position (see OnMotion)
index 8fad2a47cb01ca7ba7e3426b6883a7909e52e131..d5d67516755f8ef3f66f3698af90acad831bbf3e 100644 (file)
@@ -480,6 +480,7 @@ wxFrameManager::wxFrameManager(wxWindow* managed_wnd, unsigned int flags)
     m_art = new wxDefaultDockArt;
     m_hint_wnd = NULL;
     m_flags = flags;
+    m_skipping = false;
 
     if (managed_wnd)
     {
@@ -2349,8 +2350,7 @@ bool wxFrameManager::DoDrop(wxDockInfoArray& docks,
     {
         if (!part || !part->dock)
             return false;
-
-
+            
         // calculate the offset from where the dock begins
         // to the point where the user dropped the pane
         int dock_drop_offset = 0;
@@ -2365,16 +2365,40 @@ bool wxFrameManager::DoDrop(wxDockInfoArray& docks,
         // should float if being dragged over center pane windows
         if (!part->dock->fixed || part->dock->dock_direction == wxAUI_DOCK_CENTER)
         {
-            if ((m_flags & wxAUI_MGR_ALLOW_FLOATING) &&
+            if (m_last_rect.IsEmpty() || m_last_rect.Inside(pt.x, pt.y ))
+            {
+                m_skipping = true;
+            }
+            else
+            {
+                if ((m_flags & wxAUI_MGR_ALLOW_FLOATING) &&
                    (drop.IsFloatable() ||
                     (part->dock->dock_direction != wxAUI_DOCK_CENTER &&
                      part->dock->dock_direction != wxAUI_DOCK_NONE)))
-            {
-                drop.Float();
+                {
+                    drop.Float();
+                }
+                
+                m_skipping = false;
+                
+                return ProcessDockResult(target, drop);
             }
+            
+            drop.Position(pt.x - GetDockPixelOffset(drop) - offset.x);
 
             return ProcessDockResult(target, drop);
         }
+        else
+        {
+            m_skipping = false;
+        }
+        
+        if (!m_skipping)
+        {
+            m_last_rect = part->dock->rect;
+            m_last_rect.Offset( -10, -10 );
+            m_last_rect.Inflate( 20, 20 );
+        }
 
         drop.Dock().
              Direction(part->dock->dock_direction).