]> git.saurik.com Git - wxWidgets.git/blobdiff - src/aui/framemanager.cpp
non-PCH build fix (according to Tinderbox).
[wxWidgets.git] / src / aui / framemanager.cpp
index 3dc1ac038bed85c83445b10a5eac88c39b175fc3..6822196ead112dd61e361d8c0a19e4fba7ab3934 100644 (file)
@@ -494,6 +494,12 @@ wxFrameManager::~wxFrameManager()
     delete m_art;
 }
 
+// Creates a floating frame for the windows
+wxFloatingPane * wxFrameManager::CreateFloatingFrame(wxWindow* parent, const wxPaneInfo& p)
+{
+    return new wxFloatingPane(parent, this, p);
+}
+
 // GetPane() looks up a wxPaneInfo structure based
 // on the supplied window pointer.  Upon failure, GetPane()
 // returns an empty wxPaneInfo, a condition which can be checked
@@ -940,6 +946,40 @@ bool wxFrameManager::DetachPane(wxWindow* window)
     return false;
 }
 
+// ClosePane() destroys or hides the pane depending on its
+// flags
+void wxFrameManager::ClosePane(wxPaneInfo& pane_info)
+{
+    // first, hide the window
+    if (pane_info.window && pane_info.window->IsShown()) {
+        pane_info.window->Show(false);
+    }
+
+    // make sure that we are the parent of this window
+    if(pane_info.window && pane_info.window->GetParent() != m_frame) {
+        pane_info.window->Reparent(m_frame);
+    }
+
+    // if we have a frame, destroy it
+    if(pane_info.frame) {
+        pane_info.frame->Destroy();
+        pane_info.frame = NULL;
+    }
+
+    // now we need to either destroy or hide the pane
+    if(pane_info.IsDestroyOnClose()) 
+    {
+        wxWindow * window = pane_info.window;
+        DetachPane(window);
+        if(window) {
+            window->Destroy();
+        }
+    } 
+    else 
+    {
+        pane_info.Hide();
+    }
+}
 
 // EscapeDelimiters() changes ";" into "\;" and "|" into "\|"
 // in the input string.  This is an internal functions which is
@@ -2004,9 +2044,7 @@ void wxFrameManager::Update()
             {
                 // we need to create a frame for this
                 // pane, which has recently been floated
-                wxFloatingPane* frame = new wxFloatingPane(m_frame,
-                                                  this,
-                                                  p);
+                wxFloatingPane* frame = CreateFloatingFrame(m_frame, p);
 
 #if wxCHECK_VERSION(2,7,0)
                 // on MSW and Mac, if the owner desires transparent dragging, and
@@ -2341,7 +2379,7 @@ bool wxFrameManager::DoDrop(wxDockInfoArray& docks,
         int new_layer = wxMax( wxMax( GetMaxLayer(docks, wxAUI_DOCK_BOTTOM),
                                       GetMaxLayer(docks, wxAUI_DOCK_LEFT)),
                                       GetMaxLayer(docks, wxAUI_DOCK_RIGHT)) + 1;
-    
+
         drop.Dock().Bottom().
              Layer(new_layer).
              Row(0).
@@ -2356,7 +2394,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;
@@ -2384,12 +2422,12 @@ bool wxFrameManager::DoDrop(wxDockInfoArray& docks,
                 {
                     drop.Float();
                 }
-                
+
                 m_skipping = false;
-                
+
                 return ProcessDockResult(target, drop);
             }
-            
+
             drop.Position(pt.x - GetDockPixelOffset(drop) - offset.x);
 
             return ProcessDockResult(target, drop);
@@ -2398,7 +2436,7 @@ bool wxFrameManager::DoDrop(wxDockInfoArray& docks,
         {
             m_skipping = false;
         }
-        
+
         if (!m_skipping)
         {
             m_last_rect = part->dock->rect;
@@ -2949,6 +2987,8 @@ void wxFrameManager::OnFloatingPaneMoving(wxWindow* wnd, wxDirection dir)
         pos = wnd->ClientToScreen( pos );
         pt.y = pos.y;
     }
+#else
+    wxUnusedVar(dir);
 #endif
 
     wxPoint client_pt = m_frame->ScreenToClient(pt);
@@ -3050,6 +3090,8 @@ void wxFrameManager::OnFloatingPaneMoved(wxWindow* wnd, wxDirection dir)
         pos = wnd->ClientToScreen( pos );
         pt.y = pos.y;
     }
+#else
+    wxUnusedVar(dir);
 #endif
 
     wxPoint client_pt = m_frame->ScreenToClient(pt);
@@ -3113,15 +3155,9 @@ void wxFrameManager::OnFloatingPaneClosed(wxWindow* wnd, wxCloseEvent& evt)
         evt.Veto();
         return;
     }
-     else
+     else 
     {
-        // reparent the pane window back to us and
-        // prepare the frame window for destruction
-        if (pane.window->IsShown())
-            pane.window->Show(false);
-        pane.window->Reparent(m_frame);
-        pane.frame = NULL;
-        pane.Hide();
+        ClosePane(pane);
     }
 }
 
@@ -3856,7 +3892,7 @@ void wxFrameManager::OnPaneButton(wxFrameManagerEvent& evt)
 
         if (!e.GetVeto())
         {
-            pane.Hide();
+            ClosePane(pane);
             Update();
         }
     }