]>
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"
21 // wxGTK is a special case because it doesn't use the generic wxMenuItem
22 // class, but it's own (already defined in wx/menu.h) one
24 #include "wx/menuitem.h"
27 void wxFrame::OnIdle(wxIdleEvent
& WXUNUSED(event
) )
33 void wxFrame::DoMenuUpdates()
35 wxMenuBar
* bar
= GetMenuBar();
37 int nCount
= bar
->GetMenuCount();
38 for (int n
= 0; n
< nCount
; n
++)
39 DoMenuUpdates(bar
->GetMenu(n
));
43 // update a menu and all submenus recursively
44 void wxFrame::DoMenuUpdates(wxMenu
* menu
)
46 wxNode
* node
= menu
->GetItems().First();
49 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
50 if ( !item
->IsSeparator() )
52 wxWindowID id
= item
->GetId();
53 wxUpdateUIEvent
event(id
);
54 event
.SetEventObject( this );
56 if (GetEventHandler()->ProcessEvent(event
))
58 if (event
.GetSetText())
59 menu
->SetLabel(id
, event
.GetText());
60 if (event
.GetSetChecked())
61 menu
->Check(id
, event
.GetChecked());
62 if (event
.GetSetEnabled())
63 menu
->Enable(id
, event
.GetEnabled());
66 if (item
->GetSubMenu())
67 DoMenuUpdates(item
->GetSubMenu());