1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "menu.h"
12 #pragma implementation "menuitem.h"
23 //-----------------------------------------------------------------------------
25 //-----------------------------------------------------------------------------
27 extern void wxapp_install_idle_handler();
30 //-----------------------------------------------------------------------------
32 //-----------------------------------------------------------------------------
34 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar
,wxWindow
)
36 wxMenuBar::wxMenuBar( long style
)
38 /* the parent window is known after wxFrame::SetMenu() */
41 PreCreation( (wxWindow
*) NULL
, -1, wxDefaultPosition
, wxDefaultSize
, style
, "menu" );
43 m_menus
.DeleteContents( TRUE
);
45 /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
46 #if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
47 m_accel
= gtk_accel_group_new();
48 m_factory
= gtk_item_factory_new( GTK_TYPE_MENU_BAR
, "<main>", m_accel
);
49 m_menubar
= gtk_item_factory_get_widget( m_factory
, "<main>" );
51 m_menubar
= gtk_menu_bar_new();
54 if (style
& wxMB_DOCKABLE
)
56 m_widget
= gtk_handle_box_new();
57 gtk_container_add( GTK_CONTAINER(m_widget
), GTK_WIDGET(m_menubar
) );
58 gtk_widget_show( GTK_WIDGET(m_menubar
) );
62 m_widget
= GTK_WIDGET(m_menubar
);
70 wxMenuBar::wxMenuBar()
72 /* the parent window is known after wxFrame::SetMenu() */
75 PreCreation( (wxWindow
*) NULL
, -1, wxDefaultPosition
, wxDefaultSize
, 0, "menu" );
77 m_menus
.DeleteContents( TRUE
);
79 /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
80 #if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
81 m_accel
= gtk_accel_group_new();
82 m_factory
= gtk_item_factory_new( GTK_TYPE_MENU_BAR
, "<main>", m_accel
);
83 m_menubar
= gtk_item_factory_get_widget( m_factory
, "<main>" );
85 m_menubar
= gtk_menu_bar_new();
88 m_widget
= GTK_WIDGET(m_menubar
);
95 wxMenuBar::~wxMenuBar()
97 // how to destroy a GtkItemFactory ?
100 void wxMenuBar::Append( wxMenu
*menu
, const wxString
&title
)
102 m_menus
.Append( menu
);
104 /* GTK 1.2 wants to have "_" instead of "&" for accelerators */
106 for ( const wxChar
*pc
= title
; *pc
!= _T('\0'); pc
++ )
110 #if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
118 /* this doesn't have much effect right now */
119 menu
->SetTitle( str
);
121 /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
122 #if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
124 /* local buffer in multibyte form */
127 strcat( buf
, str
.mb_str() );
129 GtkItemFactoryEntry entry
;
131 entry
.accelerator
= (gchar
*) NULL
;
132 entry
.callback
= (GtkItemFactoryCallback
) NULL
;
133 entry
.callback_action
= 0;
134 entry
.item_type
= "<Branch>";
136 gtk_item_factory_create_item( m_factory
, &entry
, (gpointer
) this, 2 ); /* what is 2 ? */
138 /* in order to get the pointer to the item we need the item text _without_ underscores */
139 wxString tmp
= _T("<main>/");
140 for ( const wxChar
*pc
= str
; *pc
!= _T('\0'); pc
++ )
142 if (*pc
== _T('_')) pc
++; /* skip it */
146 menu
->m_owner
= gtk_item_factory_get_item( m_factory
, tmp
.mb_str() );
148 gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu
->m_owner
), menu
->m_menu
);
152 menu
->m_owner
= gtk_menu_item_new_with_label( str
.mb_str() );
153 gtk_widget_show( menu
->m_owner
);
154 gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu
->m_owner
), menu
->m_menu
);
156 gtk_menu_bar_append( GTK_MENU_BAR(m_menubar
), menu
->m_owner
);
161 static int FindMenuItemRecursive( const wxMenu
*menu
, const wxString
&menuString
, const wxString
&itemString
)
163 if (menu
->GetTitle() == menuString
)
165 int res
= menu
->FindItem( itemString
);
166 if (res
!= wxNOT_FOUND
)
170 wxNode
*node
= ((wxMenu
*)menu
)->GetItems().First(); // const_cast
173 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
174 if (item
->IsSubMenu())
175 return FindMenuItemRecursive(item
->GetSubMenu(), menuString
, itemString
);
183 wxMenuItem
*wxMenuBar::FindItemForId(int itemId
, wxMenu
**menuForItem
= NULL
) const
187 // TODO return the pointer to the menu
192 return FindItem(itemId
);
195 int wxMenuBar::FindMenuItem( const wxString
&menuString
, const wxString
&itemString
) const
197 wxNode
*node
= m_menus
.First();
200 wxMenu
*menu
= (wxMenu
*)node
->Data();
201 int res
= FindMenuItemRecursive( menu
, menuString
, itemString
);
202 if (res
!= -1) return res
;
208 // Find a wxMenuItem using its id. Recurses down into sub-menus
209 static wxMenuItem
* FindMenuItemByIdRecursive(const wxMenu
* menu
, int id
)
211 wxMenuItem
* result
= menu
->FindItem(id
);
213 wxNode
*node
= ((wxMenu
*)menu
)->GetItems().First(); // const_cast
214 while ( node
&& result
== NULL
)
216 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
217 if (item
->IsSubMenu())
219 result
= FindMenuItemByIdRecursive( item
->GetSubMenu(), id
);
227 wxMenuItem
* wxMenuBar::FindItem( int id
) const
229 wxMenuItem
* result
= 0;
230 wxNode
*node
= m_menus
.First();
231 while (node
&& result
== 0)
233 wxMenu
*menu
= (wxMenu
*)node
->Data();
234 result
= FindMenuItemByIdRecursive( menu
, id
);
241 void wxMenuBar::Check( int id
, bool check
)
243 wxMenuItem
* item
= FindMenuItemById( id
);
245 wxCHECK_RET( item
, _T("wxMenuBar::Check: no such item") );
250 bool wxMenuBar::IsChecked( int id
) const
252 wxMenuItem
* item
= FindMenuItemById( id
);
254 wxCHECK_MSG( item
, FALSE
, _T("wxMenuBar::IsChecked: no such item") );
256 return item
->IsChecked();
259 void wxMenuBar::Enable( int id
, bool enable
)
261 wxMenuItem
* item
= FindMenuItemById( id
);
263 wxCHECK_RET( item
, _T("wxMenuBar::Enable: no such item") );
265 item
->Enable(enable
);
268 bool wxMenuBar::IsEnabled( int id
) const
270 wxMenuItem
* item
= FindMenuItemById( id
);
272 wxCHECK_MSG( item
, FALSE
, _T("wxMenuBar::IsEnabled: no such item") );
274 return item
->IsEnabled();
277 wxString
wxMenuBar::GetLabel( int id
) const
279 wxMenuItem
* item
= FindMenuItemById( id
);
281 wxCHECK_MSG( item
, _T(""), _T("wxMenuBar::GetLabel: no such item") );
283 return item
->GetText();
286 void wxMenuBar::SetLabel( int id
, const wxString
&label
)
288 wxMenuItem
* item
= FindMenuItemById( id
);
290 wxCHECK_RET( item
, _T("wxMenuBar::SetLabel: no such item") );
292 item
->SetText( label
);
295 void wxMenuBar::EnableTop( int pos
, bool flag
)
297 wxNode
*node
= m_menus
.Nth( pos
);
299 wxCHECK_RET( node
, _T("menu not found") );
301 wxMenu
* menu
= (wxMenu
*)node
->Data();
304 gtk_widget_set_sensitive( menu
->m_owner
, flag
);
307 wxString
wxMenuBar::GetLabelTop( int pos
) const
309 wxNode
*node
= m_menus
.Nth( pos
);
311 wxCHECK_MSG( node
, _T("invalid"), _T("menu not found") );
313 wxMenu
* menu
= (wxMenu
*)node
->Data();
315 return menu
->GetTitle();
318 void wxMenuBar::SetLabelTop( int pos
, const wxString
& label
)
320 wxNode
*node
= m_menus
.Nth( pos
);
322 wxCHECK_RET( node
, _T("menu not found") );
324 wxMenu
* menu
= (wxMenu
*)node
->Data();
326 menu
->SetTitle( label
);
329 void wxMenuBar::SetHelpString( int id
, const wxString
& helpString
)
331 wxMenuItem
* item
= FindMenuItemById( id
);
333 wxCHECK_RET( item
, _T("wxMenuBar::SetHelpString: no such item") );
335 item
->SetHelp( helpString
);
338 wxString
wxMenuBar::GetHelpString( int id
) const
340 wxMenuItem
* item
= FindMenuItemById( id
);
342 wxCHECK_MSG( item
, _T(""), _T("wxMenuBar::GetHelpString: no such item") );
344 return item
->GetHelp();
347 //-----------------------------------------------------------------------------
349 //-----------------------------------------------------------------------------
351 static void gtk_menu_clicked_callback( GtkWidget
*widget
, wxMenu
*menu
)
353 if (g_isIdle
) wxapp_install_idle_handler();
355 int id
= menu
->FindMenuIdByMenuItem(widget
);
357 /* should find it for normal (not popup) menu */
358 wxASSERT( (id
!= -1) || (menu
->GetInvokingWindow() != NULL
) );
360 if (!menu
->IsEnabled(id
))
363 wxMenuItem
* item
= menu
->FindItem( id
);
364 wxCHECK_RET( item
, _T("error in menu item callback") );
366 if (item
->IsCheckable())
368 if (item
->GetCheckedFlag() == item
->IsChecked())
370 /* the menu item has been checked by calling wxMenuItem->Check() */
375 /* the user pressed on the menu item -> report */
376 item
->SetCheckedFlag(item
->IsChecked()); /* make consistent again */
380 wxCommandEvent
event( wxEVT_COMMAND_MENU_SELECTED
, id
);
381 event
.SetEventObject( menu
);
384 if (menu
->GetCallback())
386 (void) (*(menu
->GetCallback())) (*menu
, event
);
390 if (menu
->GetEventHandler()->ProcessEvent(event
))
393 wxWindow
*win
= menu
->GetInvokingWindow();
395 win
->GetEventHandler()->ProcessEvent( event
);
398 //-----------------------------------------------------------------------------
400 //-----------------------------------------------------------------------------
402 static void gtk_menu_hilight_callback( GtkWidget
*widget
, wxMenu
*menu
)
404 if (g_isIdle
) wxapp_install_idle_handler();
406 int id
= menu
->FindMenuIdByMenuItem(widget
);
408 wxASSERT( id
!= -1 ); // should find it!
410 if (!menu
->IsEnabled(id
))
413 wxMenuEvent
event( wxEVT_MENU_HIGHLIGHT
, id
);
414 event
.SetEventObject( menu
);
416 /* wxMSW doesn't call callback here either
418 if (menu->m_callback)
420 (void) (*(menu->m_callback)) (*menu, event);
425 if (menu
->GetEventHandler()->ProcessEvent(event
))
428 wxWindow
*win
= menu
->GetInvokingWindow();
429 if (win
) win
->GetEventHandler()->ProcessEvent( event
);
432 //-----------------------------------------------------------------------------
434 //-----------------------------------------------------------------------------
436 static void gtk_menu_nolight_callback( GtkWidget
*widget
, wxMenu
*menu
)
438 if (g_isIdle
) wxapp_install_idle_handler();
440 int id
= menu
->FindMenuIdByMenuItem(widget
);
442 wxASSERT( id
!= -1 ); // should find it!
444 if (!menu
->IsEnabled(id
))
447 wxMenuEvent
event( wxEVT_MENU_HIGHLIGHT
, -1 );
448 event
.SetEventObject( menu
);
450 if (menu
->GetEventHandler()->ProcessEvent(event
))
453 wxWindow
*win
= menu
->GetInvokingWindow();
455 win
->GetEventHandler()->ProcessEvent( event
);
458 //-----------------------------------------------------------------------------
460 //-----------------------------------------------------------------------------
462 IMPLEMENT_DYNAMIC_CLASS(wxMenuItem
,wxObject
)
464 wxMenuItem::wxMenuItem()
467 m_isCheckMenu
= FALSE
;
470 m_subMenu
= (wxMenu
*) NULL
;
471 m_menuItem
= (GtkWidget
*) NULL
;
474 // it's valid for this function to be called even if m_menuItem == NULL
475 void wxMenuItem::SetName( const wxString
& str
)
478 for ( const wxChar
*pc
= str
; *pc
!= _T('\0'); pc
++ )
482 #if (GTK_MINOR_VERSION > 0)
492 GtkLabel
*label
= GTK_LABEL( GTK_BIN(m_menuItem
)->child
);
493 gtk_label_set( label
, m_text
.mb_str());
497 void wxMenuItem::Check( bool check
)
499 wxCHECK_RET( m_menuItem
, _T("invalid menu item") );
501 wxCHECK_RET( IsCheckable(), _T("Can't check uncheckable item!") )
503 if (check
== m_isChecked
) return;
506 gtk_check_menu_item_set_state( (GtkCheckMenuItem
*)m_menuItem
, (gint
)check
);
509 void wxMenuItem::Enable( bool enable
)
511 wxCHECK_RET( m_menuItem
, _T("invalid menu item") );
513 gtk_widget_set_sensitive( m_menuItem
, enable
);
514 m_isEnabled
= enable
;
517 bool wxMenuItem::IsChecked() const
519 wxCHECK_MSG( m_menuItem
, FALSE
, _T("invalid menu item") );
521 wxCHECK( IsCheckable(), FALSE
); // can't get state of uncheckable item!
523 bool bIsChecked
= ((GtkCheckMenuItem
*)m_menuItem
)->active
!= 0;
528 //-----------------------------------------------------------------------------
530 //-----------------------------------------------------------------------------
532 IMPLEMENT_DYNAMIC_CLASS(wxMenu
,wxEvtHandler
)
534 wxMenu::wxMenu( const wxString
& title
, const wxFunction func
)
537 m_items
.DeleteContents( TRUE
);
538 m_invokingWindow
= (wxWindow
*) NULL
;
540 #if (GTK_MINOR_VERSION > 0)
541 m_accel
= gtk_accel_group_new();
542 m_factory
= gtk_item_factory_new( GTK_TYPE_MENU
, "<main>", m_accel
);
543 m_menu
= gtk_item_factory_get_widget( m_factory
, "<main>" );
545 m_menu
= gtk_menu_new(); // Do not show!
549 m_eventHandler
= this;
550 m_clientData
= (void*) NULL
;
552 if (m_title
.IsNull()) m_title
= _T("");
553 if (m_title
!= _T(""))
559 m_owner
= (GtkWidget
*) NULL
;
564 /* how do we delete an item-factory ? */
567 void wxMenu::SetTitle( const wxString
& title
)
569 // TODO Waiting for something better
573 const wxString
wxMenu::GetTitle() const
578 void wxMenu::AppendSeparator()
580 wxMenuItem
*mitem
= new wxMenuItem();
581 mitem
->SetId(ID_SEPARATOR
);
583 GtkWidget
*menuItem
= gtk_menu_item_new();
584 gtk_menu_append( GTK_MENU(m_menu
), menuItem
);
585 gtk_widget_show( menuItem
);
587 mitem
->SetMenuItem(menuItem
);
588 m_items
.Append( mitem
);
591 void wxMenu::Append( int id
, const wxString
&item
, const wxString
&helpStr
, bool checkable
)
593 wxMenuItem
*mitem
= new wxMenuItem();
595 mitem
->SetText(item
);
596 mitem
->SetHelp(helpStr
);
597 mitem
->SetCheckable(checkable
);
599 #if (GTK_MINOR_VERSION > 0)
600 /* text has "_" instead of "&" after mitem->SetText() */
601 wxString
text( mitem
->GetText() );
603 /* local buffer in multibyte form */
606 strcat( buf
, text
.mb_str() );
608 GtkItemFactoryEntry entry
;
610 entry
.accelerator
= (gchar
*) NULL
;
611 entry
.callback
= (GtkItemFactoryCallback
) gtk_menu_clicked_callback
;
612 entry
.callback_action
= 0;
614 entry
.item_type
= "<CheckItem>";
616 entry
.item_type
= "<Item>";
618 gtk_item_factory_create_item( m_factory
, &entry
, (gpointer
) this, 2 ); /* what is 2 ? */
620 /* in order to get the pointer to the item we need the item text _without_ underscores */
621 wxString s
= _T("<main>/");
622 for ( const wxChar
*pc
= text
; *pc
!= _T('\0'); pc
++ )
624 if (*pc
== _T('_')) pc
++; /* skip it */
628 GtkWidget
*menuItem
= gtk_item_factory_get_widget( m_factory
, s
.mb_str() );
632 GtkWidget
*menuItem
= checkable
? gtk_check_menu_item_new_with_label( mitem
->GetText().mb_str() )
633 : gtk_menu_item_new_with_label( mitem
->GetText().mb_str() );
635 gtk_signal_connect( GTK_OBJECT(menuItem
), "activate",
636 GTK_SIGNAL_FUNC(gtk_menu_clicked_callback
),
639 gtk_menu_append( GTK_MENU(m_menu
), menuItem
);
640 gtk_widget_show( menuItem
);
644 gtk_signal_connect( GTK_OBJECT(menuItem
), "select",
645 GTK_SIGNAL_FUNC(gtk_menu_hilight_callback
),
648 gtk_signal_connect( GTK_OBJECT(menuItem
), "deselect",
649 GTK_SIGNAL_FUNC(gtk_menu_nolight_callback
),
652 mitem
->SetMenuItem(menuItem
);
654 m_items
.Append( mitem
);
657 void wxMenu::Append( int id
, const wxString
&text
, wxMenu
*subMenu
, const wxString
&helpStr
)
659 wxMenuItem
*mitem
= new wxMenuItem();
661 mitem
->SetText(text
);
662 mitem
->SetHelp(helpStr
);
664 GtkWidget
*menuItem
= gtk_menu_item_new_with_label(mitem
->GetText().mbc_str());
665 mitem
->SetMenuItem(menuItem
);
666 mitem
->SetSubMenu(subMenu
);
668 gtk_signal_connect( GTK_OBJECT(menuItem
), "select",
669 GTK_SIGNAL_FUNC(gtk_menu_hilight_callback
),
672 gtk_signal_connect( GTK_OBJECT(menuItem
), "deselect",
673 GTK_SIGNAL_FUNC(gtk_menu_nolight_callback
),
676 gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem
), subMenu
->m_menu
);
677 gtk_menu_append( GTK_MENU(m_menu
), menuItem
);
678 gtk_widget_show( menuItem
);
679 m_items
.Append( mitem
);
682 void wxMenu::Append( wxMenuItem
*item
)
684 m_items
.Append( item
);
686 GtkWidget
*menuItem
= (GtkWidget
*) NULL
;
688 if (item
->IsSeparator())
689 menuItem
= gtk_menu_item_new();
690 else if (item
->IsSubMenu())
691 menuItem
= gtk_menu_item_new_with_label(item
->GetText().mbc_str());
693 menuItem
= item
->IsCheckable() ? gtk_check_menu_item_new_with_label(item
->GetText().mbc_str())
694 : gtk_menu_item_new_with_label(item
->GetText().mbc_str());
696 if (!item
->IsSeparator())
698 gtk_signal_connect( GTK_OBJECT(menuItem
), "select",
699 GTK_SIGNAL_FUNC(gtk_menu_hilight_callback
),
702 gtk_signal_connect( GTK_OBJECT(menuItem
), "deselect",
703 GTK_SIGNAL_FUNC(gtk_menu_nolight_callback
),
706 if (!item
->IsSubMenu())
708 gtk_signal_connect( GTK_OBJECT(menuItem
), "activate",
709 GTK_SIGNAL_FUNC(gtk_menu_clicked_callback
),
714 gtk_menu_append( GTK_MENU(m_menu
), menuItem
);
715 gtk_widget_show( menuItem
);
716 item
->SetMenuItem(menuItem
);
719 int wxMenu::FindItem( const wxString itemString
) const
722 for ( const wxChar
*pc
= itemString
; *pc
!= _T('\0'); pc
++ )
727 #if (GTK_MINOR_VERSION > 0)
734 wxNode
*node
= m_items
.First();
737 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
738 if (item
->GetText() == s
)
740 return item
->GetId();
748 void wxMenu::Enable( int id
, bool enable
)
750 wxMenuItem
*item
= FindItem(id
);
752 wxCHECK_RET( item
, _T("wxMenu::Enable: no such item") );
754 item
->Enable(enable
);
757 bool wxMenu::IsEnabled( int id
) const
759 wxMenuItem
*item
= FindItem(id
);
761 wxCHECK_MSG( item
, FALSE
, _T("wxMenu::IsEnabled: no such item") );
763 return item
->IsEnabled();
766 void wxMenu::Check( int id
, bool enable
)
768 wxMenuItem
*item
= FindItem(id
);
770 wxCHECK_RET( item
, _T("wxMenu::Check: no such item") );
775 bool wxMenu::IsChecked( int id
) const
777 wxMenuItem
*item
= FindItem(id
);
779 wxCHECK_MSG( item
, FALSE
, _T("wxMenu::IsChecked: no such item") );
781 return item
->IsChecked();
784 void wxMenu::SetLabel( int id
, const wxString
&label
)
786 wxMenuItem
*item
= FindItem(id
);
788 wxCHECK_RET( item
, _T("wxMenu::SetLabel: no such item") );
790 item
->SetText(label
);
793 wxString
wxMenu::GetLabel( int id
) const
795 wxMenuItem
*item
= FindItem(id
);
797 wxCHECK_MSG( item
, _T(""), _T("wxMenu::GetLabel: no such item") );
799 return item
->GetText();
802 void wxMenu::SetHelpString( int id
, const wxString
& helpString
)
804 wxMenuItem
*item
= FindItem(id
);
806 wxCHECK_RET( item
, _T("wxMenu::SetHelpString: no such item") );
808 item
->SetHelp( helpString
);
811 wxString
wxMenu::GetHelpString( int id
) const
813 wxMenuItem
*item
= FindItem(id
);
815 wxCHECK_MSG( item
, _T(""), _T("wxMenu::GetHelpString: no such item") );
817 return item
->GetHelp();
820 int wxMenu::FindMenuIdByMenuItem( GtkWidget
*menuItem
) const
822 wxNode
*node
= m_items
.First();
825 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
826 if (item
->GetMenuItem() == menuItem
)
827 return item
->GetId();
834 wxMenuItem
*wxMenu::FindItem(int id
) const
836 wxNode
*node
= m_items
.First();
839 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
840 if (item
->GetId() == id
)
847 /* Not finding anything here can be correct
848 * when search the entire menu system for
849 * an entry -> no error message. */
851 return (wxMenuItem
*) NULL
;
854 void wxMenu::SetInvokingWindow( wxWindow
*win
)
856 m_invokingWindow
= win
;
859 wxWindow
*wxMenu::GetInvokingWindow()
861 return m_invokingWindow
;
864 // Update a menu and all submenus recursively. source is the object that has
865 // the update event handlers defined for it. If NULL, the menu or associated
866 // window will be used.
867 void wxMenu::UpdateUI(wxEvtHandler
* source
)
869 if (!source
&& GetInvokingWindow())
870 source
= GetInvokingWindow()->GetEventHandler();
872 source
= GetEventHandler();
876 wxNode
* node
= GetItems().First();
879 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
880 if ( !item
->IsSeparator() )
882 wxWindowID id
= item
->GetId();
883 wxUpdateUIEvent
event(id
);
884 event
.SetEventObject( source
);
886 if (source
->ProcessEvent(event
))
888 if (event
.GetSetText())
889 SetLabel(id
, event
.GetText());
890 if (event
.GetSetChecked())
891 Check(id
, event
.GetChecked());
892 if (event
.GetSetEnabled())
893 Enable(id
, event
.GetEnabled());
896 if (item
->GetSubMenu())
897 item
->GetSubMenu()->UpdateUI(source
);