]>
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();
34 int nCount
= bar
->GetMenuCount();
35 for (int n
= 0; n
< nCount
; n
++)
36 DoMenuUpdates(bar
->GetMenu(n
));
40 // update a menu and all submenus recursively
41 void wxFrame::DoMenuUpdates(wxMenu
* menu
)
43 wxNode
* node
= menu
->GetItems().First();
46 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
47 if ( !item
->IsSeparator() )
49 wxWindowID id
= item
->GetId();
50 wxUpdateUIEvent
event(id
);
51 event
.SetEventObject( this );
53 if (GetEventHandler()->ProcessEvent(event
))
55 if (event
.GetSetText())
56 menu
->SetLabel(id
, event
.GetText());
57 if (event
.GetSetChecked())
58 menu
->Check(id
, event
.GetChecked());
59 if (event
.GetSetEnabled())
60 menu
->Enable(id
, event
.GetEnabled());
63 if (item
->GetSubMenu())
64 DoMenuUpdates(item
->GetSubMenu());