+// 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();
+ }
+}