X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d93b98740c3907268b7edc0afaa7521f3e6dc8ba..fd08ccd2466e64d5de0ab2a8aaa4455a74fe9eb0:/src/common/menucmn.cpp diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 5625dd8f63..75ab6ef07c 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -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)