#if wxUSE_MENUS
#include "wx/menuitem.h"
+#include "wx/stockitem.h"
#ifndef WX_PRECOMP
#include "wx/font.h"
wxMenuItemBase::Check(check);
}
-void wxMenuItem::SetText(const wxString& text)
+void wxMenuItem::SetText(const wxString& txt)
{
+ wxString text = txt;
+
// don't do anything if label didn't change
- if ( m_text == text )
+ if ( m_text == txt )
return;
+ // wxMenuItemBase will do stock ID checks
wxMenuItemBase::SetText(text);
- OWNER_DRAWN_ONLY( wxOwnerDrawn::SetName(text) );
+
+ // m_text could now be different from 'text' if we are a stock menu item,
+ // so use only m_text below
+
+ OWNER_DRAWN_ONLY( wxOwnerDrawn::SetName(m_text) );
#if wxUSE_OWNER_DRAWN
// tell the owner drawing code to to show the accel string as well
- SetAccelString(text.AfterFirst(_T('\t')));
+ SetAccelString(m_text.AfterFirst(_T('\t')));
#endif
HMENU hMenu = GetHMenuOf(m_parentMenu);
#endif //owner drawn
{
flagsOld |= MF_STRING;
- data = (wxChar*) text.c_str();
+ data = (wxChar*) m_text.c_str();
}
#ifdef __WXWINCE__
info.cbSize = sizeof(info);
info.fMask = MIIM_TYPE;
info.fType = MFT_STRING;
- info.cch = text.length();
+ info.cch = m_text.length();
info.dwTypeData = (LPTSTR) data ;
if ( !::SetMenuItemInfo(hMenu, id, FALSE, & info) )
{