-void wxMenu::SetLabel(int Id, const wxString& label)
-{
- wxMenuItem *item = FindItemForId(Id) ;
- if (item==NULL)
- return;
-
- if (item->GetSubMenu()==NULL)
- {
- HMENU hMenu = GetHMENU();
-
- UINT was_flag = GetMenuState(hMenu, Id, MF_BYCOMMAND);
- ModifyMenu(hMenu, Id, MF_BYCOMMAND | MF_STRING | was_flag, Id, label);
- }
- else
- {
- wxMenu *father = item->GetSubMenu()->m_topLevelMenu ;
- wxNode *node = father->m_menuItems.First() ;
- int i = 0 ;
- while (node)
- {
- wxMenuItem *matched = (wxMenuItem*)node->Data() ;
- if (matched==item)
- break ;
- i++ ;
- node = node->Next() ;
- }
- // Here, we have the position.
- ModifyMenu((HMENU)father->m_savehMenu,i,
- MF_BYPOSITION|MF_STRING|MF_POPUP,
- (UINT)item->GetSubMenu()->m_savehMenu,(const char *)label) ;
- }
- item->SetName(label);
-}
-
-wxString wxMenu::GetLabel(int id) const
-{
- wxString label;
- wxMenuItem *pItem = FindItemForId(id) ;
- if (pItem)
- label = pItem->GetName() ;
- else
- wxFAIL_MSG("wxMenu::GetLabel: item doesn't exist");
-
- return label;
-}