+// 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();
+ }
+}
- wxString val_part = pane_part.BeforeFirst(wxT(';'));
- pane_part = pane_part.AfterFirst(wxT(';'));
- wxString val_name = val_part.BeforeFirst(wxT('='));
- wxString value = val_part.AfterFirst(wxT('='));
- val_name.MakeLower();
- val_name.Trim(true);
- val_name.Trim(false);
- value.Trim(true);
- value.Trim(false);
-
- if (val_name.empty())
- return wxEmptyString;
-
- if (val_name == wxT("name"))
- pane.name = value;
- else if (val_name == wxT("caption"))
- pane.caption = value;
- else if (val_name == wxT("state"))
- pane.state = (unsigned int)wxAtoi(value.c_str());
- else if (val_name == wxT("dir"))
- pane.dock_direction = wxAtoi(value.c_str());
- else if (val_name == wxT("layer"))
- pane.dock_layer = wxAtoi(value.c_str());
- else if (val_name == wxT("row"))
- pane.dock_row = wxAtoi(value.c_str());
- else if (val_name == wxT("pos"))
- pane.dock_pos = wxAtoi(value.c_str());
- else if (val_name == wxT("prop"))
- pane.dock_proportion = wxAtoi(value.c_str());
- else if (val_name == wxT("bestw"))
- pane.best_size.x = wxAtoi(value.c_str());
- else if (val_name == wxT("besth"))
- pane.best_size.y = wxAtoi(value.c_str());
- else if (val_name == wxT("minw"))
- pane.min_size.x = wxAtoi(value.c_str());
- else if (val_name == wxT("minh"))
- pane.min_size.y = wxAtoi(value.c_str());
- else if (val_name == wxT("maxw"))
- pane.max_size.x = wxAtoi(value.c_str());
- else if (val_name == wxT("maxh"))
- pane.max_size.y = wxAtoi(value.c_str());
- else if (val_name == wxT("floatx"))
- pane.floating_pos.x = wxAtoi(value.c_str());
- else if (val_name == wxT("floaty"))
- pane.floating_pos.y = wxAtoi(value.c_str());
- else if (val_name == wxT("floatw"))
- pane.floating_size.x = wxAtoi(value.c_str());
- else if (val_name == wxT("floath"))
- pane.floating_size.y = wxAtoi(value.c_str());
- else {
- wxFAIL_MSG(wxT("Bad Perspective String"));
+ while(1)
+ {
+ wxString val_part = pane_part.BeforeFirst(wxT(';'));
+ pane_part = pane_part.AfterFirst(wxT(';'));
+ wxString val_name = val_part.BeforeFirst(wxT('='));
+ wxString value = val_part.AfterFirst(wxT('='));
+ val_name.MakeLower();
+ val_name.Trim(true);
+ val_name.Trim(false);
+ value.Trim(true);
+ value.Trim(false);
+
+ if (val_name.empty())
+ break;
+
+ if (val_name == wxT("name"))
+ pane.name = value;
+ else if (val_name == wxT("caption"))
+ pane.caption = value;
+ else if (val_name == wxT("state"))
+ pane.state = (unsigned int)wxAtoi(value.c_str());
+ else if (val_name == wxT("dir"))
+ pane.dock_direction = wxAtoi(value.c_str());
+ else if (val_name == wxT("layer"))
+ pane.dock_layer = wxAtoi(value.c_str());
+ else if (val_name == wxT("row"))
+ pane.dock_row = wxAtoi(value.c_str());
+ else if (val_name == wxT("pos"))
+ pane.dock_pos = wxAtoi(value.c_str());
+ else if (val_name == wxT("prop"))
+ pane.dock_proportion = wxAtoi(value.c_str());
+ else if (val_name == wxT("bestw"))
+ pane.best_size.x = wxAtoi(value.c_str());
+ else if (val_name == wxT("besth"))
+ pane.best_size.y = wxAtoi(value.c_str());
+ else if (val_name == wxT("minw"))
+ pane.min_size.x = wxAtoi(value.c_str());
+ else if (val_name == wxT("minh"))
+ pane.min_size.y = wxAtoi(value.c_str());
+ else if (val_name == wxT("maxw"))
+ pane.max_size.x = wxAtoi(value.c_str());
+ else if (val_name == wxT("maxh"))
+ pane.max_size.y = wxAtoi(value.c_str());
+ else if (val_name == wxT("floatx"))
+ pane.floating_pos.x = wxAtoi(value.c_str());
+ else if (val_name == wxT("floaty"))
+ pane.floating_pos.y = wxAtoi(value.c_str());
+ else if (val_name == wxT("floatw"))
+ pane.floating_size.x = wxAtoi(value.c_str());
+ else if (val_name == wxT("floath"))
+ pane.floating_size.y = wxAtoi(value.c_str());
+ else {
+ wxFAIL_MSG(wxT("Bad Perspective String"));
+ }
- int row = drop.dock_row;
- DoInsertDockRow(panes, part->dock->dock_direction,
- part->dock->dock_layer,
- part->dock->dock_row);
- drop.dock_row = row;
+ if ((part->dock->dock_direction == wxAUI_DOCK_TOP) ||
+ (part->dock->dock_direction == wxAUI_DOCK_LEFT))
+ {
+ int row = drop.dock_row;
+ DoInsertDockRow(panes, part->dock->dock_direction,
+ part->dock->dock_layer,
+ part->dock->dock_row);
+ drop.dock_row = row;
+ }
+ else
+ {
+ DoInsertDockRow(panes, part->dock->dock_direction,
+ part->dock->dock_layer,
+ part->dock->dock_row+1);
+ drop.dock_row = part->dock->dock_row+1;
+ }
- DoInsertDockRow(panes, part->dock->dock_direction,
- part->dock->dock_layer,
- part->dock->dock_row+1);
- drop.dock_row = part->dock->dock_row+1;
+ if ((part->dock->dock_direction == wxAUI_DOCK_TOP) ||
+ (part->dock->dock_direction == wxAUI_DOCK_LEFT))
+ {
+ DoInsertDockRow(panes, part->dock->dock_direction,
+ part->dock->dock_layer,
+ part->dock->dock_row+1);
+ drop.dock_row = part->dock->dock_row+1;
+ }
+ else
+ {
+ int row = drop.dock_row;
+ DoInsertDockRow(panes, part->dock->dock_direction,
+ part->dock->dock_layer,
+ part->dock->dock_row);
+ drop.dock_row = row;
+ }
+
+#if 0
+ // Adapt pt to direction
+ if (dir == wxNORTH)
+ {
+ // move to pane's upper border
+ wxPoint pos( 0,0 );
+ pos = wnd->ClientToScreen( pos );
+ pt.y = pos.y;
+ // and some more pixels for the title bar
+ pt.y -= 5;
+ } else
+ if (dir == wxWEST)
+ {
+ // move to pane's left border
+ wxPoint pos( 0,0 );
+ pos = wnd->ClientToScreen( pos );
+ pt.x = pos.x;
+ } else
+ if (dir == wxEAST)
+ {
+ // move to pane's right border
+ wxPoint pos( wnd->GetSize().x, 0 );
+ pos = wnd->ClientToScreen( pos );
+ pt.x = pos.x;
+ } else
+ if (dir == wxSOUTH)
+ {
+ // move to pane's bottom border
+ wxPoint pos( 0, wnd->GetSize().y );
+ pos = wnd->ClientToScreen( pos );
+ pt.y = pos.y;
+ }
+#else
+ wxUnusedVar(dir);
+#endif
+
+
+#if 0
+ // Adapt pt to direction
+ if (dir == wxNORTH)
+ {
+ // move to pane's upper border
+ wxPoint pos( 0,0 );
+ pos = wnd->ClientToScreen( pos );
+ pt.y = pos.y;
+ // and some more pixels for the title bar
+ pt.y -= 10;
+ } else
+ if (dir == wxWEST)
+ {
+ // move to pane's left border
+ wxPoint pos( 0,0 );
+ pos = wnd->ClientToScreen( pos );
+ pt.x = pos.x;
+ } else
+ if (dir == wxEAST)
+ {
+ // move to pane's right border
+ wxPoint pos( wnd->GetSize().x, 0 );
+ pos = wnd->ClientToScreen( pos );
+ pt.x = pos.x;
+ } else
+ if (dir == wxSOUTH)
+ {
+ // move to pane's bottom border
+ wxPoint pos( 0, wnd->GetSize().y );
+ pos = wnd->ClientToScreen( pos );
+ pt.y = pos.y;
+ }
+#else
+ wxUnusedVar(dir);
+#endif
+