]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/menucmn.cpp
Make wxRefCounter non copyable.
[wxWidgets.git] / src / common / menucmn.cpp
index 5625dd8f6331f13c86e560a2764c9c5b53e02ab3..75ab6ef07c23a6bc578fa16a80328b83e30a528a 100644 (file)
@@ -67,7 +67,19 @@ wxMenuItemBase::wxMenuItemBase(wxMenu *parentMenu,
 
         case wxID_SEPARATOR:
             m_id = wxID_SEPARATOR;
-            m_kind = wxITEM_SEPARATOR;
+
+            // there is a lot of existing code just doing Append(wxID_SEPARATOR)
+            // and it makes sense to omit the following optional parameters,
+            // including the kind one which doesn't default to wxITEM_SEPARATOR,
+            // of course, so override it here
+            kind = wxITEM_SEPARATOR;
+            break;
+
+        case wxID_NONE:
+            // (popup) menu titles in wxMSW use this ID to indicate that
+            // it's not a real menu item, so we don't want the check below to
+            // apply to it
+            m_id = id;
             break;
 
         default:
@@ -87,7 +99,6 @@ wxMenuItemBase::wxMenuItemBase(wxMenu *parentMenu,
     m_subMenu     = subMenu;
     m_isEnabled   = true;
     m_isChecked   = false;
-    m_id          = id;
     m_kind        = kind;
 
     SetItemLabel(text);
@@ -103,7 +114,9 @@ wxMenuItemBase::~wxMenuItemBase()
 
 wxAcceleratorEntry *wxMenuItemBase::GetAccel() const
 {
-    return wxAcceleratorEntry::Create(GetItemLabel());
+    const wxString accel = GetItemLabel().AfterFirst(wxT('\t'));
+
+    return accel.empty() ? NULL : wxAcceleratorEntry::Create(accel);
 }
 
 void wxMenuItemBase::SetAccel(wxAcceleratorEntry *accel)