1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMenu, wxMenuBar, wxMenuItem
4 // Author: Julian Smart
5 // Modified by: Vadim Zeitlin
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
21 #pragma implementation "menu.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
38 #include "wx/ownerdrw.h"
41 #include "wx/msw/private.h"
42 #include "wx/msw/menu.h"
43 #include "wx/menuitem.h"
46 // other standard headers
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
53 extern wxMenu
*wxCurrentPopupMenu
;
55 // ----------------------------------------------------------------------------
57 // ----------------------------------------------------------------------------
59 // the (popup) menu title has this special id
60 static const int idMenuTitle
= -2;
62 // ----------------------------------------------------------------------------
64 // ----------------------------------------------------------------------------
66 #if !USE_SHARED_LIBRARY
67 IMPLEMENT_DYNAMIC_CLASS(wxMenu
, wxEvtHandler
)
68 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar
, wxEvtHandler
)
72 #define GetHMENU() ((HMENU)GetHMenu())
73 #define GetHMenuOf(menu) ((HMENU)menu->GetHMenu())
75 // ============================================================================
77 // ============================================================================
79 // ---------------------------------------------------------------------------
80 // wxMenu construction, adding and removing menu items
81 // ---------------------------------------------------------------------------
83 // Construct a menu with optional title (then use append)
84 wxMenu::wxMenu(const wxString
& title
, const wxFunction func
)
88 m_eventHandler
= this;
89 m_pInvokingWindow
= NULL
;
93 m_hMenu
= (WXHMENU
) CreatePopupMenu();
95 m_topLevelMenu
= this;
96 m_clientData
= (void*) NULL
;
100 Append(idMenuTitle
, m_title
) ;
104 #if WXWIN_COMPATIBILITY
109 // The wxWindow destructor will take care of deleting the submenus.
112 // free Windows resources
115 ::DestroyMenu((HMENU
)m_hMenu
);
120 wxNode
*node
= m_menuItems
.First();
123 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
125 // Delete child menus.
126 // Beware: they must not be appended to children list!!!
127 // (because order of delete is significant)
128 if ( item
->IsSubMenu() )
129 item
->DeleteSubMenu();
131 wxNode
*next
= node
->Next();
143 // function appends a new item or submenu to the menu
144 void wxMenu::Append(wxMenuItem
*pItem
)
146 wxCHECK_RET( pItem
!= NULL
, "can't append NULL item to the menu" );
150 // if "Break" has just been called, insert a menu break before this item
151 // (and don't forget to reset the flag)
153 flags
|= MF_MENUBREAK
;
157 if ( pItem
->IsSeparator() ) {
158 flags
|= MF_SEPARATOR
;
161 // id is the numeric id for normal menu items and HMENU for submenus as
162 // required by ::AppendMenu() API
164 wxMenu
*submenu
= pItem
->GetSubMenu();
165 if ( submenu
!= NULL
) {
166 wxASSERT( submenu
->GetHMenu() != (WXHMENU
) NULL
);
168 id
= (UINT
)submenu
->GetHMenu();
169 submenu
->m_topLevelMenu
= m_topLevelMenu
;
170 submenu
->m_parent
= this;
171 submenu
->m_savehMenu
= (WXHMENU
)id
;
172 submenu
->m_hMenu
= 0;
182 #if wxUSE_OWNER_DRAWN
183 if ( pItem
->IsOwnerDrawn() ) { // want to get {Measure|Draw}Item messages?
184 // item draws itself, pass pointer to it in data parameter
185 flags
|= MF_OWNERDRAW
;
186 pData
= (LPCSTR
)pItem
;
191 // menu is just a normal string (passed in data parameter)
193 pData
= pItem
->GetName();
196 // visually select the menu title
197 if ( id
== idMenuTitle
)
199 // TODO use SetMenuItemInfo(MFS_DEFAULT) to put it in bold face
202 if ( !::AppendMenu(GetHMENU(), flags
, id
, pData
) )
204 wxLogLastError("AppendMenu");
208 m_menuItems
.Append(pItem
);
213 void wxMenu::AppendSeparator()
215 Append(new wxMenuItem(this, ID_SEPARATOR
));
219 void wxMenu::Append(int id
,
220 const wxString
& label
,
222 const wxString
& helpString
)
224 Append(new wxMenuItem(this, id
, label
, helpString
, FALSE
, SubMenu
));
227 // Ordinary menu item
228 void wxMenu::Append(int id
,
229 const wxString
& label
,
230 const wxString
& helpString
,
233 // 'checkable' parameter is useless for Windows.
234 Append(new wxMenuItem(this, id
, label
, helpString
, checkable
));
238 void wxMenu::Delete(int id
)
240 wxMenuItem
*item
= NULL
;
243 for (pos
= 0, node
= m_menuItems
.First(); node
; node
= node
->Next(), pos
++)
245 item
= (wxMenuItem
*)node
->Data();
246 if ( item
->GetId() == id
)
250 wxCHECK_RET( node
, "wxMenu::Delete(): item doesn't exist" );
252 HMENU menu
= GetHMENU();
254 wxMenu
*pSubMenu
= item
->GetSubMenu();
255 if ( pSubMenu
!= NULL
) {
256 RemoveMenu(menu
, (UINT
)pos
, MF_BYPOSITION
);
257 pSubMenu
->m_hMenu
= pSubMenu
->m_savehMenu
;
258 pSubMenu
->m_savehMenu
= 0;
259 pSubMenu
->m_parent
= NULL
;
260 // RemoveChild(item->subMenu);
261 pSubMenu
->m_topLevelMenu
= NULL
;
262 // TODO: Why isn't subMenu deleted here???
263 // Will put this in for now. Assuming this is supposed
264 // to delete the menu, not just remove it.
265 item
->DeleteSubMenu();
268 DeleteMenu(menu
, (UINT
)pos
, MF_BYPOSITION
);
271 m_menuItems
.DeleteNode(node
);
275 // ---------------------------------------------------------------------------
276 // wxMenu functions implemented in wxMenuItem
277 // ---------------------------------------------------------------------------
279 void wxMenu::Enable(int id
, bool Flag
)
281 wxMenuItem
*item
= FindItemForId(id
);
282 wxCHECK_RET( item
!= NULL
, "can't enable non-existing menu item" );
287 bool wxMenu::IsEnabled(int id
) const
289 wxMenuItem
*item
= FindItemForId(id
);
290 wxCHECK_MSG( item
!= NULL
, FALSE
, "invalid item id" );
292 return item
->IsEnabled();
295 void wxMenu::Check(int id
, bool Flag
)
297 wxMenuItem
*item
= FindItemForId(id
);
298 wxCHECK_RET( item
!= NULL
, "can't get status of non-existing menu item" );
303 bool wxMenu::IsChecked(int id
) const
305 wxMenuItem
*item
= FindItemForId(id
);
306 wxCHECK_MSG( item
!= NULL
, FALSE
, "invalid item id" );
308 return item
->IsChecked();
311 void wxMenu::SetLabel(int id
, const wxString
& label
)
313 wxMenuItem
*item
= FindItemForId(id
) ;
314 wxCHECK_RET( item
, "wxMenu::SetLabel: no such item" );
316 item
->SetName(label
);
319 wxString
wxMenu::GetLabel(int id
) const
322 wxMenuItem
*pItem
= FindItemForId(id
) ;
324 label
= pItem
->GetName() ;
326 wxFAIL_MSG("wxMenu::GetLabel: item doesn't exist");
331 void wxMenu::SetHelpString(int itemId
, const wxString
& helpString
)
333 wxMenuItem
*item
= FindItemForId (itemId
);
335 item
->SetHelp(helpString
);
337 wxFAIL_MSG("wxMenu::SetHelpString: item doesn't exist");
340 wxString
wxMenu::GetHelpString (int itemId
) const
343 wxMenuItem
*item
= FindItemForId (itemId
);
345 help
= item
->GetHelp();
347 wxFAIL_MSG("wxMenu::GetHelpString: item doesn't exist");
352 // ---------------------------------------------------------------------------
354 // ---------------------------------------------------------------------------
356 void wxMenu::SetTitle(const wxString
& label
)
358 bool hasNoTitle
= m_title
.IsEmpty();
361 HMENU hMenu
= GetHMENU();
365 if ( !label
.IsEmpty() )
367 if ( !InsertMenu(hMenu
, 0u, MF_BYPOSITION
| MF_STRING
,
368 (unsigned)idMenuTitle
, m_title
) ||
369 !InsertMenu(hMenu
, 1u, MF_BYPOSITION
, (unsigned)-1, NULL
) )
371 wxLogLastError("InsertMenu");
377 if ( label
.IsEmpty() )
379 // remove the title and the separator after it
380 if ( !RemoveMenu(hMenu
, 0, MF_BYPOSITION
) ||
381 !RemoveMenu(hMenu
, 0, MF_BYPOSITION
) )
383 wxLogLastError("RemoveMenu");
389 if ( !ModifyMenu(hMenu
, 0u,
390 MF_BYPOSITION
| MF_STRING
,
391 (unsigned)idMenuTitle
, m_title
) )
393 wxLogLastError("ModifyMenu");
399 // put the title string in bold face
400 if ( !m_title
.IsEmpty() )
403 mii
.cbSize
= sizeof(mii
);
404 mii
.fMask
= MIIM_STATE
;
405 mii
.fState
= MFS_DEFAULT
;
407 if ( !SetMenuItemInfo(hMenu
, (unsigned)idMenuTitle
, FALSE
, &mii
) )
409 wxLogLastError("SetMenuItemInfo");
415 const wxString
wxMenu::GetTitle() const
420 // ---------------------------------------------------------------------------
422 // ---------------------------------------------------------------------------
424 bool wxMenu::MSWCommand(WXUINT
WXUNUSED(param
), WXWORD id
)
426 // ignore commands from the menu title
428 // NB: VC++ generates wrong assembler for `if ( id != idMenuTitle )'!!
429 if ( id
!= (WXWORD
)idMenuTitle
)
431 wxCommandEvent
event(wxEVT_COMMAND_MENU_SELECTED
);
432 event
.SetEventObject( this );
435 ProcessCommand(event
);
441 void wxMenu::ProcessCommand(wxCommandEvent
& event
)
443 bool processed
= FALSE
;
448 (void)(*(m_callback
))(*this, event
);
452 // Try the menu's event handler
453 if ( !processed
&& GetEventHandler())
455 processed
= GetEventHandler()->ProcessEvent(event
);
458 // Try the window the menu was popped up from (and up through the
460 wxWindow
*win
= GetInvokingWindow();
461 if ( !processed
&& win
)
462 processed
= win
->GetEventHandler()->ProcessEvent(event
);
465 // ---------------------------------------------------------------------------
467 // ---------------------------------------------------------------------------
469 // Finds the item id matching the given string, -1 if not found.
470 int wxMenu::FindItem (const wxString
& itemString
) const
472 // FIXME fixed size buffer
473 wxString itemLabel
= wxStripMenuCodes(itemString
);
474 for ( wxNode
*node
= m_menuItems
.First(); node
; node
= node
->Next() )
476 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
477 if ( item
->IsSubMenu() )
479 int ans
= item
->GetSubMenu()->FindItem(itemString
);
480 if ( ans
!= wxNOT_FOUND
)
483 else if ( !item
->IsSeparator() )
485 wxString label
= wxStripMenuCodes(item
->GetName());
486 if ( itemLabel
== label
)
487 return item
->GetId();
494 wxMenuItem
*wxMenu::FindItemForId(int itemId
, wxMenu
** itemMenu
) const
499 wxMenuItem
*item
= NULL
;
500 for ( wxNode
*node
= m_menuItems
.First(); node
; node
= node
->Next() )
502 item
= (wxMenuItem
*)node
->Data();
504 if ( item
->GetId() == itemId
)
507 *itemMenu
= (wxMenu
*)this;
510 else if ( item
->IsSubMenu() )
512 item
= item
->GetSubMenu()->FindItemForId(itemId
, itemMenu
);
521 // ---------------------------------------------------------------------------
523 // ---------------------------------------------------------------------------
525 bool wxWindow::PopupMenu(wxMenu
*menu
, int x
, int y
)
527 menu
->SetInvokingWindow(this);
530 HWND hWnd
= (HWND
) GetHWND();
531 HMENU hMenu
= (HMENU
)menu
->GetHMenu();
535 ::ClientToScreen(hWnd
, &point
);
536 wxCurrentPopupMenu
= menu
;
537 ::TrackPopupMenu(hMenu
, TPM_RIGHTBUTTON
, point
.x
, point
.y
, 0, hWnd
, NULL
);
539 wxCurrentPopupMenu
= NULL
;
541 menu
->SetInvokingWindow(NULL
);
546 void wxMenu::Attach(wxMenuBar
*menubar
)
548 // menu can be in at most one menubar because otherwise they would both
549 // delete the menu pointer
550 wxASSERT_MSG( !m_menuBar
, "menu belongs to 2 menubars, expect a crash" );
553 m_savehMenu
= m_hMenu
;
557 void wxMenu::Detach()
559 wxASSERT_MSG( m_menuBar
, "can't detach menu if it's not attached" );
561 m_hMenu
= m_savehMenu
;
565 // ---------------------------------------------------------------------------
567 // ---------------------------------------------------------------------------
569 void wxMenuBar::Init()
571 m_eventHandler
= this;
575 m_menuBarFrame
= NULL
;
579 wxMenuBar::wxMenuBar()
584 wxMenuBar::wxMenuBar( long WXUNUSED(style
) )
589 wxMenuBar::wxMenuBar(int count
, wxMenu
*menus
[], const wxString titles
[])
595 m_titles
= new wxString
[count
];
598 for ( i
= 0; i
< count
; i
++ )
599 m_titles
[i
] = titles
[i
];
601 for ( i
= 0; i
< count
; i
++ )
602 m_menus
[i
]->Attach(this);
605 wxMenuBar::~wxMenuBar()
607 for ( int i
= 0; i
< m_menuCount
; i
++ )
616 // ---------------------------------------------------------------------------
618 // ---------------------------------------------------------------------------
620 void wxMenuBar::Refresh()
622 wxCHECK_RET( m_menuBarFrame
, "can't refresh a menubar withotu a frame" );
624 DrawMenuBar((HWND
)m_menuBarFrame
->GetHWND()) ;
627 WXHMENU
wxMenuBar::Create()
629 wxCHECK_MSG( !m_hMenu
, TRUE
, "menubar already created" );
631 m_hMenu
= (WXHMENU
)::CreateMenu();
635 wxLogLastError("CreateMenu");
639 for ( int i
= 0; i
< m_menuCount
; i
++ )
641 if ( !::AppendMenu((HMENU
)m_hMenu
, MF_POPUP
| MF_STRING
,
642 (UINT
)m_menus
[i
]->GetHMenu(),
645 wxLogLastError("AppendMenu");
653 // ---------------------------------------------------------------------------
654 // wxMenuBar functions forwarded to wxMenuItem
655 // ---------------------------------------------------------------------------
657 // Must only be used AFTER menu has been attached to frame,
658 // otherwise use individual menus to enable/disable items
659 void wxMenuBar::Enable(int id
, bool enable
)
661 wxMenu
*itemMenu
= NULL
;
662 wxMenuItem
*item
= FindItemForId(id
, &itemMenu
) ;
664 wxCHECK_RET( item
, "attempt to enable an item which doesn't exist" );
666 item
->Enable(enable
);
669 void wxMenuBar::EnableTop(int pos
, bool enable
)
671 int flag
= enable
? MF_ENABLED
: MF_GRAYED
;;
673 EnableMenuItem((HMENU
)m_hMenu
, pos
, MF_BYPOSITION
| flag
);
676 // Must only be used AFTER menu has been attached to frame,
677 // otherwise use individual menus
678 void wxMenuBar::Check(int id
, bool check
)
680 wxMenu
*itemMenu
= NULL
;
681 wxMenuItem
*item
= FindItemForId(id
, &itemMenu
) ;
683 wxCHECK_RET( item
, "attempt to check an item which doesn't exist" );
684 wxCHECK_RET( item
->IsCheckable(), "attempt to check an uncheckable item" );
689 bool wxMenuBar::IsChecked(int id
) const
691 wxMenu
*itemMenu
= NULL
;
692 wxMenuItem
*item
= FindItemForId(id
, &itemMenu
) ;
694 wxCHECK_MSG( item
, FALSE
, "wxMenuBar::IsChecked(): no such item" );
696 int flag
= ::GetMenuState(GetHMenuOf(itemMenu
), id
, MF_BYCOMMAND
);
698 return (flag
& MF_CHECKED
) != 0;
701 bool wxMenuBar::IsEnabled(int id
) const
703 wxMenu
*itemMenu
= NULL
;
704 wxMenuItem
*item
= FindItemForId(id
, &itemMenu
) ;
706 wxCHECK_MSG( item
, FALSE
, "wxMenuBar::IsEnabled(): no such item" );
708 int flag
= ::GetMenuState(GetHMenuOf(itemMenu
), id
, MF_BYCOMMAND
) ;
710 return (flag
& MF_ENABLED
) != 0;
713 void wxMenuBar::SetLabel(int id
, const wxString
& label
)
715 wxMenu
*itemMenu
= NULL
;
716 wxMenuItem
*item
= FindItemForId(id
, &itemMenu
) ;
718 wxCHECK_RET( item
, "wxMenuBar::SetLabel(): no such item" );
720 item
->SetName(label
);
723 wxString
wxMenuBar::GetLabel(int id
) const
725 wxMenu
*itemMenu
= NULL
;
726 wxMenuItem
*item
= FindItemForId(id
, &itemMenu
) ;
728 wxCHECK_MSG( item
, "", "wxMenuBar::GetLabel(): no such item" );
730 return item
->GetName();
733 void wxMenuBar::SetHelpString (int id
, const wxString
& helpString
)
735 wxMenu
*itemMenu
= NULL
;
736 wxMenuItem
*item
= FindItemForId(id
, &itemMenu
) ;
738 wxCHECK_RET( item
, "wxMenuBar::SetHelpString(): no such item" );
740 item
->SetHelp(helpString
);
743 wxString
wxMenuBar::GetHelpString (int id
) const
745 wxMenu
*itemMenu
= NULL
;
746 wxMenuItem
*item
= FindItemForId(id
, &itemMenu
) ;
748 wxCHECK_MSG( item
, "", "wxMenuBar::GetHelpString(): no such item" );
750 return item
->GetHelp();
753 // ---------------------------------------------------------------------------
754 // wxMenuBar functions to work with the top level submenus
755 // ---------------------------------------------------------------------------
757 // NB: we don't support owner drawn top level items for now, if we do these
758 // functions would have to be changed to use wxMenuItem as well
760 void wxMenuBar::SetLabelTop(int pos
, const wxString
& label
)
763 UINT flagsOld
= ::GetMenuState((HMENU
)m_hMenu
, pos
, MF_BYPOSITION
);
764 if ( flagsOld
== 0xFFFFFFFF )
766 wxLogLastError("GetMenuState");
771 if ( flagsOld
& MF_POPUP
)
773 // HIBYTE contains the number of items in the submenu in this case
775 id
= (UINT
)::GetSubMenu((HMENU
)m_hMenu
, pos
) ;
782 if ( ::ModifyMenu(GetHMENU(), pos
, MF_BYPOSITION
| MF_STRING
| flagsOld
,
783 id
, label
) == 0xFFFFFFFF )
785 wxLogLastError("ModifyMenu");
789 wxString
wxMenuBar::GetLabelTop(int pos
) const
791 int len
= ::GetMenuString((HMENU
)m_hMenu
, pos
, NULL
, 0, MF_BYCOMMAND
);
793 len
++; // for the NUL character
795 ::GetMenuString(GetHMENU(), pos
, label
.GetWriteBuf(len
), len
, MF_BYCOMMAND
);
796 label
.UngetWriteBuf();
801 // ---------------------------------------------------------------------------
802 // wxMenuBar notifications
803 // ---------------------------------------------------------------------------
805 bool wxMenuBar::OnDelete(wxMenu
*a_menu
, int pos
)
807 if ( !m_menuBarFrame
)
810 if ( ::RemoveMenu((HMENU
)m_hMenu
, (UINT
)pos
, MF_BYPOSITION
) )
812 // VZ: I'm not sure about what's going on here, so I leave an assert
813 wxASSERT_MSG( m_menus
[pos
] == a_menu
, "what is this parameter for??" );
817 if ( m_menuBarFrame
)
824 wxLogLastError("RemoveMenu");
830 bool wxMenuBar::OnAppend(wxMenu
*a_menu
, const char *title
)
832 WXHMENU submenu
= a_menu
->GetHMenu();
836 if ( !m_menuBarFrame
)
839 a_menu
->Attach(this);
841 if ( !::AppendMenu(GetHMENU(), MF_POPUP
| MF_STRING
,
842 (UINT
)submenu
, title
) )
844 wxLogLastError("AppendMenu");
852 // ---------------------------------------------------------------------------
853 // wxMenuBar construction
854 // ---------------------------------------------------------------------------
856 void wxMenuBar::Append (wxMenu
* menu
, const wxString
& title
)
858 if (!OnAppend(menu
, title
))
862 wxMenu
**new_menus
= new wxMenu
*[m_menuCount
];
863 wxString
*new_titles
= new wxString
[m_menuCount
];
866 for (i
= 0; i
< m_menuCount
- 1; i
++)
868 new_menus
[i
] = m_menus
[i
];
870 new_titles
[i
] = m_titles
[i
];
879 m_titles
= new_titles
;
881 m_menus
[m_menuCount
- 1] = (wxMenu
*)menu
;
882 m_titles
[m_menuCount
- 1] = title
;
884 menu
->SetParent(this);
887 void wxMenuBar::Delete(wxMenu
* menu
, int i
)
893 for (ii
= 0; ii
< m_menuCount
; ii
++) {
894 if (m_menus
[ii
] == menu
)
897 if (ii
>= m_menuCount
)
900 if (ii
< 0 || ii
>= m_menuCount
)
905 if (!OnDelete(menu
, ii
))
908 menu
->SetParent(NULL
);
911 for (j
= ii
; j
< m_menuCount
; j
++) {
912 m_menus
[j
] = m_menus
[j
+ 1];
913 m_titles
[j
] = m_titles
[j
+ 1];
917 // ---------------------------------------------------------------------------
918 // wxMenuBar searching for menu items
919 // ---------------------------------------------------------------------------
921 // Find the itemString in menuString, and return the item id or wxNOT_FOUND
922 int wxMenuBar::FindMenuItem(const wxString
& menuString
,
923 const wxString
& itemString
) const
925 wxString menuLabel
= wxStripMenuCodes(menuString
);
926 for ( int i
= 0; i
< m_menuCount
; i
++ )
928 wxString title
= wxStripMenuCodes(m_titles
[i
]);
929 if ( menuString
== title
)
930 return m_menus
[i
]->FindItem(itemString
);
936 wxMenuItem
*wxMenuBar::FindItemForId (int id
, wxMenu
**itemMenu
) const
941 wxMenuItem
*item
= NULL
;
942 for ( int i
= 0; !item
&& (i
< m_menuCount
); i
++ )
944 item
= m_menus
[i
]->FindItemForId(id
, itemMenu
);
951 // ----------------------------------------------------------------------------
953 // ----------------------------------------------------------------------------
955 wxWindow
*wxMenu::GetWindow() const
957 if ( m_pInvokingWindow
!= NULL
)
958 return m_pInvokingWindow
;
959 else if ( m_menuBar
!= NULL
)
960 return m_menuBar
->GetFrame();
965 WXHMENU
wxMenu::GetHMenu() const
969 else if ( m_savehMenu
!= 0 )
972 wxFAIL_MSG("wxMenu without HMENU");
977 // Update a menu and all submenus recursively. source is the object that has
978 // the update event handlers defined for it. If NULL, the menu or associated
979 // window will be used.
980 void wxMenu::UpdateUI(wxEvtHandler
* source
)
982 if (!source
&& GetInvokingWindow())
983 source
= GetInvokingWindow()->GetEventHandler();
985 source
= GetEventHandler();
989 wxNode
* node
= GetItems().First();
992 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
993 if ( !item
->IsSeparator() )
995 wxWindowID id
= item
->GetId();
996 wxUpdateUIEvent
event(id
);
997 event
.SetEventObject( source
);
999 if (source
->ProcessEvent(event
))
1001 if (event
.GetSetText())
1002 SetLabel(id
, event
.GetText());
1003 if (event
.GetSetChecked())
1004 Check(id
, event
.GetChecked());
1005 if (event
.GetSetEnabled())
1006 Enable(id
, event
.GetEnabled());
1009 if (item
->GetSubMenu())
1010 item
->GetSubMenu()->UpdateUI(source
);
1012 node
= node
->Next();