]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/menuitem.cpp
SWIGged updates for wxMSW
[wxWidgets.git] / src / os2 / menuitem.cpp
index af97aab35a6613c776d1a4536afaa0c79e7e2052..761e549f2c263aceabe4c8157be67d2a3b8113ac 100644 (file)
@@ -62,7 +62,7 @@ static wxString TextToLabel(const wxString& rTitle)
 {
     wxString Title;
     const wxChar *pc;
-    for (pc = rTitle; *pc != wxT('\0'); pc++ )
+    for (pc = rTitle.c_str(); *pc != wxT('\0'); pc++ )
     {
         if (*pc == wxT('&') )
         {
@@ -71,13 +71,9 @@ static wxString TextToLabel(const wxString& rTitle)
                 pc++;
                 Title << wxT('&');
             }
-            else 
+            else
                 Title << wxT('~');
         }
-//         else if (*pc == wxT('/'))
-//         {
-//             Title << wxT('\\');
-//         }
         else
         {
             if ( *pc == wxT('~') )
@@ -100,11 +96,7 @@ static wxString TextToLabel(const wxString& rTitle)
 // dynamic classes implementation
 // ----------------------------------------------------------------------------
 
-    #if wxUSE_OWNER_DRAWN
-        IMPLEMENT_DYNAMIC_CLASS2(wxMenuItem, wxMenuItemBase, wxOwnerDrawn)
-    #else   //!USE_OWNER_DRAWN
-        IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxMenuItemBase)
-    #endif  //USE_OWNER_DRAWN
+IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
 
 // ----------------------------------------------------------------------------
 // wxMenuItem
@@ -134,7 +126,7 @@ wxMenuItem::wxMenuItem(
     //
     // Set default menu colors
     //
-    #define SYS_COLOR(c) (wxSystemSettings::GetSystemColour(wxSYS_COLOUR_##c))
+    #define SYS_COLOR(c) (wxSystemSettings::GetColour(wxSYS_COLOUR_##c))
 
     SetTextColour(SYS_COLOR(MENUTEXT));
     SetBackgroundColour(SYS_COLOR(MENU));
@@ -155,6 +147,8 @@ wxMenuItem::wxMenuItem(
     m_text        = TextToLabel(rText);
     m_isCheckable = bCheckable;
     m_help        = rStrHelp;
+    memset(&m_vMenuData, '\0', sizeof(m_vMenuData));
+    m_vMenuData.id= nId;
 } // end of wxMenuItem::wxMenuItem
 
 wxMenuItem::~wxMenuItem()
@@ -206,18 +200,6 @@ wxString wxMenuItemBase::GetLabelFromText(
     return label;
 }
 
-// accelerators
-// ------------
-
-#if wxUSE_ACCEL
-
-wxAcceleratorEntry *wxMenuItem::GetAccel() const
-{
-    return wxGetAccelFromString(GetText());
-}
-
-#endif // wxUSE_ACCEL
-
 // change item state
 // -----------------
 
@@ -233,13 +215,13 @@ void wxMenuItem::Enable(
         bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
                                  ,MM_SETITEMATTR
                                  ,MPFROM2SHORT(GetRealId(), TRUE)
-                                 ,MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED)
+                                 ,MPFROM2SHORT(MIA_DISABLED, FALSE)
                                 );
     else
         bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
                                  ,MM_SETITEMATTR
                                  ,MPFROM2SHORT(GetRealId(), TRUE)
-                                 ,MPFROM2SHORT(MIA_DISABLED, FALSE)
+                                 ,MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED)
                                 );
     if (!bOk)
     {
@@ -271,7 +253,7 @@ void wxMenuItem::Check(
                                 );
     if (!bOk)
     {
-        wxLogLastError("EnableMenuItem");
+        wxLogLastError("CheckMenuItem");
     }
     wxMenuItemBase::Check(bCheck);
 } // end of wxMenuItem::Check