-// Default resizing behaviour - if only ONE subwindow,
-// resize to client rectangle size
-void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
-{
- DoMenuUpdates();
-}
-
-
-// update all menus
-void wxFrame::DoMenuUpdates()
-{
- wxMenuBar* bar = GetMenuBar();
-
- if ( bar != NULL )
- {
- int nCount = bar->GetMenuCount();
- for (int n = 0; n < nCount; n++)
- DoMenuUpdates(bar->GetMenu(n), (wxWindow*) NULL);
- }
-}
-
-// update a menu and all submenus recursively
-void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* WXUNUSED(focusWin))
-{
- wxEvtHandler* evtHandler = GetEventHandler();
- wxMenuItemList::Node* node = menu->GetMenuItems().GetFirst();
- while (node)
- {
- wxMenuItem* item = node->GetData();
- if ( !item->IsSeparator() )
- {
- wxWindowID id = item->GetId();
- wxUpdateUIEvent event(id);
- event.SetEventObject( this );
-
- if (evtHandler->ProcessEvent(event))
- {
- if (event.GetSetText())
- menu->SetLabel(id, event.GetText());
- if (event.GetSetChecked())
- menu->Check(id, event.GetChecked());
- if (event.GetSetEnabled())
- menu->Enable(id, event.GetEnabled());
- }
-
- if (item->GetSubMenu())
- DoMenuUpdates(item->GetSubMenu(), (wxWindow*) NULL);
- }
- node = node->GetNext();
- }
-}
-
-void wxFrame::OnSize(wxSizeEvent& event)
-{
- // if we're using constraints - do use them
- #if wxUSE_CONSTRAINTS
- if ( GetAutoLayout() ) {
- Layout();
- return;
- }
- #endif
-
- // do we have _exactly_ one child?
- wxWindow *child = NULL;
- for ( wxNode *node = GetChildren().First(); node; node = node->Next() )
- {
- wxWindow *win = (wxWindow *)node->Data();
- if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
- !win->IsKindOf(CLASSINFO(wxDialog)) &&
- (win != GetStatusBar())
-#if wxUSE_TOOLBAR
- &&
- (win != GetToolBar())
-#endif
- )
- {
- if ( child )
- return; // it's our second subwindow - nothing to do
- child = win;
- }
- }
-
- if ( child ) {
- // we have exactly one child - set it's size to fill the whole frame
- int clientW, clientH;
- GetClientSize(&clientW, &clientH);
-
- int x = 0;
- int y = 0;
-
- child->SetSize(x, y, clientW, clientH);
- }
-}