From: Julian Smart Date: Wed, 9 Jul 2003 14:20:30 +0000 (+0000) Subject: Removed overloaded DoMenuUpdates function since it duplicated X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/18afa2acbefa9b89587a213513f2118958d0c20a Removed overloaded DoMenuUpdates function since it duplicated wxMenu::UpdateUI() Removed routing of menu commands to focus window under Windows Added routing of menu commands (but not UI updates, for efficiency reasons) to wxMenuBar before sending to frame git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/todo30.txt b/docs/todo30.txt index 031831d549..008b93a19e 100644 --- a/docs/todo30.txt +++ b/docs/todo30.txt @@ -157,18 +157,8 @@ In addition to wxCOMPATIBILITY code: - contrib/src/canvas? - contrib/src/mmedia - contrib/src/applet? -- utils/Install -- wxDate, wxTime - Old wxODBC code -- wxExpr (rewriting some OGL code or bundling wxExpr with OGL) -- Old resource system -- samples/resource - Dialog Editor -- generic/src/htmlhelp.cpp -- all code that uses layout constraints, - so constraints can be compiled out of the - core library - wxMiscellaneous =============== diff --git a/include/wx/frame.h b/include/wx/frame.h index 646cce0a23..358246aea6 100644 --- a/include/wx/frame.h +++ b/include/wx/frame.h @@ -147,7 +147,6 @@ public: #if wxUSE_MENUS // send wxUpdateUIEvents for all menu items (called from OnIdle()) void DoMenuUpdates(); - void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin); #endif // wxUSE_MENUS // do the UI update processing for this window diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 42669bd92e..2ab0ab0fa3 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -413,47 +413,12 @@ void wxFrameBase::DoMenuUpdates() { wxMenuBar* bar = GetMenuBar(); -#ifdef __WXMSW__ - wxWindow* focusWin = wxFindFocusDescendant((wxWindow*) this); -#else - wxWindow* focusWin = (wxWindow*) NULL; -#endif if ( bar != NULL ) { + wxEvtHandler* source = GetEventHandler(); int nCount = bar->GetMenuCount(); for (int n = 0; n < nCount; n++) - DoMenuUpdates(bar->GetMenu(n), focusWin); - } -} - -// update a menu and all submenus recursively -void wxFrameBase::DoMenuUpdates(wxMenu* menu, wxWindow* focusWin) -{ - wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : 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(), focusWin); - } - node = node->GetNext(); + bar->GetMenu(n)->UpdateUI(source); } } diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 865d668be2..5422c06677 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -553,7 +553,7 @@ void wxMenuBase::UpdateUI(wxEvtHandler* source) if ( source->ProcessEvent(event) ) { - // if anything changed, update the chanegd attribute + // if anything changed, update the changed attribute if (event.GetSetText()) SetLabel(id, event.GetText()); if (event.GetSetChecked()) @@ -566,7 +566,7 @@ void wxMenuBase::UpdateUI(wxEvtHandler* source) if ( item->GetSubMenu() ) item->GetSubMenu()->UpdateUI(source); } - //else: item is a separator (which don't process update UI events) + //else: item is a separator (which doesn't process update UI events) node = node->GetNext(); }