X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..9ed79eee4ee3f8c83a87094eef4b7c933663001b:/src/os2/menuitem.cpp diff --git a/src/os2/menuitem.cpp b/src/os2/menuitem.cpp index 27302245d3..9a0ed81340 100644 --- a/src/os2/menuitem.cpp +++ b/src/os2/menuitem.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: menuitem.cpp +// Name: src/os2/menuitem.cpp // Purpose: wxMenuItem implementation // Author: David Webster // Modified by: @@ -16,20 +16,20 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#include "wx/menuitem.h" +#include "wx/stockitem.h" + #ifndef WX_PRECOMP #include "wx/font.h" #include "wx/bitmap.h" #include "wx/settings.h" - #include "wx/font.h" #include "wx/window.h" #include "wx/accel.h" #include "wx/menu.h" #include "wx/string.h" + #include "wx/log.h" #endif -#include "wx/menuitem.h" -#include "wx/log.h" - #if wxUSE_ACCEL #include "wx/accel.h" #endif // wxUSE_ACCEL @@ -373,10 +373,18 @@ void wxMenuItem::SetText( const wxString& rText ) if (m_text == sText) return; + // wxMenuItemBase will do stock ID checks wxMenuItemBase::SetText(sText); - OWNER_DRAWN_ONLY(wxOwnerDrawn::SetName(sText)); + + // 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 - SetAccelString(rText.AfterFirst(_T('\t'))); + if (rText.IsEmpty()) + SetAccelString(m_text.AfterFirst(_T('\t'))); + else + SetAccelString(rText.AfterFirst(_T('\t'))); #endif // wxUSE_OWNER_DRAWN HWND hMenu = GetHmenuOf(m_parentMenu); @@ -419,7 +427,7 @@ void wxMenuItem::SetText( const wxString& rText ) #endif //owner drawn { uFlagsOld |= MIS_TEXT; - pData = (BYTE*)sText.c_str(); + pData = (BYTE*)m_text.c_str(); } //