]> git.saurik.com Git - wxWidgets.git/blobdiff - src/aui/framemanager.cpp
disable VC6 warning C4284; put all warning disable pragmas together
[wxWidgets.git] / src / aui / framemanager.cpp
index b06a6a519e2c27502043a908bf3da208e8bb8e83..c2861cf84c561b6641e7b8630264fab7bb724fd1 100644 (file)
@@ -29,6 +29,7 @@
 #include "wx/aui/dockart.h"
 #include "wx/aui/floatpane.h"
 #include "wx/aui/tabmdi.h"
+#include "wx/aui/auibar.h"
 
 #ifndef WX_PRECOMP
     #include "wx/panel.h"
@@ -256,6 +257,9 @@ public:
         m_title = title;
 
         m_widget = gtk_window_new( GTK_WINDOW_POPUP );
+        g_object_ref(m_widget);
+
+        if (parent) parent->AddChild(this);
 
         g_signal_connect( m_widget, "realize",
                       G_CALLBACK (gtk_pseudo_window_realized_callback), this );
@@ -568,6 +572,7 @@ BEGIN_EVENT_TABLE(wxAuiManager, wxEvtHandler)
     EVT_LEFT_UP(wxAuiManager::OnLeftUp)
     EVT_MOTION(wxAuiManager::OnMotion)
     EVT_LEAVE_WINDOW(wxAuiManager::OnLeaveWindow)
+    EVT_MOUSE_CAPTURE_LOST(wxAuiManager::OnCaptureLost)
     EVT_CHILD_FOCUS(wxAuiManager::OnChildFocus)
     EVT_AUI_FIND_MANAGER(wxAuiManager::OnFindManager)
     EVT_TIMER(101, wxAuiManager::OnHintFadeTimer)
@@ -1006,6 +1011,22 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info)
         button.button_id = wxAUI_BUTTON_CLOSE;
         pinfo.buttons.Add(button);
     }
+    
+    if (pinfo.HasGripper())
+    {
+        if (pinfo.window->IsKindOf(CLASSINFO(wxAuiToolBar)))
+        {
+            // prevent duplicate gripper -- both wxAuiManager and wxAuiToolBar
+            // have a gripper control.  The toolbar's built-in gripper
+            // meshes better with the look and feel of the control than ours,
+            // so turn wxAuiManager's gripper off, and the toolbar's on.
+            
+            wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(pinfo.window);
+            pinfo.SetFlag(wxAuiPaneInfo::optionGripper, false);
+            tb->SetGripperVisible(true);
+        }
+    }
+    
 
     if (pinfo.best_size == wxDefaultSize &&
         pinfo.window)
@@ -1037,6 +1058,8 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info)
         }
     }
 
+
+    
     return true;
 }
 
@@ -2391,6 +2414,7 @@ void wxAuiManager::GetDockSizeConstraint(double* width_pct, double* height_pct)
 void wxAuiManager::Update()
 {
     m_hover_button = NULL;
+    m_action_part = NULL;
 
     wxSizer* sizer;
     int i, pane_count = m_panes.GetCount();
@@ -3571,7 +3595,6 @@ void wxAuiManager::OnFloatingPaneMoved(wxWindow* wnd, wxDirection dir)
     wxPoint frame_pos = pane.frame->GetPosition();
     wxPoint action_offset(pt.x-frame_pos.x, pt.y-frame_pos.y);
 
-
     // if a key modifier is pressed while dragging the frame,
     // don't dock the window
     if (CanDockPanel(pane))
@@ -4184,17 +4207,21 @@ void wxAuiManager::OnLeftUp(wxMouseEvent& event)
     {
         m_hover_button = NULL;
         m_frame->ReleaseMouse();
-        UpdateButtonOnScreen(m_action_part, event);
-
-        // make sure we're still over the item that was originally clicked
-        if (m_action_part == HitTest(event.GetX(), event.GetY()))
+        
+        if (m_action_part)
         {
-            // fire button-click event
-            wxAuiManagerEvent e(wxEVT_AUI_PANE_BUTTON);
-            e.SetManager(this);
-            e.SetPane(m_action_part->pane);
-            e.SetButton(m_action_part->button->button_id);
-            ProcessMgrEvent(e);
+            UpdateButtonOnScreen(m_action_part, event);
+
+            // make sure we're still over the item that was originally clicked
+            if (m_action_part == HitTest(event.GetX(), event.GetY()))
+            {
+                // fire button-click event
+                wxAuiManagerEvent e(wxEVT_AUI_PANE_BUTTON);
+                e.SetManager(this);
+                e.SetPane(m_action_part->pane);
+                e.SetButton(m_action_part->button->button_id);
+                ProcessMgrEvent(e);
+            }
         }
     }
     else if (m_action == actionClickCaption)
@@ -4257,20 +4284,23 @@ void wxAuiManager::OnMotion(wxMouseEvent& event)
 
     if (m_action == actionResize)
     {
-        wxPoint pos = m_action_part->rect.GetPosition();
-        if (m_action_part->orientation == wxHORIZONTAL)
-            pos.y = wxMax(0, event.m_y - m_action_offset.y);
-        else
-            pos.x = wxMax(0, event.m_x - m_action_offset.x);
+        if (m_action_part)
+        {
+            wxPoint pos = m_action_part->rect.GetPosition();
+            if (m_action_part->orientation == wxHORIZONTAL)
+                pos.y = wxMax(0, event.m_y - m_action_offset.y);
+            else
+                pos.x = wxMax(0, event.m_x - m_action_offset.x);
 
-        wxRect rect(m_frame->ClientToScreen(pos),
-                    m_action_part->rect.GetSize());
+            wxRect rect(m_frame->ClientToScreen(pos),
+                        m_action_part->rect.GetSize());
 
-        wxScreenDC dc;
-        if (!m_action_hintrect.IsEmpty())
-            DrawResizeHint(dc, m_action_hintrect);
-        DrawResizeHint(dc, rect);
-        m_action_hintrect = rect;
+            wxScreenDC dc;
+            if (!m_action_hintrect.IsEmpty())
+                DrawResizeHint(dc, m_action_hintrect);
+            DrawResizeHint(dc, rect);
+            m_action_hintrect = rect;
+        }
     }
     else if (m_action == actionClickCaption)
     {
@@ -4280,8 +4310,9 @@ void wxAuiManager::OnMotion(wxMouseEvent& event)
         // caption has been clicked.  we need to check if the mouse
         // is now being dragged. if it is, we need to change the
         // mouse action to 'drag'
-        if (abs(event.m_x - m_action_start.x) > drag_x_threshold ||
-            abs(event.m_y - m_action_start.y) > drag_y_threshold)
+        if (m_action_part &&
+            (abs(event.m_x - m_action_start.x) > drag_x_threshold ||
+             abs(event.m_y - m_action_start.y) > drag_y_threshold))
         {
             wxAuiPaneInfo* pane_info = m_action_part->pane;
 
@@ -4411,6 +4442,16 @@ void wxAuiManager::OnLeaveWindow(wxMouseEvent& WXUNUSED(event))
     }
 }
 
+void wxAuiManager::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event))
+{
+    // cancel the operation in progress, if any
+    if ( m_action != actionNone )
+    {
+        m_action = actionNone;
+        HideHint();
+    }
+}
+
 void wxAuiManager::OnChildFocus(wxChildFocusEvent& event)
 {
     // when a child pane has it's focus set, we should change the