]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/menuitem.cpp
ignore dmc_lib (Digital Mars build directory)
[wxWidgets.git] / src / os2 / menuitem.cpp
index f72deae3e1555afb1811c2484d38697702b13c9c..9a0ed8134035ec6d9c425efa62ab0ed600842539 100644 (file)
@@ -17,6 +17,7 @@
 #include "wx/wxprec.h"
 
 #include "wx/menuitem.h"
+#include "wx/stockitem.h"
 
 #ifndef WX_PRECOMP
     #include "wx/font.h"
@@ -372,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);
@@ -418,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();
         }
 
         //