#include "wx/frame.h"
#include "wx/menu.h"
-
-// wxGTK is a special case because it doesn't use the generic wxMenuItem
-// class, but it's own (already defined in wx/menu.h) one
-#ifndef __WXGTK__
- #include "wx/menuitem.h"
-#endif //WXGTK
+#include "wx/menuitem.h"
void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
{
- DoMenuUpdates();
+ 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));
- }
+ 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)
+void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* WXUNUSED(focusWin))
{
- wxNode* node = menu->GetItems().First();
+ wxEvtHandler* evtHandler = GetEventHandler();
+ wxMenuItemList::Node* node = menu->GetMenuItems().GetFirst();
while (node)
{
- wxMenuItem* item = (wxMenuItem*) node->Data();
+ wxMenuItem* item = node->GetData();
if ( !item->IsSeparator() )
{
wxWindowID id = item->GetId();
wxUpdateUIEvent event(id);
event.SetEventObject( this );
- if (GetEventHandler()->ProcessEvent(event))
+ if (evtHandler->ProcessEvent(event))
{
if (event.GetSetText())
menu->SetLabel(id, event.GetText());
}
if (item->GetSubMenu())
- DoMenuUpdates(item->GetSubMenu());
+ DoMenuUpdates(item->GetSubMenu(), (wxWindow*) NULL);
}
- node = node->Next();
+ node = node->GetNext();
}
}