// ----------------------------------------------------------------------------
// the (popup) menu title has this special id
-static const int idMenuTitle = -3;
+static const UINT idMenuTitle = (UINT)-3;
// ----------------------------------------------------------------------------
// private functions
for( size_t i = 0 ; i < GetMenuCount() ; ++i )
{
wxMenuInfo* info = new wxMenuInfo() ;
- info->Create( const_cast<wxMenuBar*>(this)->GetMenu(i) , GetLabelTop(i) ) ;
+ info->Create( const_cast<wxMenuBar*>(this)->GetMenu(i) , GetMenuLabel(i) ) ;
list->Append( info ) ;
}
return m_menuInfos ;
}
// find the (new) accel for this item
- wxAcceleratorEntry *accel = wxAcceleratorEntry::Create(item->GetText());
+ wxAcceleratorEntry *accel = wxAcceleratorEntry::Create(item->GetItemLabel());
if ( accel )
accel->m_command = item->GetId();
flags |= MF_POPUP;
}
else {
- id = pItem->GetId();
+ id = pItem->GetMSWId();
}
// prepare to insert the item in the menu
- wxString itemText = pItem->GetText();
+ wxString itemText = pItem->GetItemLabel();
LPCTSTR pData = NULL;
if ( pos == (size_t)-1 )
{
flags |= MF_STRING;
#ifdef __WXWINCE__
- itemText = wxMenuItem::GetLabelFromText(itemText);
+ itemText = wxMenuItem::GetLabelText(itemText);
#endif
pData = (wxChar*)itemText.wx_str();
// if we just appended the title, highlight it
- if ( (int)id == idMenuTitle )
+ if ( id == idMenuTitle )
{
// visually select the menu title
SetDefaultMenuItem(GetHmenu(), id);
if ( !label.empty() )
{
if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
- (unsigned)idMenuTitle, m_title.wx_str()) ||
+ idMenuTitle, m_title.wx_str()) ||
!::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
{
wxLogLastError(wxT("InsertMenu"));
#else
if ( !ModifyMenu(hMenu, 0u,
MF_BYPOSITION | MF_STRING,
- (unsigned)idMenuTitle, m_title.wx_str()) )
+ idMenuTitle, m_title.wx_str()) )
{
wxLogLastError(wxT("ModifyMenu"));
}
// put the title string in bold face
if ( !m_title.empty() )
{
- SetDefaultMenuItem(GetHmenu(), (UINT)idMenuTitle);
+ SetDefaultMenuItem(GetHmenu(), idMenuTitle);
}
#endif // Win32
}
// event processing
// ---------------------------------------------------------------------------
-bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id)
+bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id_)
{
+ const int id = (signed short)id_;
+
// ignore commands from the menu title
- if ( id != (WXWORD)idMenuTitle )
+ if ( id != idMenuTitle )
{
// update the check item when it's clicked
wxMenuItem * const item = FindItem(id);
{
HMENU hPopupMenu = (HMENU) GetMenu(i)->GetHMenu();
tbButton.dwData = (DWORD)hPopupMenu;
- wxString label = wxStripMenuCodes(GetLabelTop(i));
+ wxString label = wxStripMenuCodes(GetMenuLabel(i));
tbButton.iString = (int) label.wx_str();
tbButton.idCommand = NewControlId();
Refresh();
}
-void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
+void wxMenuBar::SetMenuLabel(size_t pos, const wxString& label)
{
wxCHECK_RET( pos < GetMenuCount(), wxT("invalid menu index") );
Refresh();
}
-wxString wxMenuBar::GetLabelTop(size_t pos) const
+wxString wxMenuBar::GetMenuLabel(size_t pos) const
{
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
- wxT("invalid menu index in wxMenuBar::GetLabelTop") );
+ wxT("invalid menu index in wxMenuBar::GetMenuLabel") );
- return wxMenuItem::GetLabelFromText(m_titles[pos]);
+ return m_titles[pos];
}
// ---------------------------------------------------------------------------