X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22a35096a0a9c3fe4d3d32b8d68a361126ef9677..f5766910b6731eb03e82371416e9778203396ce7:/src/aui/framemanager.cpp?ds=sidebyside diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 3dc1ac038b..6822196ead 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -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(); } }