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 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "menu.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
30 #include "wx/ownerdrw.h"
33 #include "wx/msw/private.h"
34 #include "wx/msw/menu.h"
35 #include "wx/menuitem.h"
38 // other standard headers
41 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
45 extern wxMenu
*wxCurrentPopupMenu
;
47 // ----------------------------------------------------------------------------
49 // ----------------------------------------------------------------------------
51 // the (popup) menu title has this special id
52 static const int idMenuTitle
= -2;
54 // ----------------------------------------------------------------------------
56 // ----------------------------------------------------------------------------
58 #if !USE_SHARED_LIBRARY
59 IMPLEMENT_DYNAMIC_CLASS(wxMenu
, wxEvtHandler
)
60 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar
, wxEvtHandler
)
64 #define GetHMENU() ((HMENU)GetHMenu())
66 // ============================================================================
68 // ============================================================================
72 // Construct a menu with optional title (then use append)
73 wxMenu::wxMenu(const wxString
& title
, const wxFunction func
)
77 m_eventHandler
= this;
78 m_pInvokingWindow
= NULL
;
82 m_hMenu
= (WXHMENU
) CreatePopupMenu();
84 m_topLevelMenu
= this;
85 m_clientData
= (void*) NULL
;
89 Append(idMenuTitle
, m_title
) ;
96 // The wxWindow destructor will take care of deleting the submenus.
100 DestroyMenu((HMENU
) m_hMenu
);
103 // Windows seems really bad on Menu de-allocation...
104 // After many try, here is what I do: RemoveMenu() will ensure
105 // that popup are "disconnected" from their parent; then call
106 // delete method on each child (which in turn do a recursive job),
107 // and finally, DestroyMenu()
109 // With that, BoundCheckers is happy, and no complaints...
113 N = GetMenuItemCount(m_hMenu);
115 for (i = N-1; i >= 0; i--)
116 RemoveMenu(m_hMenu, i, MF_BYPOSITION);
119 // How is deleting submenus in this loop any different from deleting
120 // the submenus in the children list, via ~wxWindow ?
121 // I'll reinstate this deletion for now and remove addition
122 // from children list (which doesn't exist now)
124 wxNode
*node
= m_menuItems
.First();
127 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
129 // Delete child menus.
130 // Beware: they must not be appended to children list!!!
131 // (because order of delete is significant)
132 if (item
->GetSubMenu())
133 item
->DeleteSubMenu();
135 wxNode
*next
= node
->Next();
142 DestroyMenu(m_hMenu);
152 // function appends a new item or submenu to the menu
153 void wxMenu::Append(wxMenuItem
*pItem
)
155 wxCHECK_RET( pItem
!= NULL
, "can't append NULL item to the menu" );
157 m_menuItems
.Append(pItem
);
162 flags
|= MF_MENUBREAK
;
166 if ( pItem
->IsSeparator() ) {
167 flags
|= MF_SEPARATOR
;
170 // id is the numeric id for normal menu items and HMENU for submenus
172 wxMenu
*SubMenu
= pItem
->GetSubMenu();
173 if ( SubMenu
!= NULL
) {
174 wxASSERT( SubMenu
->m_hMenu
!= (WXHMENU
) NULL
);
176 id
= (UINT
)SubMenu
->m_hMenu
;
178 SubMenu
->m_topLevelMenu
= m_topLevelMenu
;
179 SubMenu
->m_parent
= this;
180 SubMenu
->m_savehMenu
= (WXHMENU
)id
;
181 SubMenu
->m_hMenu
= 0;
191 #if wxUSE_OWNER_DRAWN
192 if ( pItem
->IsOwnerDrawn() ) { // want to get {Measure|Draw}Item messages?
193 // item draws itself, pass pointer to it in data parameter
194 flags
|= MF_OWNERDRAW
;
195 pData
= (LPCSTR
)pItem
;
200 // menu is just a normal string (passed in data parameter)
202 pData
= pItem
->GetName();
205 // visually select the menu title
206 if ( id
== idMenuTitle
)
208 // TODO use SetMenuItemInfo(MFS_DEFAULT) to put it in bold face
211 if ( !AppendMenu(GetHMENU(), flags
, id
, pData
) )
213 wxLogLastError("AppendMenu");
219 void wxMenu::AppendSeparator()
221 Append(new wxMenuItem(this, ID_SEPARATOR
));
225 void wxMenu::Append(int Id
, const wxString
& label
,
226 wxMenu
*SubMenu
, const wxString
& helpString
)
228 Append(new wxMenuItem(this, Id
, label
, helpString
, FALSE
, SubMenu
));
231 // Ordinary menu item
232 void wxMenu::Append(int Id
, const wxString
& label
,
233 const wxString
& helpString
, bool checkable
)
235 // 'checkable' parameter is useless for Windows.
236 Append(new wxMenuItem(this, Id
, label
, helpString
, checkable
));
239 void wxMenu::Delete(int id
)
241 wxMenuItem
*item
= NULL
;
244 for (pos
= 0, node
= m_menuItems
.First(); node
; node
= node
->Next(), pos
++)
246 item
= (wxMenuItem
*)node
->Data();
247 if ( item
->GetId() == id
)
251 wxCHECK_RET( node
, "wxMenu::Delete(): item doesn't exist" );
253 HMENU menu
= GetHMENU();
255 wxMenu
*pSubMenu
= item
->GetSubMenu();
256 if ( pSubMenu
!= NULL
) {
257 RemoveMenu(menu
, (UINT
)pos
, MF_BYPOSITION
);
258 pSubMenu
->m_hMenu
= pSubMenu
->m_savehMenu
;
259 pSubMenu
->m_savehMenu
= 0;
260 pSubMenu
->m_parent
= NULL
;
261 // RemoveChild(item->subMenu);
262 pSubMenu
->m_topLevelMenu
= NULL
;
263 // TODO: Why isn't subMenu deleted here???
264 // Will put this in for now. Assuming this is supposed
265 // to delete the menu, not just remove it.
266 item
->DeleteSubMenu();
269 DeleteMenu(menu
, (UINT
)pos
, MF_BYPOSITION
);
272 m_menuItems
.DeleteNode(node
);
276 void wxMenu::Enable(int Id
, bool Flag
)
278 wxMenuItem
*item
= FindItemForId(Id
);
279 wxCHECK_RET( item
!= NULL
, "can't enable non-existing menu item" );
284 bool wxMenu::IsEnabled(int Id
) const
286 wxMenuItem
*item
= FindItemForId(Id
);
287 wxCHECK( item
!= NULL
, FALSE
, "invalid item id" );
289 return item
->IsEnabled();
292 void wxMenu::Check(int Id
, bool Flag
)
294 wxMenuItem
*item
= FindItemForId(Id
);
295 wxCHECK_RET( item
!= NULL
, "can't get status of non-existing menu item" );
300 bool wxMenu::IsChecked(int Id
) const
302 wxMenuItem
*item
= FindItemForId(Id
);
303 wxCHECK( item
!= NULL
, FALSE
, "invalid item id" );
305 return item
->IsChecked();
308 void wxMenu::SetTitle(const wxString
& label
)
310 bool hasNoTitle
= m_title
.IsEmpty();
313 HMENU hMenu
= GetHMENU();
317 if ( !label
.IsEmpty() )
319 if ( !InsertMenu(hMenu
, 0u, MF_BYPOSITION
| MF_STRING
,
320 (unsigned)idMenuTitle
, m_title
) ||
321 !InsertMenu(hMenu
, 1u, MF_BYPOSITION
, (unsigned)-1, NULL
) )
323 wxLogLastError("InsertMenu");
329 if ( label
.IsEmpty() )
331 // remove the title and the separator after it
332 if ( !RemoveMenu(hMenu
, 0, MF_BYPOSITION
) ||
333 !RemoveMenu(hMenu
, 0, MF_BYPOSITION
) )
335 wxLogLastError("RemoveMenu");
341 if ( !ModifyMenu(hMenu
, 0u,
342 MF_BYPOSITION
| MF_STRING
,
343 (unsigned)idMenuTitle
, m_title
) )
345 wxLogLastError("ModifyMenu");
351 // put the title string in bold face
352 if ( !m_title
.IsEmpty() )
355 mii
.cbSize
= sizeof(mii
);
356 mii
.fMask
= MIIM_STATE
;
357 mii
.fState
= MFS_DEFAULT
;
359 if ( !SetMenuItemInfo(hMenu
, (unsigned)idMenuTitle
, FALSE
, &mii
) )
361 wxLogLastError("SetMenuItemInfo");
367 const wxString
wxMenu::GetTitle() const
372 void wxMenu::SetLabel(int Id
, const wxString
& label
)
374 wxMenuItem
*item
= FindItemForId(Id
) ;
378 if (item
->GetSubMenu()==NULL
)
380 HMENU hMenu
= GetHMENU();
382 UINT was_flag
= GetMenuState(hMenu
, Id
, MF_BYCOMMAND
);
383 ModifyMenu(hMenu
, Id
, MF_BYCOMMAND
| MF_STRING
| was_flag
, Id
, label
);
387 wxMenu
*father
= item
->GetSubMenu()->m_topLevelMenu
;
388 wxNode
*node
= father
->m_menuItems
.First() ;
392 wxMenuItem
*matched
= (wxMenuItem
*)node
->Data() ;
396 node
= node
->Next() ;
398 // Here, we have the position.
399 ModifyMenu((HMENU
)father
->m_savehMenu
,i
,
400 MF_BYPOSITION
|MF_STRING
|MF_POPUP
,
401 (UINT
)item
->GetSubMenu()->m_savehMenu
,(const char *)label
) ;
403 item
->SetName(label
);
406 wxString
wxMenu::GetLabel(int id
) const
409 wxMenuItem
*pItem
= FindItemForId(id
) ;
411 label
= pItem
->GetName() ;
413 wxFAIL_MSG("wxMenu::GetLabel: item doesn't exist");
418 bool wxMenu::MSWCommand(WXUINT
WXUNUSED(param
), WXWORD id
)
420 // ignore commands from the menu title
422 // NB: VC++ generates wrong assembler for `if ( id != idMenuTitle )'!!
423 if ( id
!= (WXWORD
)idMenuTitle
)
425 wxCommandEvent
event(wxEVT_COMMAND_MENU_SELECTED
);
426 event
.SetEventObject( this );
429 ProcessCommand(event
);
435 // Finds the item id matching the given string, -1 if not found.
436 int wxMenu::FindItem (const wxString
& itemString
) const
438 // FIXME fixed size buffer
441 wxStripMenuCodes ((char *)(const char *)itemString
, buf1
);
443 for (wxNode
* node
= m_menuItems
.First (); node
; node
= node
->Next ())
445 wxMenuItem
*item
= (wxMenuItem
*) node
->Data ();
446 if (item
->GetSubMenu())
448 int ans
= item
->GetSubMenu()->FindItem(itemString
);
452 if ( !item
->IsSeparator() )
454 wxStripMenuCodes((char *)item
->GetName().c_str(), buf2
);
455 if (strcmp(buf1
, buf2
) == 0)
456 return item
->GetId();
463 wxMenuItem
*wxMenu::FindItemForId(int itemId
, wxMenu
** itemMenu
) const
467 for (wxNode
* node
= m_menuItems
.First (); node
; node
= node
->Next ())
469 wxMenuItem
*item
= (wxMenuItem
*) node
->Data ();
471 if (item
->GetId() == itemId
)
474 *itemMenu
= (wxMenu
*) this;
478 if (item
->GetSubMenu())
480 wxMenuItem
*ans
= item
->GetSubMenu()->FindItemForId (itemId
, itemMenu
);
491 void wxMenu::SetHelpString(int itemId
, const wxString
& helpString
)
493 wxMenuItem
*item
= FindItemForId (itemId
);
495 item
->SetHelp(helpString
);
497 wxFAIL_MSG("wxMenu::SetHelpString: item doesn't exist");
500 wxString
wxMenu::GetHelpString (int itemId
) const
503 wxMenuItem
*item
= FindItemForId (itemId
);
505 help
= item
->GetHelp();
507 wxFAIL_MSG("wxMenu::GetHelpString: item doesn't exist");
512 void wxMenu::ProcessCommand(wxCommandEvent
& event
)
514 bool processed
= FALSE
;
519 (void)(*(m_callback
))(*this, event
);
523 // Try the menu's event handler
524 if ( !processed
&& GetEventHandler())
526 processed
= GetEventHandler()->ProcessEvent(event
);
529 // Try the window the menu was popped up from (and up through the
531 wxWindow
*win
= GetInvokingWindow();
532 if ( !processed
&& win
)
533 processed
= win
->GetEventHandler()->ProcessEvent(event
);
536 bool wxWindow::PopupMenu(wxMenu
*menu
, int x
, int y
)
538 menu
->SetInvokingWindow(this);
541 HWND hWnd
= (HWND
) GetHWND();
542 HMENU hMenu
= (HMENU
)menu
->m_hMenu
;
546 ::ClientToScreen(hWnd
, &point
);
547 wxCurrentPopupMenu
= menu
;
548 ::TrackPopupMenu(hMenu
, TPM_RIGHTBUTTON
, point
.x
, point
.y
, 0, hWnd
, NULL
);
550 wxCurrentPopupMenu
= NULL
;
552 menu
->SetInvokingWindow(NULL
);
558 wxMenuBar::wxMenuBar()
560 m_eventHandler
= this;
564 m_menuBarFrame
= NULL
;
568 wxMenuBar::wxMenuBar( long WXUNUSED(style
) )
570 m_eventHandler
= this;
574 m_menuBarFrame
= NULL
;
578 wxMenuBar::wxMenuBar(int N
, wxMenu
*Menus
[], const wxString Titles
[])
580 m_eventHandler
= this;
583 m_titles
= new wxString
[N
];
585 for ( i
= 0; i
< N
; i
++ )
586 m_titles
[i
] = Titles
[i
];
587 m_menuBarFrame
= NULL
;
588 for (i
= 0; i
< N
; i
++)
589 m_menus
[i
]->m_menuBar
= (wxMenuBar
*) this;
594 wxMenuBar::~wxMenuBar()
596 // In fact, don't want menu to be destroyed before MDI
597 // shuffling has taken place. Let it be destroyed
598 // automatically when the window is destroyed.
600 // DestroyMenu(menu);
605 // See remarks in ::~wxMenu() method
606 // BEWARE - this may interfere with MDI fixes, so
607 // may need to remove
610 if (m_menuBarFrame && ((m_menuBarFrame->GetWindowStyleFlag() & wxSDI) == wxSDI))
613 N = GetMenuItemCount(menu) ;
614 for (i = N-1; i >= 0; i--)
615 RemoveMenu(menu, i, MF_BYPOSITION);
618 for (i
= 0; i
< m_menuCount
; i
++)
625 /* Don't destroy menu here, in case we're MDI and
626 need to do some shuffling with VALID menu handles.
633 // Must only be used AFTER menu has been attached to frame,
634 // otherwise use individual menus to enable/disable items
635 void wxMenuBar::Enable(int Id
, bool enable
)
637 int flag
= enable
? MF_ENABLED
: MF_GRAYED
;
639 wxMenu
*itemMenu
= NULL
;
640 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
642 wxCHECK_RET( item
, "attempt to enable an item which doesn't exist" );
644 EnableMenuItem(GetHMENU(), Id
, MF_BYCOMMAND
| flag
);
647 void wxMenuBar::EnableTop(int pos
, bool enable
)
649 int flag
= enable
? MF_ENABLED
: MF_GRAYED
;;
651 EnableMenuItem((HMENU
)m_hMenu
, pos
, MF_BYPOSITION
| flag
);
652 DrawMenuBar((HWND
) m_menuBarFrame
->GetHWND()) ;
655 // Must only be used AFTER menu has been attached to frame,
656 // otherwise use individual menus
657 void wxMenuBar::Check(int Id
, bool check
)
659 wxMenu
*itemMenu
= NULL
;
660 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
662 wxCHECK_RET( item
, "attempt to check an item which doesn't exist" );
663 wxCHECK_RET( item
->IsCheckable(), "attempt to check an uncheckable item" );
665 int flag
= check
? MF_CHECKED
: MF_UNCHECKED
;
666 CheckMenuItem(GetHMENU(), Id
, MF_BYCOMMAND
| flag
);
669 bool wxMenuBar::IsChecked(int Id
) const
671 wxMenu
*itemMenu
= NULL
;
672 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
674 wxCHECK_MSG( item
, FALSE
, "wxMenuItem::IsChecked(): no such item" );
676 int flag
= ::GetMenuState(GetHMENU(), Id
, MF_BYCOMMAND
);
678 return (flag
& MF_CHECKED
) != 0;
681 bool wxMenuBar::IsEnabled(int Id
) const
683 wxMenu
*itemMenu
= NULL
;
684 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
686 wxCHECK_MSG( item
, FALSE
, "wxMenuItem::IsEnabled(): no such item" );
688 int flag
= ::GetMenuState(GetHMENU(), Id
, MF_BYCOMMAND
) ;
690 return (flag
& MF_ENABLED
) != 0;
693 void wxMenuBar::SetLabel(int Id
, const wxString
& label
)
695 wxMenu
*itemMenu
= NULL
;
696 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
701 HMENU hMenu
= GetHMENU();
702 UINT was_flag
= ::GetMenuState(hMenu
, Id
, MF_BYCOMMAND
);
703 ::ModifyMenu(hMenu
, Id
, MF_BYCOMMAND
| MF_STRING
| was_flag
, Id
, label
);
706 wxString
wxMenuBar::GetLabel(int Id
) const
708 wxMenu
*itemMenu
= NULL
;
709 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
711 wxCHECK_MSG( item
, "", "wxMenuItem::GetLabel(): no such item" );
714 int len
= GetMenuString(GetHMENU(), Id
, tmp
, WXSIZEOF(tmp
), MF_BYCOMMAND
);
717 return wxString(tmp
);
720 void wxMenuBar::SetLabelTop(int pos
, const wxString
& label
)
722 UINT was_flag
= GetMenuState((HMENU
)m_hMenu
,pos
,MF_BYPOSITION
) ;
723 if (was_flag
&MF_POPUP
)
726 HMENU popup
= GetSubMenu((HMENU
)m_hMenu
,pos
) ;
727 ModifyMenu((HMENU
)m_hMenu
,pos
,MF_BYPOSITION
|MF_STRING
|was_flag
,(UINT
)popup
,(const char *)label
) ;
730 ModifyMenu((HMENU
)m_hMenu
,pos
,MF_BYPOSITION
|MF_STRING
|was_flag
,pos
,(const char *)label
) ;
733 wxString
wxMenuBar::GetLabelTop(int pos
) const
735 static char tmp
[128] ;
736 int len
= GetMenuString((HMENU
)m_hMenu
,pos
,tmp
,127,MF_BYPOSITION
) ;
738 return wxString(tmp
);
741 bool wxMenuBar::OnDelete(wxMenu
*a_menu
, int pos
)
746 if (RemoveMenu((HMENU
)m_hMenu
, (UINT
)pos
, MF_BYPOSITION
)) {
747 m_menus
[pos
]->m_hMenu
= m_menus
[pos
]->m_savehMenu
;
748 m_menus
[pos
]->m_savehMenu
= 0;
750 if (m_menuBarFrame
) {
751 DrawMenuBar((HWND
) m_menuBarFrame
->GetHWND()) ;
760 bool wxMenuBar::OnAppend(wxMenu
*a_menu
, const char *title
)
762 if (!a_menu
->m_hMenu
)
768 a_menu
->m_savehMenu
= a_menu
->m_hMenu
;
771 AppendMenu((HMENU
)m_hMenu
, MF_POPUP
| MF_STRING
, (UINT
)a_menu
->m_savehMenu
, title
);
773 DrawMenuBar((HWND
)m_menuBarFrame
->GetHWND());
778 void wxMenuBar::Append (wxMenu
* menu
, const wxString
& title
)
780 if (!OnAppend(menu
, title
))
784 wxMenu
**new_menus
= new wxMenu
*[m_menuCount
];
785 wxString
*new_titles
= new wxString
[m_menuCount
];
788 for (i
= 0; i
< m_menuCount
- 1; i
++)
790 new_menus
[i
] = m_menus
[i
];
792 new_titles
[i
] = m_titles
[i
];
801 m_titles
= new_titles
;
803 m_menus
[m_menuCount
- 1] = (wxMenu
*)menu
;
804 m_titles
[m_menuCount
- 1] = title
;
806 ((wxMenu
*)menu
)->m_menuBar
= (wxMenuBar
*) this;
807 ((wxMenu
*)menu
)->SetParent(this);
810 void wxMenuBar::Delete(wxMenu
* menu
, int i
)
816 for (ii
= 0; ii
< m_menuCount
; ii
++) {
817 if (m_menus
[ii
] == menu
)
820 if (ii
>= m_menuCount
)
823 if (ii
< 0 || ii
>= m_menuCount
)
828 if (!OnDelete(menu
, ii
))
831 menu
->SetParent(NULL
);
834 for (j
= ii
; j
< m_menuCount
; j
++) {
835 m_menus
[j
] = m_menus
[j
+ 1];
836 m_titles
[j
] = m_titles
[j
+ 1];
840 // Find the menu menuString, item itemString, and return the item id.
841 // Returns -1 if none found.
842 int wxMenuBar::FindMenuItem (const wxString
& menuString
, const wxString
& itemString
) const
846 wxStripMenuCodes ((char *)(const char *)menuString
, buf1
);
848 for (i
= 0; i
< m_menuCount
; i
++)
850 wxStripMenuCodes ((char *)(const char *)m_titles
[i
], buf2
);
851 if (strcmp (buf1
, buf2
) == 0)
852 return m_menus
[i
]->FindItem (itemString
);
857 wxMenuItem
*wxMenuBar::FindItemForId (int Id
, wxMenu
** itemMenu
) const
862 wxMenuItem
*item
= NULL
;
864 for (i
= 0; i
< m_menuCount
; i
++)
866 item
= m_menus
[i
]->FindItemForId (Id
, itemMenu
);
873 void wxMenuBar::SetHelpString (int Id
, const wxString
& helpString
)
876 for (i
= 0; i
< m_menuCount
; i
++)
878 if (m_menus
[i
]->FindItemForId (Id
))
880 m_menus
[i
]->SetHelpString (Id
, helpString
);
886 wxString
wxMenuBar::GetHelpString (int Id
) const
890 for (int i
= 0; i
< m_menuCount
; i
++)
892 wxMenuItem
*item
= m_menus
[i
]->FindItemForId(Id
);
895 helpString
= item
->GetHelp();
904 // ----------------------------------------------------------------------------
906 // ----------------------------------------------------------------------------
908 wxWindow
*wxMenu::GetWindow() const
910 if ( m_pInvokingWindow
!= NULL
)
911 return m_pInvokingWindow
;
912 else if ( m_menuBar
!= NULL
)
913 return m_menuBar
->m_menuBarFrame
;
918 WXHMENU
wxMenu::GetHMenu() const
922 else if ( m_savehMenu
!= 0 )
925 wxFAIL_MSG("wxMenu without HMENU");
930 // Update a menu and all submenus recursively. source is the object that has
931 // the update event handlers defined for it. If NULL, the menu or associated
932 // window will be used.
933 void wxMenu::UpdateUI(wxEvtHandler
* source
)
935 if (!source
&& GetInvokingWindow())
936 source
= GetInvokingWindow()->GetEventHandler();
938 source
= GetEventHandler();
942 wxNode
* node
= GetItems().First();
945 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
946 if ( !item
->IsSeparator() )
948 wxWindowID id
= item
->GetId();
949 wxUpdateUIEvent
event(id
);
950 event
.SetEventObject( source
);
952 if (source
->ProcessEvent(event
))
954 if (event
.GetSetText())
955 SetLabel(id
, event
.GetText());
956 if (event
.GetSetChecked())
957 Check(id
, event
.GetChecked());
958 if (event
.GetSetEnabled())
959 Enable(id
, event
.GetEnabled());
962 if (item
->GetSubMenu())
963 item
->GetSubMenu()->UpdateUI(source
);