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 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar
,wxWindow
)
29 wxMenuBar::wxMenuBar( long style
)
31 /* the parent window is known after wxFrame::SetMenu() */
34 PreCreation( (wxWindow
*) NULL
, -1, wxDefaultPosition
, wxDefaultSize
, style
, "menu" );
36 m_menus
.DeleteContents( TRUE
);
38 /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
39 #if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
40 m_accel
= gtk_accel_group_new();
41 m_factory
= gtk_item_factory_new( GTK_TYPE_MENU_BAR
, "<main>", m_accel
);
42 m_menubar
= gtk_item_factory_get_widget( m_factory
, "<main>" );
44 m_menubar
= gtk_menu_bar_new();
47 if (style
& wxMB_DOCKABLE
)
49 m_widget
= gtk_handle_box_new();
50 gtk_container_add( GTK_CONTAINER(m_widget
), GTK_WIDGET(m_menubar
) );
51 gtk_widget_show( GTK_WIDGET(m_menubar
) );
55 m_widget
= GTK_WIDGET(m_menubar
);
63 wxMenuBar::wxMenuBar()
65 /* the parent window is known after wxFrame::SetMenu() */
68 PreCreation( (wxWindow
*) NULL
, -1, wxDefaultPosition
, wxDefaultSize
, 0, "menu" );
70 m_menus
.DeleteContents( TRUE
);
72 /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
73 #if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
74 m_accel
= gtk_accel_group_new();
75 m_factory
= gtk_item_factory_new( GTK_TYPE_MENU_BAR
, "<main>", m_accel
);
76 m_menubar
= gtk_item_factory_get_widget( m_factory
, "<main>" );
78 m_menubar
= gtk_menu_bar_new();
81 m_widget
= GTK_WIDGET(m_menubar
);
88 wxMenuBar::~wxMenuBar()
90 // how to destroy a GtkItemFactory ?
93 void wxMenuBar::Append( wxMenu
*menu
, const wxString
&title
)
95 m_menus
.Append( menu
);
97 /* GTK 1.2 wants to have "_" instead of "&" for accelerators */
99 for ( const wxChar
*pc
= title
; *pc
!= _T('\0'); pc
++ )
104 #if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
111 /* this doesn't have much effect right now */
112 menu
->SetTitle( str
);
114 /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
115 #if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
117 /* local buffer in multibyte form */
120 strcat( buf
, str
.mb_str() );
122 GtkItemFactoryEntry entry
;
124 entry
.accelerator
= (gchar
*) NULL
;
125 entry
.callback
= (GtkItemFactoryCallback
) NULL
;
126 entry
.callback_action
= 0;
127 entry
.item_type
= "<Branch>";
129 gtk_item_factory_create_item( m_factory
, &entry
, (gpointer
) this, 2 ); /* what is 2 ? */
131 /* in order to get the pointer to the item we need the item text _without_ underscores */
132 wxString tmp
= _T("<main>/");
133 for ( const wxChar
*pc
= str
; *pc
!= _T('\0'); pc
++ )
135 if (*pc
== _T('_')) pc
++; /* skip it */
139 menu
->m_owner
= gtk_item_factory_get_item( m_factory
, tmp
.mb_str() );
141 gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu
->m_owner
), menu
->m_menu
);
145 menu
->m_owner
= gtk_menu_item_new_with_label( str
.mb_str() );
146 gtk_widget_show( menu
->m_owner
);
147 gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu
->m_owner
), menu
->m_menu
);
149 gtk_menu_bar_append( GTK_MENU_BAR(m_menubar
), menu
->m_owner
);
154 static int FindMenuItemRecursive( const wxMenu
*menu
, const wxString
&menuString
, const wxString
&itemString
)
156 if (menu
->GetTitle() == menuString
)
158 int res
= menu
->FindItem( itemString
);
159 if (res
!= wxNOT_FOUND
)
163 wxNode
*node
= ((wxMenu
*)menu
)->GetItems().First(); // const_cast
166 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
167 if (item
->IsSubMenu())
168 return FindMenuItemRecursive(item
->GetSubMenu(), menuString
, itemString
);
176 wxMenuItem
*wxMenuBar::FindItemForId(int itemId
, wxMenu
**menuForItem
= NULL
) const
180 // TODO return the pointer to the menu
185 return FindItem(itemId
);
188 int wxMenuBar::FindMenuItem( const wxString
&menuString
, const wxString
&itemString
) const
190 wxNode
*node
= m_menus
.First();
193 wxMenu
*menu
= (wxMenu
*)node
->Data();
194 int res
= FindMenuItemRecursive( menu
, menuString
, itemString
);
195 if (res
!= -1) return res
;
201 // Find a wxMenuItem using its id. Recurses down into sub-menus
202 static wxMenuItem
* FindMenuItemByIdRecursive(const wxMenu
* menu
, int id
)
204 wxMenuItem
* result
= menu
->FindItem(id
);
206 wxNode
*node
= ((wxMenu
*)menu
)->GetItems().First(); // const_cast
207 while ( node
&& result
== NULL
)
209 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
210 if (item
->IsSubMenu())
212 result
= FindMenuItemByIdRecursive( item
->GetSubMenu(), id
);
220 wxMenuItem
* wxMenuBar::FindItem( int id
) const
222 wxMenuItem
* result
= 0;
223 wxNode
*node
= m_menus
.First();
224 while (node
&& result
== 0)
226 wxMenu
*menu
= (wxMenu
*)node
->Data();
227 result
= FindMenuItemByIdRecursive( menu
, id
);
234 void wxMenuBar::Check( int id
, bool check
)
236 wxMenuItem
* item
= FindMenuItemById( id
);
238 wxCHECK_RET( item
, _T("wxMenuBar::Check: no such item") );
243 bool wxMenuBar::IsChecked( int id
) const
245 wxMenuItem
* item
= FindMenuItemById( id
);
247 wxCHECK_MSG( item
, FALSE
, _T("wxMenuBar::IsChecked: no such item") );
249 return item
->IsChecked();
252 void wxMenuBar::Enable( int id
, bool enable
)
254 wxMenuItem
* item
= FindMenuItemById( id
);
256 wxCHECK_RET( item
, _T("wxMenuBar::Enable: no such item") );
258 item
->Enable(enable
);
261 bool wxMenuBar::IsEnabled( int id
) const
263 wxMenuItem
* item
= FindMenuItemById( id
);
265 wxCHECK_MSG( item
, FALSE
, _T("wxMenuBar::IsEnabled: no such item") );
267 return item
->IsEnabled();
270 wxString
wxMenuBar::GetLabel( int id
) const
272 wxMenuItem
* item
= FindMenuItemById( id
);
274 wxCHECK_MSG( item
, _T(""), _T("wxMenuBar::GetLabel: no such item") );
276 return item
->GetText();
279 void wxMenuBar::SetLabel( int id
, const wxString
&label
)
281 wxMenuItem
* item
= FindMenuItemById( id
);
283 wxCHECK_RET( item
, _T("wxMenuBar::SetLabel: no such item") );
285 item
->SetText( label
);
288 void wxMenuBar::EnableTop( int pos
, bool flag
)
290 wxNode
*node
= m_menus
.Nth( pos
);
292 wxCHECK_RET( node
, _T("menu not found") );
294 wxMenu
* menu
= (wxMenu
*)node
->Data();
297 gtk_widget_set_sensitive( menu
->m_owner
, flag
);
300 wxString
wxMenuBar::GetLabelTop( int pos
) const
302 wxNode
*node
= m_menus
.Nth( pos
);
304 wxCHECK_MSG( node
, _T("invalid"), _T("menu not found") );
306 wxMenu
* menu
= (wxMenu
*)node
->Data();
308 return menu
->GetTitle();
311 void wxMenuBar::SetLabelTop( int pos
, const wxString
& label
)
313 wxNode
*node
= m_menus
.Nth( pos
);
315 wxCHECK_RET( node
, _T("menu not found") );
317 wxMenu
* menu
= (wxMenu
*)node
->Data();
319 menu
->SetTitle( label
);
322 void wxMenuBar::SetHelpString( int id
, const wxString
& helpString
)
324 wxMenuItem
* item
= FindMenuItemById( id
);
326 wxCHECK_RET( item
, _T("wxMenuBar::SetHelpString: no such item") );
328 item
->SetHelp( helpString
);
331 wxString
wxMenuBar::GetHelpString( int id
) const
333 wxMenuItem
* item
= FindMenuItemById( id
);
335 wxCHECK_MSG( item
, _T(""), _T("wxMenuBar::GetHelpString: no such item") );
337 return item
->GetHelp();
340 //-----------------------------------------------------------------------------
342 //-----------------------------------------------------------------------------
344 static void gtk_menu_clicked_callback( GtkWidget
*widget
, wxMenu
*menu
)
346 int id
= menu
->FindMenuIdByMenuItem(widget
);
348 /* should find it for normal (not popup) menu */
349 wxASSERT( (id
!= -1) || (menu
->GetInvokingWindow() != NULL
) );
351 if (!menu
->IsEnabled(id
))
354 wxMenuItem
* item
= menu
->FindItem( id
);
355 wxCHECK_RET( item
, _T("error in menu item callback") );
357 if (item
->IsCheckable())
359 if (item
->GetCheckedFlag() == item
->IsChecked())
361 /* the menu item has been checked by calling wxMenuItem->Check() */
366 /* the user pressed on the menu item -> report */
367 item
->SetCheckedFlag(item
->IsChecked()); /* make consistent again */
371 wxCommandEvent
event( wxEVT_COMMAND_MENU_SELECTED
, id
);
372 event
.SetEventObject( menu
);
375 if (menu
->GetCallback())
377 (void) (*(menu
->GetCallback())) (*menu
, event
);
381 if (menu
->GetEventHandler()->ProcessEvent(event
))
384 wxWindow
*win
= menu
->GetInvokingWindow();
386 win
->GetEventHandler()->ProcessEvent( event
);
389 //-----------------------------------------------------------------------------
391 //-----------------------------------------------------------------------------
393 static void gtk_menu_hilight_callback( GtkWidget
*widget
, wxMenu
*menu
)
395 int id
= menu
->FindMenuIdByMenuItem(widget
);
397 wxASSERT( id
!= -1 ); // should find it!
399 if (!menu
->IsEnabled(id
))
402 wxMenuEvent
event( wxEVT_MENU_HIGHLIGHT
, id
);
403 event
.SetEventObject( menu
);
405 /* wxMSW doesn't call callback here either
407 if (menu->m_callback)
409 (void) (*(menu->m_callback)) (*menu, event);
414 if (menu
->GetEventHandler()->ProcessEvent(event
))
417 wxWindow
*win
= menu
->GetInvokingWindow();
418 if (win
) win
->GetEventHandler()->ProcessEvent( event
);
421 //-----------------------------------------------------------------------------
423 //-----------------------------------------------------------------------------
425 static void gtk_menu_nolight_callback( GtkWidget
*widget
, wxMenu
*menu
)
427 int id
= menu
->FindMenuIdByMenuItem(widget
);
429 wxASSERT( id
!= -1 ); // should find it!
431 if (!menu
->IsEnabled(id
))
434 wxMenuEvent
event( wxEVT_MENU_HIGHLIGHT
, -1 );
435 event
.SetEventObject( menu
);
437 if (menu
->GetEventHandler()->ProcessEvent(event
))
440 wxWindow
*win
= menu
->GetInvokingWindow();
442 win
->GetEventHandler()->ProcessEvent( event
);
445 //-----------------------------------------------------------------------------
447 //-----------------------------------------------------------------------------
449 IMPLEMENT_DYNAMIC_CLASS(wxMenuItem
,wxObject
)
451 wxMenuItem::wxMenuItem()
454 m_isCheckMenu
= FALSE
;
457 m_subMenu
= (wxMenu
*) NULL
;
458 m_menuItem
= (GtkWidget
*) NULL
;
461 // it's valid for this function to be called even if m_menuItem == NULL
462 void wxMenuItem::SetName( const wxString
& str
)
465 for ( const wxChar
*pc
= str
; *pc
!= _T('\0'); pc
++ )
470 #if (GTK_MINOR_VERSION > 0)
479 GtkLabel
*label
= GTK_LABEL( GTK_BIN(m_menuItem
)->child
);
480 gtk_label_set( label
, m_text
.mb_str());
484 void wxMenuItem::Check( bool check
)
486 wxCHECK_RET( m_menuItem
, _T("invalid menu item") );
488 wxCHECK_RET( IsCheckable(), _T("Can't check uncheckable item!") )
490 if (check
== m_isChecked
) return;
493 gtk_check_menu_item_set_state( (GtkCheckMenuItem
*)m_menuItem
, (gint
)check
);
496 void wxMenuItem::Enable( bool enable
)
498 wxCHECK_RET( m_menuItem
, _T("invalid menu item") );
500 gtk_widget_set_sensitive( m_menuItem
, enable
);
501 m_isEnabled
= enable
;
504 bool wxMenuItem::IsChecked() const
506 wxCHECK_MSG( m_menuItem
, FALSE
, _T("invalid menu item") );
508 wxCHECK( IsCheckable(), FALSE
); // can't get state of uncheckable item!
510 bool bIsChecked
= ((GtkCheckMenuItem
*)m_menuItem
)->active
!= 0;
515 //-----------------------------------------------------------------------------
517 //-----------------------------------------------------------------------------
519 IMPLEMENT_DYNAMIC_CLASS(wxMenu
,wxEvtHandler
)
521 wxMenu::wxMenu( const wxString
& title
, const wxFunction func
)
524 m_items
.DeleteContents( TRUE
);
525 m_invokingWindow
= (wxWindow
*) NULL
;
527 #if (GTK_MINOR_VERSION > 0)
528 m_accel
= gtk_accel_group_new();
529 m_factory
= gtk_item_factory_new( GTK_TYPE_MENU
, "<main>", m_accel
);
530 m_menu
= gtk_item_factory_get_widget( m_factory
, "<main>" );
532 m_menu
= gtk_menu_new(); // Do not show!
536 m_eventHandler
= this;
537 m_clientData
= (void*) NULL
;
539 if (m_title
.IsNull()) m_title
= _T("");
540 if (m_title
!= _T(""))
546 m_owner
= (GtkWidget
*) NULL
;
551 /* how do we delete an item-factory ? */
554 void wxMenu::SetTitle( const wxString
& title
)
556 // TODO Waiting for something better
560 const wxString
wxMenu::GetTitle() const
565 void wxMenu::AppendSeparator()
567 wxMenuItem
*mitem
= new wxMenuItem();
568 mitem
->SetId(ID_SEPARATOR
);
570 GtkWidget
*menuItem
= gtk_menu_item_new();
571 gtk_menu_append( GTK_MENU(m_menu
), menuItem
);
572 gtk_widget_show( menuItem
);
574 mitem
->SetMenuItem(menuItem
);
575 m_items
.Append( mitem
);
578 void wxMenu::Append( int id
, const wxString
&item
, const wxString
&helpStr
, bool checkable
)
580 wxMenuItem
*mitem
= new wxMenuItem();
582 mitem
->SetText(item
);
583 mitem
->SetHelp(helpStr
);
584 mitem
->SetCheckable(checkable
);
586 #if (GTK_MINOR_VERSION > 0)
587 /* text has "_" instead of "&" after mitem->SetText() */
588 wxString
text( mitem
->GetText() );
590 /* local buffer in multibyte form */
593 strcat( buf
, text
.mb_str() );
595 GtkItemFactoryEntry entry
;
597 entry
.accelerator
= (gchar
*) NULL
;
598 entry
.callback
= (GtkItemFactoryCallback
) gtk_menu_clicked_callback
;
599 entry
.callback_action
= 0;
601 entry
.item_type
= "<CheckItem>";
603 entry
.item_type
= "<Item>";
605 gtk_item_factory_create_item( m_factory
, &entry
, (gpointer
) this, 2 ); /* what is 2 ? */
607 /* in order to get the pointer to the item we need the item text _without_ underscores */
608 wxString s
= _T("<main>/");
609 for ( const wxChar
*pc
= text
; *pc
!= _T('\0'); pc
++ )
611 if (*pc
== _T('_')) pc
++; /* skip it */
615 GtkWidget
*menuItem
= gtk_item_factory_get_widget( m_factory
, s
.mb_str() );
619 GtkWidget
*menuItem
= checkable
? gtk_check_menu_item_new_with_label( item
.mb_str() )
620 : gtk_menu_item_new_with_label( item
.mb_str() );
622 gtk_signal_connect( GTK_OBJECT(menuItem
), "activate",
623 GTK_SIGNAL_FUNC(gtk_menu_clicked_callback
),
626 gtk_menu_append( GTK_MENU(m_menu
), menuItem
);
627 gtk_widget_show( menuItem
);
631 gtk_signal_connect( GTK_OBJECT(menuItem
), "select",
632 GTK_SIGNAL_FUNC(gtk_menu_hilight_callback
),
635 gtk_signal_connect( GTK_OBJECT(menuItem
), "deselect",
636 GTK_SIGNAL_FUNC(gtk_menu_nolight_callback
),
639 mitem
->SetMenuItem(menuItem
);
641 m_items
.Append( mitem
);
644 void wxMenu::Append( int id
, const wxString
&text
, wxMenu
*subMenu
, const wxString
&helpStr
)
646 wxMenuItem
*mitem
= new wxMenuItem();
648 mitem
->SetText(text
);
649 mitem
->SetHelp(helpStr
);
651 GtkWidget
*menuItem
= gtk_menu_item_new_with_label(mitem
->GetText().mbc_str());
652 mitem
->SetMenuItem(menuItem
);
653 mitem
->SetSubMenu(subMenu
);
655 gtk_signal_connect( GTK_OBJECT(menuItem
), "select",
656 GTK_SIGNAL_FUNC(gtk_menu_hilight_callback
),
659 gtk_signal_connect( GTK_OBJECT(menuItem
), "deselect",
660 GTK_SIGNAL_FUNC(gtk_menu_nolight_callback
),
663 gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem
), subMenu
->m_menu
);
664 gtk_menu_append( GTK_MENU(m_menu
), menuItem
);
665 gtk_widget_show( menuItem
);
666 m_items
.Append( mitem
);
669 void wxMenu::Append( wxMenuItem
*item
)
671 m_items
.Append( item
);
673 GtkWidget
*menuItem
= (GtkWidget
*) NULL
;
675 if (item
->IsSeparator())
676 menuItem
= gtk_menu_item_new();
677 else if (item
->IsSubMenu())
678 menuItem
= gtk_menu_item_new_with_label(item
->GetText().mbc_str());
680 menuItem
= item
->IsCheckable() ? gtk_check_menu_item_new_with_label(item
->GetText().mbc_str())
681 : gtk_menu_item_new_with_label(item
->GetText().mbc_str());
683 if (!item
->IsSeparator())
685 gtk_signal_connect( GTK_OBJECT(menuItem
), "select",
686 GTK_SIGNAL_FUNC(gtk_menu_hilight_callback
),
689 gtk_signal_connect( GTK_OBJECT(menuItem
), "deselect",
690 GTK_SIGNAL_FUNC(gtk_menu_nolight_callback
),
693 if (!item
->IsSubMenu())
695 gtk_signal_connect( GTK_OBJECT(menuItem
), "activate",
696 GTK_SIGNAL_FUNC(gtk_menu_clicked_callback
),
701 gtk_menu_append( GTK_MENU(m_menu
), menuItem
);
702 gtk_widget_show( menuItem
);
703 item
->SetMenuItem(menuItem
);
706 int wxMenu::FindItem( const wxString itemString
) const
709 for ( const wxChar
*pc
= itemString
; *pc
!= _T('\0'); pc
++ )
714 #if (GTK_MINOR_VERSION > 0)
721 wxNode
*node
= m_items
.First();
724 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
725 if (item
->GetText() == s
)
727 return item
->GetId();
735 void wxMenu::Enable( int id
, bool enable
)
737 wxMenuItem
*item
= FindItem(id
);
739 wxCHECK_RET( item
, _T("wxMenu::Enable: no such item") );
741 item
->Enable(enable
);
744 bool wxMenu::IsEnabled( int id
) const
746 wxMenuItem
*item
= FindItem(id
);
748 wxCHECK_MSG( item
, FALSE
, _T("wxMenu::IsEnabled: no such item") );
750 return item
->IsEnabled();
753 void wxMenu::Check( int id
, bool enable
)
755 wxMenuItem
*item
= FindItem(id
);
757 wxCHECK_RET( item
, _T("wxMenu::Check: no such item") );
762 bool wxMenu::IsChecked( int id
) const
764 wxMenuItem
*item
= FindItem(id
);
766 wxCHECK_MSG( item
, FALSE
, _T("wxMenu::IsChecked: no such item") );
768 return item
->IsChecked();
771 void wxMenu::SetLabel( int id
, const wxString
&label
)
773 wxMenuItem
*item
= FindItem(id
);
775 wxCHECK_RET( item
, _T("wxMenu::SetLabel: no such item") );
777 item
->SetText(label
);
780 wxString
wxMenu::GetLabel( int id
) const
782 wxMenuItem
*item
= FindItem(id
);
784 wxCHECK_MSG( item
, _T(""), _T("wxMenu::GetLabel: no such item") );
786 return item
->GetText();
789 void wxMenu::SetHelpString( int id
, const wxString
& helpString
)
791 wxMenuItem
*item
= FindItem(id
);
793 wxCHECK_RET( item
, _T("wxMenu::SetHelpString: no such item") );
795 item
->SetHelp( helpString
);
798 wxString
wxMenu::GetHelpString( int id
) const
800 wxMenuItem
*item
= FindItem(id
);
802 wxCHECK_MSG( item
, _T(""), _T("wxMenu::GetHelpString: no such item") );
804 return item
->GetHelp();
807 int wxMenu::FindMenuIdByMenuItem( GtkWidget
*menuItem
) const
809 wxNode
*node
= m_items
.First();
812 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
813 if (item
->GetMenuItem() == menuItem
)
814 return item
->GetId();
821 wxMenuItem
*wxMenu::FindItem(int id
) const
823 wxNode
*node
= m_items
.First();
826 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
827 if (item
->GetId() == id
)
834 /* Not finding anything here can be correct
835 * when search the entire menu system for
836 * an entry -> no error message. */
838 return (wxMenuItem
*) NULL
;
841 void wxMenu::SetInvokingWindow( wxWindow
*win
)
843 m_invokingWindow
= win
;
846 wxWindow
*wxMenu::GetInvokingWindow()
848 return m_invokingWindow
;
851 // Update a menu and all submenus recursively. source is the object that has
852 // the update event handlers defined for it. If NULL, the menu or associated
853 // window will be used.
854 void wxMenu::UpdateUI(wxEvtHandler
* source
)
856 if (!source
&& GetInvokingWindow())
857 source
= GetInvokingWindow()->GetEventHandler();
859 source
= GetEventHandler();
863 wxNode
* node
= GetItems().First();
866 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
867 if ( !item
->IsSeparator() )
869 wxWindowID id
= item
->GetId();
870 wxUpdateUIEvent
event(id
);
871 event
.SetEventObject( source
);
873 if (source
->ProcessEvent(event
))
875 if (event
.GetSetText())
876 SetLabel(id
, event
.GetText());
877 if (event
.GetSetChecked())
878 Check(id
, event
.GetChecked());
879 if (event
.GetSetEnabled())
880 Enable(id
, event
.GetEnabled());
883 if (item
->GetSubMenu())
884 item
->GetSubMenu()->UpdateUI(source
);