Preserve original menu label for later retrieval
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48029 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -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();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user