]>
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"
22 void wxFrame::OnIdle(wxIdleEvent
& WXUNUSED(event
) )
28 void wxFrame::DoMenuUpdates()
30 wxMenuBar
* bar
= GetMenuBar();
34 int nCount
= bar
->GetMenuCount();
35 for (int n
= 0; n
< nCount
; n
++)
36 DoMenuUpdates(bar
->GetMenu(n
), (wxWindow
*) NULL
);
40 // update a menu and all submenus recursively
41 void wxFrame::DoMenuUpdates(wxMenu
* menu
, wxWindow
* WXUNUSED(focusWin
))
43 wxEvtHandler
* evtHandler
= GetEventHandler();
44 wxNode
* node
= menu
->GetItems().First();
47 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
48 if ( !item
->IsSeparator() )
50 wxWindowID id
= item
->GetId();
51 wxUpdateUIEvent
event(id
);
52 event
.SetEventObject( this );
54 if (evtHandler
->ProcessEvent(event
))
56 if (event
.GetSetText())
57 menu
->SetLabel(id
, event
.GetText());
58 if (event
.GetSetChecked())
59 menu
->Check(id
, event
.GetChecked());
60 if (event
.GetSetEnabled())
61 menu
->Enable(id
, event
.GetEnabled());
64 if (item
->GetSubMenu())
65 DoMenuUpdates(item
->GetSubMenu(), (wxWindow
*) NULL
);