From 94f6d685cb30a8e62d21254bbf19902b48eb2443 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sat, 11 Aug 2007 22:09:20 +0000 Subject: [PATCH] Preserve original menu label for later retrieval git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48029 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/univ/menu.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index 4db54a095a..ac4d815131 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -67,6 +67,8 @@ public: void SetLabel(const wxString& text) { + m_originalLabel = text; + // remember the accel char (may be -1 if none) m_indexAccel = wxControl::FindAccelIndex(text, &m_label); @@ -79,6 +81,7 @@ public: // accessors const wxString& GetLabel() const { return m_label; } + const wxString& GetOriginalLabel() const { return m_originalLabel; } bool IsEnabled() const { return m_isEnabled; } wxCoord GetWidth(wxMenuBar *menubar) const { @@ -105,6 +108,7 @@ private: } wxString m_label; + wxString m_originalLabel; wxCoord m_width; int m_indexAccel; bool m_isEnabled; @@ -615,7 +619,7 @@ void wxPopupMenuWindow::DoDraw(wxControlRenderer *renderer) dc, y, gi, - item->GetLabel(), + item->GetItemLabelText(), item->GetAccelString(), bmp, flags, @@ -988,7 +992,7 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key) int idxAccel = item->GetAccelIndex(); if ( idxAccel != -1 && - (wxChar)wxTolower(item->GetLabel()[(size_t)idxAccel]) + (wxChar)wxTolower(item->GetItemLabelText()[(size_t)idxAccel]) == chAccel ) { // ok, found an item with this accel @@ -1824,7 +1828,7 @@ void wxMenuBar::SetMenuLabel(size_t pos, const wxString& label) { wxCHECK_RET( pos < GetCount(), _T("invalid index in SetMenuLabel") ); - if ( label != m_menuInfos[pos].GetLabel() ) + if ( label != m_menuInfos[pos].GetOriginalLabel() ) { m_menuInfos[pos].SetLabel(label); @@ -1837,7 +1841,7 @@ wxString wxMenuBar::GetMenuLabel(size_t pos) const { wxCHECK_MSG( pos < GetCount(), wxEmptyString, _T("invalid index in GetMenuLabel") ); - return m_menuInfos[pos].GetLabel(); + return m_menuInfos[pos].GetOriginalLabel(); } // ---------------------------------------------------------------------------- -- 2.45.2