]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/common/framecmn.cpp
Temp. fix for ..\..\zlib problem.
[wxWidgets.git] / src / common / framecmn.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: framecmn.cpp
3// Purpose: common (for all platforms) wxFrame functions
4// Author: Julian Smart, Vadim Zeitlin
5// Created: 01/02/97
6// Id: $Id$
7// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15#pragma hdrstop
16#endif
17
18#include "wx/frame.h"
19#include "wx/menu.h"
20#include "wx/menuitem.h"
21
22#ifndef __WXGTK__
23void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
24{
25 DoMenuUpdates();
26}
27#endif
28
29// update all menus
30void wxFrame::DoMenuUpdates()
31{
32 wxMenuBar* bar = GetMenuBar();
33
34 if ( bar != NULL ) {
35 int nCount = bar->GetMenuCount();
36 for (int n = 0; n < nCount; n++)
37 DoMenuUpdates(bar->GetMenu(n), (wxWindow*) NULL);
38 }
39}
40
41// update a menu and all submenus recursively
42void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* WXUNUSED(focusWin))
43{
44 wxEvtHandler* evtHandler = GetEventHandler();
45 wxNode* node = menu->GetItems().First();
46 while (node)
47 {
48 wxMenuItem* item = (wxMenuItem*) node->Data();
49 if ( !item->IsSeparator() )
50 {
51 wxWindowID id = item->GetId();
52 wxUpdateUIEvent event(id);
53 event.SetEventObject( this );
54
55 if (evtHandler->ProcessEvent(event))
56 {
57 if (event.GetSetText())
58 menu->SetLabel(id, event.GetText());
59 if (event.GetSetChecked())
60 menu->Check(id, event.GetChecked());
61 if (event.GetSetEnabled())
62 menu->Enable(id, event.GetEnabled());
63 }
64
65 if (item->GetSubMenu())
66 DoMenuUpdates(item->GetSubMenu(), (wxWindow*) NULL);
67 }
68 node = node->Next();
69 }
70}