]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/menuitem.cpp
Better sorting example and better default
[wxWidgets.git] / src / os2 / menuitem.cpp
index 2a5f3785845571f5513be80e1aab38c200794a52..921cfd2cbe4c633f6ce423185c3427aabb62b286 100644 (file)
@@ -373,17 +373,16 @@ void wxMenuItem::SetText( const wxString& rText )
     if (m_text == sText)
         return;
 
-    if (sText.IsEmpty())
-    {
-        wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
-        sText = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
-    }
-
+    // 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
     if (rText.IsEmpty())
-        SetAccelString(sText.AfterFirst(_T('\t')));
+        SetAccelString(m_text.AfterFirst(_T('\t')));
     else
         SetAccelString(rText.AfterFirst(_T('\t')));
 #endif // wxUSE_OWNER_DRAWN
@@ -416,19 +415,19 @@ void wxMenuItem::SetText( const wxString& rText )
             uFlagsOld |= MIS_SUBMENU;
         }
 
-        BYTE*                       pData;
+        char*                       pData;
 
 #if wxUSE_OWNER_DRAWN
         if (IsOwnerDrawn())
         {
             uFlagsOld |= MIS_OWNERDRAW;
-            pData = (BYTE*)this;
+            pData = (char*)this;
         }
         else
 #endif  //owner drawn
         {
             uFlagsOld |= MIS_TEXT;
-            pData = (BYTE*)sText.c_str();
+            pData = (char*) m_text.wx_str();
         }
 
         //