-// Finds the item id matching the given string, -1 if not found.
-int wxMenu::FindItem (const wxString& itemString) const
-{
- // FIXME fixed size buffer
- char buf1[200];
- char buf2[200];
- wxStripMenuCodes ((char *)(const char *)itemString, buf1);
-
- for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
- {
- wxMenuItem *item = (wxMenuItem *) node->Data ();
- if (item->GetSubMenu())
- {
- int ans = item->GetSubMenu()->FindItem(itemString);
- if (ans > -1)
- return ans;
- }
- if ( !item->IsSeparator() )
- {
- wxStripMenuCodes((char *)item->GetName().c_str(), buf2);
- if (strcmp(buf1, buf2) == 0)
- return item->GetId();
- }
- }
-
- return wxNOT_FOUND;
-}
-
-wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
-{
- if (itemMenu)
- *itemMenu = NULL;
- for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
- {
- wxMenuItem *item = (wxMenuItem *) node->Data ();
-
- if (item->GetId() == itemId)
- {
- if (itemMenu)
- *itemMenu = (wxMenu *) this;
- return item;
- }
-
- if (item->GetSubMenu())
- {
- wxMenuItem *ans = item->GetSubMenu()->FindItemForId (itemId, itemMenu);
- if (ans)
- return ans;
- }
- }
-
- if (itemMenu)
- *itemMenu = NULL;
- return NULL;
-}
-
-void wxMenu::SetHelpString(int itemId, const wxString& helpString)
-{
- wxMenuItem *item = FindItemForId (itemId);
- if (item)
- item->SetHelp(helpString);
- else
- wxFAIL_MSG("wxMenu::SetHelpString: item doesn't exist");
-}
-
-wxString wxMenu::GetHelpString (int itemId) const
-{
- wxString help;
- wxMenuItem *item = FindItemForId (itemId);
- if (item)
- help = item->GetHelp();
- else
- wxFAIL_MSG("wxMenu::GetHelpString: item doesn't exist");
-
- return help;
-}
-
-void wxMenu::ProcessCommand(wxCommandEvent & event)