]> git.saurik.com Git - wxWidgets.git/blobdiff - src/aui/framemanager.cpp
use CPPUNIT_ASSERT_MESSAGE() to show which test exactly failed; use more CPPUNIT_ASSE...
[wxWidgets.git] / src / aui / framemanager.cpp
index 8b35314383cf6776d010c1f8eb618ddf602b6410..18453eb82958e0fc52272e1d3da0feb20b56dcb3 100644 (file)
@@ -503,9 +503,9 @@ wxAuiManager::~wxAuiManager()
 }
 
 // Creates a floating frame for the windows
-wxAuiFloatingPane * wxAuiManager::CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p)
+wxAuiFloatingFrame * wxAuiManager::CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p)
 {
-    return new wxAuiFloatingPane(parent, this, p);
+    return new wxAuiFloatingFrame(parent, this, p);
 }
 
 // GetPane() looks up a wxAuiPaneInfo structure based
@@ -799,6 +799,10 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info)
     if (GetPane(pane_info.window).IsOk())
         return false;
 
+    // if the new pane is docked then we should undo maximize
+    if(pane_info.IsDocked())
+        RestoreMaximizedPane();
+
     m_panes.Add(pane_info);
 
     wxAuiPaneInfo& pinfo = m_panes.Last();
@@ -830,7 +834,14 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info)
         button.button_id = wxAUI_BUTTON_MAXIMIZE_RESTORE;
         pinfo.buttons.Add(button);
     }
-
+    
+    if (pinfo.HasPinButton())
+    {
+        wxAuiPaneButton button;
+        button.button_id = wxAUI_BUTTON_PIN;
+        pinfo.buttons.Add(button);
+    }
+    
     if (pinfo.HasCloseButton())
     {
         wxAuiPaneButton button;
@@ -946,6 +957,9 @@ bool wxAuiManager::InsertPane(wxWindow* window, const wxAuiPaneInfo& pane_info,
         }
          else
         {
+            // if the new pane is docked then we should undo maximize
+            RestoreMaximizedPane();
+
             existing_pane.Direction(pane_info.dock_direction);
             existing_pane.Layer(pane_info.dock_layer);
             existing_pane.Row(pane_info.dock_row);
@@ -1535,6 +1549,13 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont,
             part.sizer_item = sizer_item;
             uiparts.Add(part);
         }
+        
+        // if we have buttons, add a little space to the right
+        // of them to ease visual crowding
+        if (button_count >= 1)
+        {
+            caption_sizer->Add(3,1);
+        }
 
         // add the caption sizer
         sizer_item = vert_pane_sizer->Add(caption_sizer, 0, wxEXPAND);
@@ -2161,28 +2182,30 @@ void wxAuiManager::Update()
             p.window->SetSize(1,1);
 
 
-           // the following block is a workaround for bug #1531361
-           // (see wxWidgets sourceforge page).  On wxGTK (only), when
-           // a frame is shown/hidden, a move event unfortunately
-           // also gets fired.  Because we may be dragging around
-           // a pane, we need to cancel that action here to prevent
-           // a spurious crash.
-           if (m_action_window == p.frame)
-           {
-               if (wxWindow::GetCapture() == m_frame)
+               // the following block is a workaround for bug #1531361
+               // (see wxWidgets sourceforge page).  On wxGTK (only), when
+               // a frame is shown/hidden, a move event unfortunately
+               // also gets fired.  Because we may be dragging around
+               // a pane, we need to cancel that action here to prevent
+               // a spurious crash.
+               if (m_action_window == p.frame)
+               {
+                       if (wxWindow::GetCapture() == m_frame)
                     m_frame->ReleaseMouse();
                 m_action = actionNone;
-               m_action_window = NULL;
-           }
+                       m_action_window = NULL;
+               }
 
-           // hide the frame
+               // hide the frame
             if (p.frame->IsShown())
                 p.frame->Show(false);
 
             // reparent to m_frame and destroy the pane
-            if(m_action_window == p.frame) {
+            if(m_action_window == p.frame)
+            {
                 m_action_window = NULL;
             }
+            
             p.window->Reparent(m_frame);
             p.frame->SetSizer(NULL);
             p.frame->Destroy();
@@ -2206,7 +2229,7 @@ void wxAuiManager::Update()
             {
                 // we need to create a frame for this
                 // pane, which has recently been floated
-                wxAuiFloatingPane* frame = CreateFloatingFrame(m_frame, p);
+                wxAuiFloatingFrame* frame = CreateFloatingFrame(m_frame, p);
 
 #if wxCHECK_VERSION(2,7,0)
                 // on MSW and Mac, if the owner desires transparent dragging, and
@@ -3456,6 +3479,17 @@ void wxAuiManager::OnSize(wxSizeEvent& event)
     {
         DoFrameLayout();
         Repaint();
+        
+#if wxUSE_MDI
+        if (m_frame->IsKindOf(CLASSINFO(wxMDIParentFrame)))
+        {
+            // for MDI parent frames, this event must not
+            // be "skipped".  In other words, the parent frame
+            // must not be allowed to resize the client window
+            // after we are finished processing sizing changes
+            return;
+        }
+#endif
     }
     event.Skip();
 }
@@ -3500,10 +3534,12 @@ void wxAuiManager::OnSetCursor(wxSetCursorEvent& event)
 
 
 void wxAuiManager::UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part,
-                                          const wxMouseEvent& event)
+                                        const wxMouseEvent& event)
 {
     wxAuiDockUIPart* hit_test = HitTest(event.GetX(), event.GetY());
-
+    if (!hit_test || !button_ui_part)
+        return;
+        
     int state = wxAUI_BUTTON_STATE_NORMAL;
 
     if (hit_test == button_ui_part)
@@ -3543,12 +3579,12 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event)
     wxAuiDockUIPart* part = HitTest(event.GetX(), event.GetY());
     if (part)
     {
-        if (part->dock && part->dock->dock_direction == wxAUI_DOCK_CENTER)
-            return;
-
         if (part->type == wxAuiDockUIPart::typeDockSizer ||
             part->type == wxAuiDockUIPart::typePaneSizer)
         {
+            if (part->dock && part->dock->dock_direction == wxAUI_DOCK_CENTER)
+                return;
+        
             // a dock may not be resized if it has a single
             // pane which is not resizable
             if (part->type == wxAuiDockUIPart::typeDockSizer && part->dock &&
@@ -3580,6 +3616,9 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event)
          else if (part->type == wxAuiDockUIPart::typeCaption ||
                   part->type == wxAuiDockUIPart::typeGripper)
         {
+            if (part->dock && part->dock->dock_direction == wxAUI_DOCK_CENTER)
+                return;
+
             if (GetFlags() & wxAUI_MGR_ALLOW_ACTIVE_PANE)
             {
                 // set the caption as active