JBoolean JXDockWidget::CloseAll() { if (itsWindowList != NULL) { JXDisplay* display = GetDisplay(); Display* xDisplay = display->GetXDisplay(); const JSize count = itsWindowList->GetElementCount(); for (JIndex i=count; i>=1; i--) { JXWindow* w = itsWindowList->NthElement(i); StopListening(w); Window xWindow = w->GetXWindow(); if (w->Close()) { if (JXDisplay::WindowExists(display, xDisplay, xWindow)) { w->Undock(); } else if ((JXGetApplication())->DisplayExists(xDisplay)) { itsTabGroup->DeleteTab(i); itsWindowList->RemoveElement(i); } else { return kJFalse; } } else { UpdateMinSize(); return kJFalse; } } delete itsWindowList; itsWindowList = NULL; UpdateMinSize(); } return kJTrue; }
//---------------------------------------- bool CContourPropFrame::Create( wxWindow *parent, CGeoMap* geoMap, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style ) { wxFrame::Create(parent, id, title, position, size, style); Show(false); try { if (!wxGetApp().GetIconFile().IsEmpty()) { SetIcon(wxIcon(wxGetApp().GetIconFile(), ::wxGetApp().GetIconType())); } else { ::wxMessageBox(wxString::Format("WARNING: Unable to find Brat icon file %s", ::wxGetApp().GetIconFileName().c_str()) , "BRAT WARNING"); } } catch(...) { // Do nothing } #ifdef __WXMAC__ // On Mac OS X we override the menu to let the 'close window' shortcut work as expected SetMenuBar(ContourFrameMenuBarFunc()); #endif m_contourPropPanel = new CContourPropPanel(this, geoMap); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(m_contourPropPanel, 1, wxEXPAND); SetSizer(sizer); UpdateMinSize(); InstallEventListeners(); InstallToolTips(); return true; }
void JXDockWidget::UndockAll() { if (itsWindowList != NULL) { const JSize count = itsWindowList->GetElementCount(); for (JIndex i=1; i<=count; i++) { itsTabGroup->DeleteTab(1); JXWindow* w = itsWindowList->NthElement(i); StopListening(w); w->Undock(); } itsWindowList->RemoveAll(); delete itsWindowList; itsWindowList = NULL; UpdateMinSize(); } }
JBoolean JXDockWidget::Dock ( JXWindow* w, const JBoolean reportError ) { if (itsChildPartition != NULL) { return kJFalse; } const JRect geom = GetApertureGlobal(); JPoint minSize; if (w->Dock(this, (GetWindow())->GetXWindow(), geom, &minSize)) { if (itsWindowList == NULL) { itsWindowList = new JPtrArray<JXWindow>(JPtrArrayT::kForgetAll); assert( itsWindowList != NULL ); } const JSize count = itsWindowList->GetElementCount(); assert( count == itsTabGroup->GetTabCount() ); const JCharacter* title = JXFileDocument::SkipNeedsSavePrefix(w->GetTitle()); JIndex index = count+1; for (JIndex i=1; i<=count; i++) { const JCharacter* t = JXFileDocument::SkipNeedsSavePrefix((itsWindowList->NthElement(i))->GetTitle()); if (JStringCompare(title, t, kJFalse) < 0) { index = i; break; } } itsWindowList->InsertAtIndex(index, w); ListenTo(w); UpdateMinSize(); itsTabGroup->InsertTab(index, w->GetTitle()); // Can't call ShowTab() because window might be partially constructed, // so Activate() could blow up. JXSelectTabTask* task = new JXSelectTabTask(itsTabGroup, index); assert( task != NULL ); (JXGetApplication())->InstallUrgentTask(task); return kJTrue; } else { if (reportError) { (JGetUserNotification())->ReportError(JGetString(kWindowWillNotFitID)); } return kJFalse; } }