// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
-
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
-// wxWindows headers
-// -----------------
-
#ifdef __GNUG__
- #pragma implementation "menu.h"
- #pragma implementation "menuitem.h"
+#pragma implementation "menu.h"
#endif
// For compilers that support precompilation, includes "wx.h".
m_hMenu = (WXHMENU) CreatePopupMenu();
m_savehMenu = 0 ;
m_topLevelMenu = this;
+ m_clientData = (void*) NULL;
+
if (m_title != "")
{
Append(idMenuTitle, m_title) ;
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");
}
item->SetName(label);
}
-wxString wxMenu::GetLabel(int Id) const
+wxString wxMenu::GetLabel(int id) const
{
+/*
static char tmp[128] ;
int len;
if (m_hMenu)
len = 0 ;
tmp[len] = '\0' ;
return wxString(tmp) ;
+
+*/
+ wxMenuItem *pItem = FindItemForId(id) ;
+ if (pItem)
+ return pItem->GetName() ;
+ else
+ return wxEmptyString;
}
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)
// Try the window the menu was popped up from (and up
// through the hierarchy)
if ( !processed && GetInvokingWindow())
- processed = GetInvokingWindow()->ProcessEvent(event);
+ processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event);
}
extern wxMenu *wxCurrentPopupMenu;
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;
}