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
This commit is contained in:
Julian Smart
2003-07-09 14:20:30 +00:00
parent 63ad74ab2d
commit 18afa2acbe
4 changed files with 4 additions and 50 deletions

View File

@@ -157,18 +157,8 @@ In addition to wxCOMPATIBILITY code:
- contrib/src/canvas? - contrib/src/canvas?
- contrib/src/mmedia - contrib/src/mmedia
- contrib/src/applet? - contrib/src/applet?
- utils/Install
- wxDate, wxTime
- Old wxODBC code - Old wxODBC code
- wxExpr (rewriting some OGL code or bundling wxExpr with OGL)
- Old resource system
- samples/resource
- Dialog Editor - Dialog Editor
- generic/src/htmlhelp.cpp
- all code that uses layout constraints,
so constraints can be compiled out of the
core library
wxMiscellaneous wxMiscellaneous
=============== ===============

View File

@@ -147,7 +147,6 @@ public:
#if wxUSE_MENUS #if wxUSE_MENUS
// send wxUpdateUIEvents for all menu items (called from OnIdle()) // send wxUpdateUIEvents for all menu items (called from OnIdle())
void DoMenuUpdates(); void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
#endif // wxUSE_MENUS #endif // wxUSE_MENUS
// do the UI update processing for this window // do the UI update processing for this window

View File

@@ -413,47 +413,12 @@ void wxFrameBase::DoMenuUpdates()
{ {
wxMenuBar* bar = GetMenuBar(); wxMenuBar* bar = GetMenuBar();
#ifdef __WXMSW__
wxWindow* focusWin = wxFindFocusDescendant((wxWindow*) this);
#else
wxWindow* focusWin = (wxWindow*) NULL;
#endif
if ( bar != NULL ) if ( bar != NULL )
{ {
wxEvtHandler* source = GetEventHandler();
int nCount = bar->GetMenuCount(); int nCount = bar->GetMenuCount();
for (int n = 0; n < nCount; n++) for (int n = 0; n < nCount; n++)
DoMenuUpdates(bar->GetMenu(n), focusWin); bar->GetMenu(n)->UpdateUI(source);
}
}
// 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();
} }
} }

View File

@@ -553,7 +553,7 @@ void wxMenuBase::UpdateUI(wxEvtHandler* source)
if ( source->ProcessEvent(event) ) if ( source->ProcessEvent(event) )
{ {
// if anything changed, update the chanegd attribute // if anything changed, update the changed attribute
if (event.GetSetText()) if (event.GetSetText())
SetLabel(id, event.GetText()); SetLabel(id, event.GetText());
if (event.GetSetChecked()) if (event.GetSetChecked())
@@ -566,7 +566,7 @@ void wxMenuBase::UpdateUI(wxEvtHandler* source)
if ( item->GetSubMenu() ) if ( item->GetSubMenu() )
item->GetSubMenu()->UpdateUI(source); 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(); node = node->GetNext();
} }