- }
- else // not a radio item
- {
- EndRadioGroup();
- }
-
- if ( !wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item) )
- return NULL;
-
- if ( check )
- // check the item initially
- item->Check(true);
-
- return item;
-}
-
-wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
-{
- if (wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos))
- return item;
-
- return NULL;
-}
-
-wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
-{
- // we need to find the items position in the child list
- size_t pos;
- wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
-
- for ( pos = 0; node; pos++ )
- {
- if ( node->GetData() == item )
- break;
-
- node = node->GetNext();
- }
-
- // DoRemove() (unlike Remove) can only be called for existing item!
- wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
-
- ::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
-
- if ( IsAttached() && GetMenuBar()->IsAttached() )
- // otherwise, the change won't be visible
- GetMenuBar()->Refresh();
-
- // and from internal data structures
- return wxMenuBase::DoRemove(item);
-}
-
-void wxMenu::SetTitle(const wxString& label)
-{
- m_title = label ;
- UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label , wxFont::GetDefaultEncoding() ) ;
-}
-
-bool wxMenu::ProcessCommand(wxCommandEvent & event)
-{
- bool processed = false;
-
- // Try the menu's event handler
- if ( /* !processed && */ GetEventHandler())
- processed = GetEventHandler()->SafelyProcessEvent(event);
-
- // Try the window the menu was popped up from
- // (and up through the hierarchy)
- wxWindow *win = GetInvokingWindow();
- if ( !processed && win )
- processed = win->HandleWindowEvent(event);
-
- return processed;
-}
-
-// ---------------------------------------------------------------------------
-// other
-// ---------------------------------------------------------------------------
-
-wxWindow *wxMenu::GetWindow() const
-{
- if ( m_invokingWindow != NULL )
- return m_invokingWindow;
- else if ( GetMenuBar() != NULL)
- return (wxWindow *) GetMenuBar()->GetFrame();
-
- return NULL;
-}
-
-// helper functions returning the mac menu position for a certain item, note that this is
-// mac-wise 1 - based, i.e. the first item has index 1 whereas on MSWin it has pos 0
-
-int wxMenu::MacGetIndexFromId( int id )
-{
- size_t pos;
- wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
- for ( pos = 0; node; pos++ )
- {
- if ( node->GetData()->GetId() == id )
- break;