]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/menuitem.cpp
fixed compilation problem with old gcc releases
[wxWidgets.git] / src / os2 / menuitem.cpp
index 1d960c605b06481777659b18c361ac97594d075d..9b5bc2fed425ee3de751cf36bc28149d5c9c3749 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
@@ -118,11 +110,12 @@ wxMenuItem::wxMenuItem(
 , int                               nId
 , const wxString&                   rText
 , const wxString&                   rStrHelp
-, bool                              bCheckable
+, wxItemKind                        kind
 , wxMenu*                           pSubMenu
 )
+: wxMenuItemBase(pParentMenu, nId, rText, rStrHelp, kind, pSubMenu)
 #if wxUSE_OWNER_DRAWN
-:  wxOwnerDrawn( TextToLabel(rText)
+,  wxOwnerDrawn( TextToLabel(rText)
                 ,bCheckable
                )
 #endif // owner drawn
@@ -134,7 +127,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));
@@ -147,14 +140,8 @@ wxMenuItem::wxMenuItem(
     #undef  SYS_COLOR
 #endif // wxUSE_OWNER_DRAWN
 
-    m_parentMenu  = pParentMenu;
-    m_subMenu     = pSubMenu;
-    m_isEnabled   = TRUE;
-    m_isChecked   = FALSE;
-    m_id          = nId;
     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
@@ -208,18 +195,6 @@ wxString wxMenuItemBase::GetLabelFromText(
     return label;
 }
 
-// accelerators
-// ------------
-
-#if wxUSE_ACCEL
-
-wxAcceleratorEntry *wxMenuItem::GetAccel() const
-{
-    return wxGetAccelFromString(GetText());
-}
-
-#endif // wxUSE_ACCEL
-
 // change item state
 // -----------------
 
@@ -256,7 +231,7 @@ void wxMenuItem::Check(
 {
     bool                            bOk;
 
-    wxCHECK_RET( m_isCheckable, wxT("only checkable items may be checked") );
+    wxCHECK_RET( IsCheckable(), wxT("only checkable items may be checked") );
     if (m_isChecked == bCheck)
         return;
     if (bCheck)
@@ -379,7 +354,7 @@ wxMenuItem* wxMenuItemBase::New(
 , int                               nId
 , const wxString&                   rName
 , const wxString&                   rHelp
-, bool                              bIsCheckable
+, wxItemKind                        kind
 , wxMenu*                           pSubMenu
 )
 {
@@ -387,7 +362,7 @@ wxMenuItem* wxMenuItemBase::New(
                           ,nId
                           ,rName
                           ,rHelp
-                          ,bIsCheckable
+                          ,kind
                           ,pSubMenu
                          );
 } // end of wxMenuItemBase::New