X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/519cb848a8f4c91c73421bb75314754284e593a4..f23208caccf81b0b34c5c11b466c6bd64fdf0f9d:/src/mac/frame.cpp?ds=sidebyside diff --git a/src/mac/frame.cpp b/src/mac/frame.cpp index 5a95ac9097..cded59c604 100644 --- a/src/mac/frame.cpp +++ b/src/mac/frame.cpp @@ -28,7 +28,6 @@ extern wxList wxModelessWindows; extern wxList wxPendingDelete; -#if !USE_SHARED_LIBRARY BEGIN_EVENT_TABLE(wxFrame, wxWindow) EVT_SIZE(wxFrame::OnSize) EVT_ACTIVATE(wxFrame::OnActivate) @@ -39,7 +38,6 @@ BEGIN_EVENT_TABLE(wxFrame, wxWindow) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) -#endif #if wxUSE_NATIVE_STATUSBAR bool wxFrame::m_useNativeStatusBar = TRUE; @@ -52,13 +50,12 @@ wxFrame::wxFrame() #if wxUSE_TOOLBAR m_frameToolBar = NULL ; #endif - m_macShown = false ; + // in order to be able to give size events on show m_frameMenuBar = NULL; m_frameStatusBar = NULL; - - m_windowParent = NULL; m_iconized = FALSE; + m_isShown = FALSE; } bool wxFrame::Create(wxWindow *parent, @@ -75,6 +72,7 @@ bool wxFrame::Create(wxWindow *parent, SetName(name); m_windowStyle = style; m_frameMenuBar = NULL; + m_isShown = FALSE; #if wxUSE_TOOLBAR m_frameToolBar = NULL ; @@ -147,7 +145,6 @@ bool wxFrame::Create(wxWindow *parent, UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ; m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ; m_macWindowData->m_macFocus = NULL ; - m_macShown = false ; return TRUE; } @@ -342,6 +339,56 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) // 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 @@ -491,9 +538,9 @@ wxPoint wxFrame::GetClientAreaOrigin() const return pt; } -void wxFrame::GetClientSize(int *x, int *y) const +void wxFrame::DoGetClientSize(int *x, int *y) const { - wxWindow::GetClientSize( x , y ) ; + wxWindow::DoGetClientSize( x , y ) ; if ( GetStatusBar() ) {