Binary compatible API fixes for menu label retrieval with and without

mnemonics/accelerators.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@48053 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2007-08-13 17:07:01 +00:00
parent 49ab1eb964
commit fb9c1ff9cb
38 changed files with 615 additions and 70 deletions

View File

@@ -4,7 +4,7 @@
// Author: David Elliott
// Modified by:
// Created: 2002/12/09
// RCS-ID: $Id:
// RCS-ID: $Id:
// Copyright: (c) 2002 David Elliott
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@@ -183,6 +183,14 @@ private:
bool m_shouldShowMenu;
DECLARE_DYNAMIC_CLASS(wxMenuBar)
public:
#if wxABI_VERSION >= 20805
// Gets the original label at the top-level of the menubar
wxString GetMenuLabel(size_t pos) const;
#endif
};
#endif // _WX_COCOA_MENU_H_

View File

@@ -4,7 +4,7 @@
// Author: David Elliott
// Modified by:
// Created: 2002/12/13
// RCS-ID: $Id:
// RCS-ID: $Id:
// Copyright: (c) 2002 David Elliott
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
@@ -94,6 +94,14 @@ protected:
private:
DECLARE_DYNAMIC_CLASS(wxMenuItem)
public:
#if wxABI_VERSION >= 20805
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
wxString GetItemLabel() const { return GetText(); }
#endif
};
#endif // _WX_COCOA_MENUITEM_H_

View File

@@ -57,6 +57,13 @@ private:
void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
DECLARE_DYNAMIC_CLASS(wxMenuBar)
public:
#if wxABI_VERSION >= 20805
// Gets the original label at the top-level of the menubar
wxString GetMenuLabel(size_t pos) const;
#endif
};
//-----------------------------------------------------------------------------

View File

@@ -75,6 +75,14 @@ private:
GtkWidget* m_labelWidget; // Label widget
DECLARE_DYNAMIC_CLASS(wxMenuItem)
public:
#if wxABI_VERSION >= 20805
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
wxString GetItemLabel() const;
#endif
};

View File

@@ -53,6 +53,13 @@ private:
void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
DECLARE_DYNAMIC_CLASS(wxMenuBar)
public:
#if wxABI_VERSION >= 20805
// Gets the original label at the top-level of the menubar
wxString GetMenuLabel(size_t pos) const;
#endif
};
//-----------------------------------------------------------------------------

View File

@@ -71,6 +71,14 @@ private:
GtkWidget* m_labelWidget; // Label widget
DECLARE_DYNAMIC_CLASS(wxMenuItem)
public:
#if wxABI_VERSION >= 20805
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
wxString GetItemLabel() const;
#endif
};

View File

@@ -43,7 +43,7 @@ public:
// implementation only from now on
// -------------------------------
int MacGetIndexFromId( int id ) ;
int MacGetIndexFromId( int id ) ;
int MacGetIndexFromItem( wxMenuItem *pItem ) ;
void MacEnableMenu( bool bDoEnable ) ;
// MacOS needs to know about submenus somewhere within this menu
@@ -174,6 +174,13 @@ private:
static wxMenuBar* s_macCommonMenuBar ;
DECLARE_DYNAMIC_CLASS(wxMenuBar)
public:
#if wxABI_VERSION >= 20805
// Gets the original label at the top-level of the menubar
wxString GetMenuLabel(size_t pos) const;
#endif
};
#endif // _WX_MENU_H_

View File

@@ -47,7 +47,7 @@ public:
void UpdateItemBitmap() ;
void UpdateItemText() ;
void UpdateItemStatus() ;
void DoUpdateItemBitmap( WXHMENU menu, wxUint16 index) ;
// mark item as belonging to the given radio group
@@ -75,6 +75,14 @@ private:
void* m_menu ; // the appropriate menu , may also be a system menu
DECLARE_DYNAMIC_CLASS(wxMenuItem)
public:
#if wxABI_VERSION >= 20805
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
wxString GetItemLabel() const { return GetText(); }
#endif
};
#endif //_MENUITEM_H

View File

@@ -47,7 +47,7 @@ public:
// implementation only from now on
// -------------------------------
int MacGetIndexFromId( int id ) ;
int MacGetIndexFromId( int id ) ;
int MacGetIndexFromItem( wxMenuItem *pItem ) ;
void MacEnableMenu( bool bDoEnable ) ;
// MacOS needs to know about submenus somewhere within this menu
@@ -160,6 +160,13 @@ private:
static wxMenuBar* s_macCommonMenuBar ;
DECLARE_DYNAMIC_CLASS(wxMenuBar)
public:
#if wxABI_VERSION >= 20805
// Gets the original label at the top-level of the menubar
wxString GetMenuLabel(size_t pos) const;
#endif
};
#endif // _WX_MENU_H_

View File

@@ -72,6 +72,14 @@ private:
void* m_menu ; // the appropriate menu , may also be a system menu
DECLARE_DYNAMIC_CLASS(wxMenuItem)
public:
#if wxABI_VERSION >= 20805
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
wxString GetItemLabel() const;
#endif
};
#endif //_MENUITEM_H

View File

@@ -375,6 +375,14 @@ protected:
static bool ms_locked;
DECLARE_NO_COPY_CLASS(wxMenuBase)
public:
#if wxABI_VERSION >= 20805
// Returns the stripped label
wxString GetLabelText(int itemid) const { return wxMenuItem::GetLabelFromText(GetLabel(itemid)); }
#endif
};
// ----------------------------------------------------------------------------
@@ -496,6 +504,21 @@ protected:
wxFrame *m_menuBarFrame;
DECLARE_NO_COPY_CLASS(wxMenuBarBase)
public:
#if wxABI_VERSION >= 20805
// Replacement for SetLabelTop
void SetMenuLabel(size_t pos, const wxString& label) { SetLabelTop(pos, label); }
// Gets the original label at the top-level of the menubar
// Implemented per port, since we can't have virtual functions in the stable branch.
// wxString GetMenuLabel(size_t pos) const;
// Get the text only, from the label at the top-level of the menubar
wxString GetMenuLabelText(size_t pos) const;
#endif
};
// ----------------------------------------------------------------------------

View File

@@ -65,6 +65,7 @@ public:
// different from the item's label which only contains the text shown
// in the menu
virtual void SetText(const wxString& str);
wxString GetLabel() const { return GetLabelFromText(m_text); }
const wxString& GetText() const { return m_text; }
@@ -146,6 +147,26 @@ private:
// declare them ourselves - but don't implement as they shouldn't be used
wxMenuItemBase(const wxMenuItemBase& item);
wxMenuItemBase& operator=(const wxMenuItemBase& item);
public:
#if wxABI_VERSION >= 20805
// Sets the label. This function replaces SetText.
void SetItemLabel(const wxString& str) { SetText(str); }
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
// We can't implement this in the base class (no new virtuals in stable branch)
// wxString GetItemLabel() const;
// return just the text of the item label, without any mnemonics
// This used to be called GetLabel.
wxString GetItemLabelText() const { return GetLabelText(m_text); }
// return just the text part of the given label. In 2.9 and up, this is implemented in
// platform-specific code, but is now implemented in terms of GetLabelFromText.
static wxString GetLabelText(const wxString& label);
#endif
};
// ----------------------------------------------------------------------------

View File

@@ -170,6 +170,13 @@ public:
wxFont m_font;
DECLARE_DYNAMIC_CLASS(wxMenuBar)
public:
#if wxABI_VERSION >= 20805
// Gets the original label at the top-level of the menubar
wxString GetMenuLabel(size_t pos) const;
#endif
};
#endif // _WX_MOTIF_MENU_H_

View File

@@ -63,6 +63,15 @@ private:
wxBitmap m_bitmap; // Bitmap for menuitem, if any
DECLARE_DYNAMIC_CLASS(wxMenuItem)
public:
#if wxABI_VERSION >= 20805
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
wxString GetItemLabel() const { return GetText(); }
#endif
};
#endif // _WX_MOTIF_MENUITEM_H

View File

@@ -229,6 +229,13 @@ protected:
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar)
public:
#if wxABI_VERSION >= 20805
// Gets the original label at the top-level of the menubar
wxString GetMenuLabel(size_t pos) const;
#endif
};
#endif // _WX_MENU_H_

View File

@@ -87,6 +87,14 @@ private:
bool m_isRadioGroupStart;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem)
public:
#if wxABI_VERSION >= 20805
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
wxString GetItemLabel() const { return GetText(); }
#endif
};
#endif //_MENUITEM_H

View File

@@ -287,6 +287,13 @@ private:
{ wxWindow::Refresh(bErase, pRect); }
DECLARE_DYNAMIC_CLASS(wxMenuBar)
public:
#if wxABI_VERSION >= 20805
// Gets the original label at the top-level of the menubar
wxString GetMenuLabel(size_t pos) const;
#endif
};
#endif // _WX_MENU_H_

View File

@@ -117,6 +117,15 @@ private:
bool m_bIsRadioGroupStart;
DECLARE_DYNAMIC_CLASS(wxMenuItem)
public:
#if wxABI_VERSION >= 20805
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
wxString GetItemLabel() const { return GetText(); }
#endif
}; // end of CLASS wxMenuItem
#endif //_MENUITEM_H

View File

@@ -192,6 +192,13 @@ protected:
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar)
public:
#if wxABI_VERSION >= 20805
// Gets the original label at the top-level of the menubar
wxString GetMenuLabel(size_t pos) const;
#endif
};
#endif // _WX_MENU_H_

View File

@@ -82,6 +82,14 @@ private:
bool m_isRadioGroupStart;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem)
public:
#if wxABI_VERSION >= 20805
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
wxString GetItemLabel() const { return GetText(); }
#endif
};
#endif //_MENUITEM_H

View File

@@ -270,6 +270,13 @@ private:
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxMenuBar)
public:
#if wxABI_VERSION >= 20805
// Gets the original label at the top-level of the menubar
wxString GetMenuLabel(size_t pos) const;
#endif
};
#endif // _WX_UNIV_MENU_H_

View File

@@ -94,7 +94,7 @@ protected:
// the bitmaps (may be invalid, then they're not used)
wxBitmap m_bmpChecked,
m_bmpUnchecked,
m_bmpDisabled;
m_bmpDisabled;
// the positions of the first and last items of the radio group this item
// belongs to or -1: start is the radio group start and is valid for all
@@ -121,6 +121,14 @@ protected:
private:
DECLARE_DYNAMIC_CLASS(wxMenuItem)
public:
#if wxABI_VERSION >= 20805
// return the item label including any mnemonics and accelerators.
// This used to be called GetText.
wxString GetItemLabel() const { return GetText(); }
#endif
};
#endif // _WX_UNIV_MENUITEM_H_