]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/menuitem.cpp
no real change: rename wxPendingEvents to wxHandlersWithPendingEvents since its curre...
[wxWidgets.git] / src / os2 / menuitem.cpp
index f72deae3e1555afb1811c2484d38697702b13c9c..193a679348df0e0fa44aff4b27ff0dff7e314989 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"
@@ -179,7 +180,7 @@ bool wxMenuItem::IsChecked() const
     return (uFlag & MIA_CHECKED) == MIA_CHECKED ;
 } // end of wxMenuItem::IsChecked
 
-wxString wxMenuItemBase::GetLabelFromText(
+wxString wxMenuItemBase::GetLabelText(
   const wxString&                   rsText
 )
 {
@@ -198,7 +199,7 @@ wxString wxMenuItemBase::GetLabelFromText(
         sLabel += *zPc;
     }
     return sLabel;
-} // end of wxMenuItemBase::GetLabelFromText
+} // end of wxMenuItemBase::GetLabelText
 
 //
 // Radio group stuff
@@ -362,7 +363,7 @@ void wxMenuItem::Check(
     wxMenuItemBase::Check(bCheck);
 } // end of wxMenuItem::Check
 
-void wxMenuItem::SetText( const wxString& rText )
+void wxMenuItem::SetItemLabel( const wxString& rText )
 {
     //
     // Don't do anything if label didn't change
@@ -372,10 +373,18 @@ void wxMenuItem::SetText( const wxString& rText )
     if (m_text == sText)
         return;
 
-    wxMenuItemBase::SetText(sText);
-    OWNER_DRAWN_ONLY(wxOwnerDrawn::SetName(sText));
+    // wxMenuItemBase will do stock ID checks
+    wxMenuItemBase::SetItemLabel(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);
@@ -406,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();
         }
 
         //