bool wxStandardDialogLayoutAdapter::DoFitWithScrolling(wxDialog* dialog, wxWindowList& windows) { wxSizer* sizer = dialog->GetSizer(); if (!sizer) return false; sizer->SetSizeHints(dialog); wxSize windowSize, displaySize; int scrollFlags = DoMustScroll(dialog, windowSize, displaySize); int scrollBarSize = 20; if (scrollFlags) { int scrollBarExtraX = 0, scrollBarExtraY = 0; bool resizeHorizontally = (scrollFlags & wxHORIZONTAL) != 0; bool resizeVertically = (scrollFlags & wxVERTICAL) != 0; if (windows.GetCount() != 0) { // Allow extra for a scrollbar, assuming we resizing in one direction only. if ((resizeVertically && !resizeHorizontally) && (windowSize.x < (displaySize.x - scrollBarSize))) scrollBarExtraX = scrollBarSize; if ((resizeHorizontally && !resizeVertically) && (windowSize.y < (displaySize.y - scrollBarSize))) scrollBarExtraY = scrollBarSize; } wxWindowList::compatibility_iterator node = windows.GetFirst(); while (node) { wxWindow *win = node->GetData(); wxScrolledWindow* scrolledWindow = wxDynamicCast(win, wxScrolledWindow); if (scrolledWindow) { scrolledWindow->SetScrollRate(resizeHorizontally ? 10 : 0, resizeVertically ? 10 : 0); if (scrolledWindow->GetSizer()) scrolledWindow->GetSizer()->Fit(scrolledWindow); } node = node->GetNext(); } wxSize limitTo = windowSize + wxSize(scrollBarExtraX, scrollBarExtraY); if (resizeVertically) limitTo.y = displaySize.y - wxEXTRA_DIALOG_HEIGHT; if (resizeHorizontally) limitTo.x = displaySize.x; dialog->SetMinSize(limitTo); dialog->SetSize(limitTo); dialog->SetSizeHints( limitTo.x, limitTo.y, dialog->GetMaxWidth(), dialog->GetMaxHeight() ); } return true; }
void ShowWindowRecursively(wxWindowList& hiddenWindows) { for(wxWindowList::iterator itr = hiddenWindows.begin(); itr != hiddenWindows.end(); ++itr) { wxWindow* win = (*itr); //Show is virtual, and dialog windows assume the window is just starting up when Show() //is called. Make sure to call the base version win->wxWindow::Show(true); win->Raise(); win->Update(); } hiddenWindows.clear(); }
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { SetName(name); if ( id == wxID_ANY ) m_windowId = (int)NewControlId(); else m_windowId = id; if (parent) parent->AddChild(this); MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ; SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); wxModelessWindows.Append(this); return true; }
static bool findWindowRecursively( const wxWindowList& children, const wxWindow* wanted ) { for( wxWindowList::const_iterator it = children.begin(); it != children.end(); ++it ) { const wxWindow* child = *it; if( wanted == child ) return true; else { if( findWindowRecursively( child->GetChildren(), wanted ) ) return true; } } return false; }
void MDIWindowMenuEvtHandler::OnCloseAll(wxCommandEvent&) { const wxWindowList list = m_target_wnd->GetChildren(); // make a copy of the window list for (wxWindowList::const_iterator i = list.begin(); i != list.end(); i++) { if (wxDynamicCast(*i, wxMDIChildFrame)) { if (!(*i)->Close()) { // Close was vetoed break; } } } }
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) { if ( !wxWindow::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style) ) return false; wxModelessWindows.Append(this); return true; }
wxTopLevelWindowMac::~wxTopLevelWindowMac() { if ( m_macWindow ) { wxToolTip::NotifyWindowDelete(m_macWindow) ; wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ; } #if TARGET_CARBON if ( m_macEventHandler ) { ::RemoveEventHandler((EventHandlerRef) m_macEventHandler); m_macEventHandler = NULL ; } #endif wxRemoveMacWindowAssociation( this ) ; if ( wxModelessWindows.Find(this) ) wxModelessWindows.DeleteObject(this); DisposeRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ; }
bool wxFrame::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; wxModelessWindows.Append(this); return true; }
void HideWindowRecursively(wxTopLevelWindow* win, wxWindowList& hiddenWindows) { if (!win) return; wxWindowList& children = win->GetChildren(); for(wxWindowList::iterator itr = children.begin(); itr != children.end(); ++itr) { if ((*itr)->IsTopLevel() && (*itr)->IsShown()) { HideWindowRecursively(wxDynamicCast(*itr, wxTopLevelWindow), hiddenWindows); } } //Don't call Hide() here, which just calls Show(false), which is overridden in //derived classes, and wxDialog actually cancels the modal loop and closes the window win->wxWindow::Show(false); //push_front ensures we Show() in the reverse order of Hide()'ing hiddenWindows.push_front(win); }