]>
git.saurik.com Git - wxWidgets.git/blob - src/common/framecmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: common (for all platforms) wxFrame functions
4 // Author: Julian Smart, Vadim Zeitlin
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
20 #include "wx/menuitem.h"
23 void wxFrame::OnIdle(wxIdleEvent
& WXUNUSED(event
) )
30 void wxFrame::DoMenuUpdates()
32 wxMenuBar
* bar
= GetMenuBar();
35 int nCount
= bar
->GetMenuCount();
36 for (int n
= 0; n
< nCount
; n
++)
37 DoMenuUpdates(bar
->GetMenu(n
), (wxWindow
*) NULL
);
41 // update a menu and all submenus recursively
42 void wxFrame::DoMenuUpdates(wxMenu
* menu
, wxWindow
* WXUNUSED(focusWin
))
44 wxEvtHandler
* evtHandler
= GetEventHandler();
45 wxNode
* node
= menu
->GetItems().First();
48 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
49 if ( !item
->IsSeparator() )
51 wxWindowID id
= item
->GetId();
52 wxUpdateUIEvent
event(id
);
53 event
.SetEventObject( this );
55 if (evtHandler
->ProcessEvent(event
))
57 if (event
.GetSetText())
58 menu
->SetLabel(id
, event
.GetText());
59 if (event
.GetSetChecked())
60 menu
->Check(id
, event
.GetChecked());
61 if (event
.GetSetEnabled())
62 menu
->Enable(id
, event
.GetEnabled());
65 if (item
->GetSubMenu())
66 DoMenuUpdates(item
->GetSubMenu(), (wxWindow
*) NULL
);