]>
git.saurik.com Git - wxWidgets.git/blob - src/common/framecmn.cpp
163b00a160bcd53898ace9095e5e70f9d6f7af60
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 // Process events starting with the window with the focus, if any.
35 wxWindow
* focusWin
= wxFindFocusDescendant(this);
38 int nCount
= bar
->GetMenuCount();
39 for (int n
= 0; n
< nCount
; n
++)
40 DoMenuUpdates(bar
->GetMenu(n
), focusWin
);
44 // update a menu and all submenus recursively
45 void wxFrame::DoMenuUpdates(wxMenu
* menu
, wxWindow
* focusWin
)
47 wxEvtHandler
* evtHandler
= focusWin
? focusWin
->GetEventHandler() : GetEventHandler();
48 wxNode
* node
= menu
->GetItems().First();
51 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
52 if ( !item
->IsSeparator() )
54 wxWindowID id
= item
->GetId();
55 wxUpdateUIEvent
event(id
);
56 event
.SetEventObject( this );
58 if (evtHandler
->ProcessEvent(event
))
60 if (event
.GetSetText())
61 menu
->SetLabel(id
, event
.GetText());
62 if (event
.GetSetChecked())
63 menu
->Check(id
, event
.GetChecked());
64 if (event
.GetSetEnabled())
65 menu
->Enable(id
, event
.GetEnabled());
68 if (item
->GetSubMenu())
69 DoMenuUpdates(item
->GetSubMenu(), focusWin
);