void wxMenu::Delete(int id)
{
wxNode *node;
- wxMenuItem *item;
int pos;
HMENU menu;
+ wxMenuItem *item = NULL;
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++) {
item = (wxMenuItem *)node->Data();
if (item->GetId() == id)
{
if ( !label.IsEmpty() )
{
- if ( !InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING,
- idMenuTitle, m_title) ||
- !InsertMenu(hMenu, 1, MF_BYPOSITION, -1, NULL) )
+ if ( !InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
+ (unsigned)idMenuTitle, m_title) ||
+ !InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
{
wxLogLastError("InsertMenu");
}
else
{
// modify the title
- if ( !ModifyMenu(hMenu, 0,
+ if ( !ModifyMenu(hMenu, 0u,
MF_BYPOSITION | MF_STRING,
- idMenuTitle, m_title) )
+ (unsigned)idMenuTitle, m_title) )
{
wxLogLastError("ModifyMenu");
}
bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id)
{
- wxCommandEvent event(wxEVENT_TYPE_MENU_COMMAND);
+ wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED);
event.SetEventObject( this );
event.SetId( id );
event.SetInt( id );
wxString wxMenu::GetHelpString (int itemId) const
{
wxMenuItem *item = FindItemForId (itemId);
- wxString str("");
- return (item == NULL) ? str : item->GetHelp();
+ if (item)
+ return item->GetHelp();
+ else
+ return wxEmptyString;
}
void wxMenu::ProcessCommand(wxCommandEvent & event)
if (!item)
return FALSE;
- int Flag ;
+ int Flag = 0;
if (itemMenu->m_hMenu)
Flag=GetMenuState((HMENU)itemMenu->m_hMenu, Id, MF_BYCOMMAND) ;
wxMenuItem *item = NULL;
int i;
for (i = 0; i < m_menuCount; i++)
- if ((item = m_menus[i]->FindItemForId (Id, itemMenu)))
+ {
+ item = m_menus[i]->FindItemForId (Id, itemMenu);
+ if (item)
return item;
+ }
return NULL;
}