wxItemKind kind,
wxMenu *subMenu)
{
- wxASSERT_MSG( parentMenu != NULL, wxT("menuitem should have a menu") );
+ // notice that parentMenu can be NULL: the item can be attached to the menu
+ // later with SetMenu()
m_parentMenu = parentMenu;
m_subMenu = subMenu;
m_id = id;
m_kind = kind;
if (m_id == wxID_ANY)
- m_id = wxNewId();
+ m_id = wxWindow::NewControlId();
if (m_id == wxID_SEPARATOR)
m_kind = wxITEM_SEPARATOR;
}
}
+#ifndef __WXPM__
+wxString wxMenuItemBase::GetLabelText(const wxString& text)
+{
+ return wxStripMenuCodes(text);
+}
+#endif
+
#if WXWIN_COMPATIBILITY_2_8
wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
{
void wxMenuBase::Init(long style)
{
- m_menuBar = (wxMenuBar *)NULL;
- m_menuParent = (wxMenu *)NULL;
+ m_menuBar = NULL;
+ m_menuParent = NULL;
- m_invokingWindow = (wxWindow *)NULL;
+ m_invokingWindow = NULL;
m_style = style;
- m_clientData = (void *)NULL;
+ m_clientData = NULL;
m_eventHandler = this;
}
wxMenuBase::~wxMenuBase()
{
WX_CLEAR_LIST(wxMenuItemList, m_items);
-
- // Actually, in GTK, the submenus have to get deleted first.
}
// ----------------------------------------------------------------------------
void wxMenuBase::AddSubMenu(wxMenu *submenu)
{
- wxCHECK_RET( submenu, _T("can't add a NULL submenu") );
+ wxCHECK_RET( submenu, wxT("can't add a NULL submenu") );
submenu->SetParent((wxMenu *)this);
}
m_items.Erase(node);
// item isn't attached to anything any more
- item->SetMenu((wxMenu *)NULL);
+ item->SetMenu(NULL);
wxMenu *submenu = item->GetSubMenu();
if ( submenu )
{
- submenu->SetParent((wxMenu *)NULL);
+ submenu->SetParent(NULL);
if ( submenu->IsAttached() )
submenu->Detach();
}
wxCHECK_MSG( item2, false, wxT("failed to delete menu item") );
// don't delete the submenu
- item2->SetSubMenu((wxMenu *)NULL);
+ item2->SetSubMenu(NULL);
delete item2;
// non recursive search
wxMenuItem *wxMenuBase::FindChildItem(int id, size_t *ppos) const
{
- wxMenuItem *item = (wxMenuItem *)NULL;
+ wxMenuItem *item = NULL;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
size_t pos;
wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const
{
wxCHECK_MSG( position < m_items.GetCount(), NULL,
- _T("wxMenu::FindItemByPosition(): invalid menu index") );
+ wxT("wxMenu::FindItemByPosition(): invalid menu index") );
return m_items.Item( position )->GetData();
}
{
wxEvtHandler *handler = GetEventHandler();
if ( handler )
- processed = handler->ProcessEvent(event);
+ processed = handler->SafelyProcessEvent(event);
}
// Try the window the menu was popped up from (and up through the
wxWindow *win = menu->GetInvokingWindow();
if ( win )
{
- processed = win->GetEventHandler()->ProcessEvent(event);
+ processed = win->HandleWindowEvent(event);
break;
}
void wxMenuBase::Attach(wxMenuBarBase *menubar)
{
// use Detach() instead!
- wxASSERT_MSG( menubar, _T("menu can't be attached to NULL menubar") );
+ wxASSERT_MSG( menubar, wxT("menu can't be attached to NULL menubar") );
// use IsAttached() to prevent this from happening
- wxASSERT_MSG( !m_menuBar, _T("attaching menu twice?") );
+ wxASSERT_MSG( !m_menuBar, wxT("attaching menu twice?") );
m_menuBar = (wxMenuBar *)menubar;
}
void wxMenuBase::Detach()
{
// use IsAttached() to prevent this from happening
- wxASSERT_MSG( m_menuBar, _T("detaching unattached menu?") );
+ wxASSERT_MSG( m_menuBar, wxT("detaching unattached menu?") );
m_menuBar = NULL;
}
return item->GetHelp();
}
-void wxMenuBarBase::UpdateMenus( void )
+void wxMenuBarBase::UpdateMenus()
{
wxEvtHandler* source;
wxMenu* menu;
}
#endif
-
#endif // wxUSE_MENUS