X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a559d70856c65f8fd91d6e56c3e98c3828e18db7..00b2a5df9502adfd9a14ce01ab603f7906984995:/contrib/src/xml/xh_menu.cpp diff --git a/contrib/src/xml/xh_menu.cpp b/contrib/src/xml/xh_menu.cpp index 94334f41ad..0b42642ed4 100644 --- a/contrib/src/xml/xh_menu.cpp +++ b/contrib/src/xml/xh_menu.cpp @@ -24,7 +24,7 @@ wxMenuXmlHandler::wxMenuXmlHandler() : - wxXmlResourceHandler(), m_InsideMenu(FALSE) + wxXmlResourceHandler(), m_insideMenu(FALSE) { ADD_STYLE(wxMENU_TEAROFF); } @@ -33,23 +33,23 @@ wxMenuXmlHandler::wxMenuXmlHandler() : wxObject *wxMenuXmlHandler::DoCreateResource() { - if (m_Class == wxT("wxMenu")) + if (m_class == wxT("wxMenu")) { wxMenu *menu = new wxMenu(GetStyle()); wxString title = GetText(wxT("label")); wxString help = GetText(wxT("help")); - - bool oldins = m_InsideMenu; - m_InsideMenu = TRUE; + + bool oldins = m_insideMenu; + m_insideMenu = TRUE; CreateChildren(menu, TRUE/*only this handler*/); - m_InsideMenu = oldins; + m_insideMenu = oldins; - wxMenuBar *p_bar = wxDynamicCast(m_Parent, wxMenuBar); + wxMenuBar *p_bar = wxDynamicCast(m_parent, wxMenuBar); if (p_bar) p_bar->Append(menu, title); else { - wxMenu *p_menu = wxDynamicCast(m_Parent, wxMenu); + wxMenu *p_menu = wxDynamicCast(m_parent, wxMenu); if (p_menu) p_menu->Append(GetID(), title, menu, help); } @@ -59,18 +59,23 @@ wxObject *wxMenuXmlHandler::DoCreateResource() else { - wxMenu *p_menu = wxDynamicCast(m_Parent, wxMenu); + wxMenu *p_menu = wxDynamicCast(m_parent, wxMenu); - if (m_Class == wxT("separator")) + if (m_class == wxT("separator")) p_menu->AppendSeparator(); - else if (m_Class == wxT("break")) + else if (m_class == wxT("break")) p_menu->Break(); else /*wxMenuItem*/ { int id = GetID(); bool checkable = GetBool(wxT("checkable")); + wxString label = GetText(wxT("label")); + wxString accel = GetText(wxT("accel")); + wxString fullLabel = label; + if (!accel.IsEmpty()) + fullLabel << wxT("\t") << accel; - wxMenuItem *mitem = new wxMenuItem(p_menu, id, GetText(wxT("label")), + wxMenuItem *mitem = new wxMenuItem(p_menu, id, fullLabel, GetText(wxT("help")), checkable); #if wxCHECK_VERSION(2,3,0) || defined(__WXMSW__) @@ -90,7 +95,7 @@ wxObject *wxMenuXmlHandler::DoCreateResource() bool wxMenuXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxMenu")) || - (m_InsideMenu && + (m_insideMenu && (IsOfClass(node, wxT("wxMenuItem")) || IsOfClass(node, wxT("break")) || IsOfClass(node, wxT("separator")))