]>
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();
32 int nCount
= bar
->GetMenuCount();
33 for (int n
= 0; n
< nCount
; n
++)
34 DoMenuUpdates(bar
->GetMenu(n
));
38 // update a menu and all submenus recursively
39 void wxFrame::DoMenuUpdates(wxMenu
* menu
)
41 wxNode
* node
= menu
->GetItems().First();
44 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
45 if ( !item
->IsSeparator() )
47 wxWindowID id
= item
->GetId();
48 wxUpdateUIEvent
event(id
);
49 event
.SetEventObject( this );
51 if (GetEventHandler()->ProcessEvent(event
))
53 if (event
.GetSetText())
54 menu
->SetLabel(id
, event
.GetText());
55 if (event
.GetSetChecked())
56 menu
->Check(id
, event
.GetChecked());
57 if (event
.GetSetEnabled())
58 menu
->Enable(id
, event
.GetEnabled());
61 if (item
->GetSubMenu())
62 DoMenuUpdates(item
->GetSubMenu());