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:
@@ -108,6 +108,10 @@ All (GUI):
|
||||
- Fixed wxXPMHandler::SaveFile for images with more than 92 colors.
|
||||
- Fixed a crash in wxGrid on creation due to OnSize being called too soon.
|
||||
- Added XRC handler for wxPropertySheetDialog (Sander Berents).
|
||||
- API consistency fixes: added wxMenuBar::SetMenuLabel, wxMenuBar::GetMenuLabel,
|
||||
wxMenuBar::GetMenuLabelText, wxMenu::GetLabelText, wxMenuItem::SetItemLabel,
|
||||
wxMenuItem::GetItemLabel, wxMenuItem::GetItemLabelText, wxMenuItem::GetLabelText.
|
||||
Retrieval of labels with and without mnemonics/accelerators is now possible.
|
||||
|
||||
wxMSW:
|
||||
|
||||
|
@@ -423,7 +423,7 @@ item was not found.
|
||||
|
||||
\constfunc{wxString}{GetLabel}{\param{int}{ id}}
|
||||
|
||||
Returns a menu item label.
|
||||
Returns a menu item label, including any mnemonics and accelerators.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
@@ -435,7 +435,26 @@ The item label, or the empty string if the item was not found.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxMenu::SetLabel}{wxmenusetlabel}
|
||||
\helpref{wxMenu::GetLabelText}{wxmenugetlabeltext}, \helpref{wxMenu::SetLabel}{wxmenusetlabel}
|
||||
|
||||
|
||||
\membersection{wxMenu::GetLabelText}\label{wxmenugetlabeltext}
|
||||
|
||||
\constfunc{wxString}{GetLabelText}{\param{int}{ id}}
|
||||
|
||||
Returns a menu item label, without any of the original mnemonics and accelerators.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{id}{The menu item identifier.}
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
The item label, or the empty string if the item was not found.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxMenu::GetLabel}{wxmenugetlabel}, \helpref{wxMenu::SetLabel}{wxmenusetlabel}
|
||||
|
||||
|
||||
\membersection{wxMenu::GetMenuItemCount}\label{wxmenugetmenuitemcount}
|
||||
@@ -958,6 +977,8 @@ The menu label, or the empty string if the menu was not found.
|
||||
|
||||
Use only after the menubar has been associated with a frame.
|
||||
|
||||
This function is deprecated in favour of \helpref{GetMenuLabel}{wxmenubargetmenulabel} and \helpref{GetMenuLabelText}{wxmenubargetmenulabeltext}.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop}
|
||||
@@ -977,6 +998,56 @@ Returns the menu at {\it menuIndex} (zero-based).
|
||||
Returns the number of menus in this menubar.
|
||||
|
||||
|
||||
\membersection{wxMenuBar::GetMenuLabel}\label{wxmenubargetmenulabel}
|
||||
|
||||
\constfunc{wxString}{GetMenuLabel}{\param{int}{ pos}}
|
||||
|
||||
Returns the label of a top-level menu. Note that the returned string
|
||||
includes the accelerator characters that have been specified in the menu
|
||||
title string during its construction.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{pos}{Position of the menu on the menu bar, starting from zero.}
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
The menu label, or the empty string if the menu was not found.
|
||||
|
||||
\wxheading{Remarks}
|
||||
|
||||
Use only after the menubar has been associated with a frame.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxMenuBar::GetMenuLabelText}{wxmenubargetmenulabeltext}, \helpref{wxMenuBar::SetMenuLabel}{wxmenubarsetmenulabel}
|
||||
|
||||
|
||||
\membersection{wxMenuBar::GetMenuLabelText}\label{wxmenubargetmenulabeltext}
|
||||
|
||||
\constfunc{wxString}{GetMenuLabelText}{\param{int}{ pos}}
|
||||
|
||||
Returns the label of a top-level menu. Note that the returned string does not
|
||||
include any accelerator characters that may have been specified in the menu
|
||||
title string during its construction.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{pos}{Position of the menu on the menu bar, starting from zero.}
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
The menu label, or the empty string if the menu was not found.
|
||||
|
||||
\wxheading{Remarks}
|
||||
|
||||
Use only after the menubar has been associated with a frame.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxMenuBar::GetMenuLabel}{wxmenubargetmenulabel}, \helpref{wxMenuBar::SetMenuLabel}{wxmenubarsetmenulabel}
|
||||
|
||||
|
||||
\membersection{wxMenuBar::Insert}\label{wxmenubarinsert}
|
||||
|
||||
\func{bool}{Insert}{\param{size\_t }{pos}, \param{wxMenu *}{menu}, \param{const wxString\& }{title}}
|
||||
@@ -1133,7 +1204,30 @@ Sets the label of a top-level menu.
|
||||
|
||||
Use only after the menubar has been associated with a frame.
|
||||
|
||||
This function has been deprecated in favour of \helpref{SetMenuLabel}{wxmenubarsetmenulabel}.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxMenuBar::GetLabelTop}{wxmenubargetlabeltop}
|
||||
|
||||
|
||||
\membersection{wxMenuBar::SetMenuLabel}\label{wxmenubarsetmenulabel}
|
||||
|
||||
\func{void}{SetMenuLabel}{\param{int}{ pos}, \param{const wxString\& }{label}}
|
||||
|
||||
Sets the label of a top-level menu.
|
||||
|
||||
\wxheading{Parameters}
|
||||
|
||||
\docparam{pos}{The position of a menu on the menu bar, starting from zero.}
|
||||
|
||||
\docparam{label}{The menu label.}
|
||||
|
||||
\wxheading{Remarks}
|
||||
|
||||
Use only after the menubar has been associated with a frame.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxMenuBar::GetMenuLabel}{wxmenubargetmenulabel}, \helpref{wxMenuBar::GetMenuLabelText}{wxmenubargetmenulabeltext}
|
||||
|
||||
|
@@ -148,6 +148,31 @@ Returns the help string associated with the menu item.
|
||||
|
||||
Returns the menu item identifier.
|
||||
|
||||
\membersection{wxMenuItem::GetItemLabel}\label{wxmenuitemgetitemlabel}
|
||||
|
||||
\constfunc{wxString}{GetItemLabel}{\void}
|
||||
|
||||
Returns the text associated with the menu item including any accelerator
|
||||
characters that were passed to the constructor or SetItemLabel.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{GetItemLabelText}{wxmenuitemgetitemlabeltext},
|
||||
\helpref{GetLabelText}{wxmenuitemgetlabeltext}
|
||||
|
||||
|
||||
\membersection{wxMenuItem::GetItemLabelText}\label{wxmenuitemgetitemlabeltext}
|
||||
|
||||
\constfunc{wxString}{GetItemLabelText}{\void}
|
||||
|
||||
Returns the text associated with the menu item, without any accelerator
|
||||
characters.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{GetItemLabel}{wxmenuitemgetitemlabel},
|
||||
\helpref{GetLabelText}{wxmenuitemgetlabeltext}
|
||||
|
||||
|
||||
\membersection{wxMenuItem::GetKind}\label{wxmenuitemgetkind}
|
||||
|
||||
@@ -164,12 +189,33 @@ Returns the item kind, one of {\tt wxITEM\_SEPARATOR}, {\tt wxITEM\_NORMAL},
|
||||
Returns the text associated with the menu item without any accelerator
|
||||
characters it might contain.
|
||||
|
||||
This function is deprecated in favour of \helpref{GetItemLabelText}{wxmenuitemgetitemlabeltext}.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{GetText}{wxmenuitemgettext},
|
||||
\helpref{GetLabelFromText}{wxmenuitemgetlabelfromtext}
|
||||
|
||||
|
||||
\membersection{wxMenuItem::GetLabelText}\label{wxmenuitemgetlabeltext}
|
||||
|
||||
\func{static wxString}{GetLabelText}{\param{const wxString\& }{text}}
|
||||
|
||||
Strips all accelerator characters and mnemonics from the given {\it text}.
|
||||
For example,
|
||||
|
||||
\begin{verbatim}
|
||||
wxMenuItem::GetLabelFromText("&Hello\tCtrl-H");
|
||||
\end{verbatim}
|
||||
|
||||
will return just {\tt "Hello"}.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{GetItemLabelText}{wxmenuitemgetitemlabeltext},
|
||||
\helpref{GetItemLabel}{wxmenuitemgetitemlabel}
|
||||
|
||||
|
||||
\membersection{wxMenuItem::GetLabelFromText}\label{wxmenuitemgetlabelfromtext}
|
||||
|
||||
\func{static wxString}{GetLabelFromText}{\param{const wxString\& }{text}}
|
||||
@@ -183,12 +229,13 @@ wxMenuItem::GetLabelFromText("&Hello\tCtrl-H");
|
||||
|
||||
will return just {\tt "Hello"}.
|
||||
|
||||
This function is deprecated; please use \helpref{wxMenuItem::GetLabelText}{wxmenuitemgetlabeltext} instead.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{GetText}{wxmenuitemgettext},
|
||||
\helpref{GetLabel}{wxmenuitemgetlabel}
|
||||
|
||||
|
||||
\membersection{wxMenuItem::GetMarginWidth}\label{wxmenuitemgetmarginwidth}
|
||||
|
||||
\constfunc{int}{GetMarginWidth}{\void}
|
||||
@@ -221,6 +268,8 @@ instead.
|
||||
Returns the text associated with the menu item, such as it was passed to the
|
||||
wxMenuItem constructor, i.e. with any accelerator characters it may contain.
|
||||
|
||||
This function is deprecated in favour of \helpref{GetItemLabel}{wxmenuitemgetitemlabel}.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{GetLabel}{wxmenuitemgetlabel},
|
||||
@@ -314,6 +363,13 @@ Sets the font associated with the menu item (Windows only).
|
||||
Sets the help string.
|
||||
|
||||
|
||||
\membersection{wxMenuItem::SetItemLabel}\label{wxmenuitemsetitemlabel}
|
||||
|
||||
\func{void}{SetItemLabel}{\param{const wxString\& }{label}}
|
||||
|
||||
Sets the label associated with the menu item.
|
||||
|
||||
|
||||
\membersection{wxMenuItem::SetMarginWidth}\label{wxmenuitemsetmarginwidth}
|
||||
|
||||
\constfunc{void}{SetMarginWidth}{\param{int}{ width}}
|
||||
@@ -341,6 +397,8 @@ Sets the submenu of this menu item.
|
||||
|
||||
Sets the text associated with the menu item.
|
||||
|
||||
This function is deprecated in favour of \helpref{SetItemLabel}{wxmenuitemsetitemlabel}.
|
||||
|
||||
|
||||
\membersection{wxMenuItem::SetTextColour}\label{wxmenuitemsettextcolour}
|
||||
|
||||
|
@@ -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_
|
||||
|
@@ -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_
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -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
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
|
||||
|
@@ -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_
|
||||
|
@@ -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
|
||||
|
@@ -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_
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -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_
|
||||
|
@@ -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
|
||||
|
@@ -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_
|
||||
|
@@ -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
|
||||
|
@@ -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_
|
||||
|
@@ -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
|
||||
|
@@ -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_
|
||||
|
@@ -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
|
||||
|
@@ -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_
|
||||
|
@@ -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_
|
||||
|
@@ -227,6 +227,13 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||
return wxStringWithNSString([[m_cocoaNSMenu itemAtIndex:itemindex] title]);
|
||||
}
|
||||
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString wxMenuBar::GetMenuLabel(size_t pos) const
|
||||
{
|
||||
// TODO: restore the original mnemonics
|
||||
return GetLabelTop(pos);
|
||||
}
|
||||
|
||||
void wxMenuBar::Attach(wxFrame *frame)
|
||||
{
|
||||
wxMenuBarBase::Attach(frame);
|
||||
|
@@ -445,6 +445,11 @@ void wxMenuItemBase::SetHelp(const wxString& str)
|
||||
}
|
||||
}
|
||||
|
||||
wxString wxMenuItemBase::GetLabelText(const wxString& label)
|
||||
{
|
||||
return GetLabelFromText(label);
|
||||
}
|
||||
|
||||
bool wxMenuBase::ms_locked = true;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -1152,4 +1157,11 @@ void wxMenuBarBase::UpdateMenus( void )
|
||||
}
|
||||
}
|
||||
|
||||
// Get the text only, from the label
|
||||
wxString wxMenuBarBase::GetMenuLabelText(size_t pos) const
|
||||
{
|
||||
return wxMenuItem::GetLabelText(((wxMenuBar*)this)->GetMenuLabel(pos));
|
||||
}
|
||||
|
||||
|
||||
#endif // wxUSE_MENUS
|
||||
|
@@ -91,6 +91,40 @@ static wxString wxReplaceUnderscore( const wxString& title )
|
||||
return str;
|
||||
}
|
||||
|
||||
static wxString wxConvertFromGTKToWXLabel(const wxString& gtkLabel)
|
||||
{
|
||||
wxString label;
|
||||
for ( const wxChar *pc = gtkLabel.c_str(); *pc; pc++ )
|
||||
{
|
||||
// '_' is the escape character for GTK+.
|
||||
|
||||
if ( *pc == wxT('_') && *(pc+1) == wxT('_'))
|
||||
{
|
||||
// An underscore was escaped.
|
||||
label += wxT('_');
|
||||
pc++;
|
||||
}
|
||||
else if ( *pc == wxT('_') )
|
||||
{
|
||||
// Convert GTK+ hotkey symbol to wxWidgets/Windows standard
|
||||
label += wxT('&');
|
||||
}
|
||||
else if ( *pc == wxT('&') )
|
||||
{
|
||||
// Double the ampersand to escape it as far as wxWidgets is concerned
|
||||
label += wxT("&&");
|
||||
}
|
||||
else
|
||||
{
|
||||
// don't remove ampersands '&' since if we have them in the menu title
|
||||
// it means that they were doubled to indicate "&" instead of accelerator
|
||||
label += *pc;
|
||||
}
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// activate message from GTK
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -425,7 +459,7 @@ wxMenu *wxMenuBar::Remove(size_t pos)
|
||||
|
||||
static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
|
||||
{
|
||||
if (wxMenuItem::GetLabelFromText(menu->GetTitle()) == wxMenuItem::GetLabelFromText(menuString))
|
||||
if (wxMenuItem::GetLabelFromText(wxConvertFromGTKToWXLabel(menu->GetTitle())) == wxMenuItem::GetLabelFromText(menuString))
|
||||
{
|
||||
int res = menu->FindItem( itemString );
|
||||
if (res != wxNOT_FOUND)
|
||||
@@ -518,23 +552,19 @@ wxString wxMenuBar::GetLabelTop( size_t pos ) const
|
||||
|
||||
wxMenu* menu = node->GetData();
|
||||
|
||||
wxString label;
|
||||
wxString text( menu->GetTitle() );
|
||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
||||
{
|
||||
if ( *pc == wxT('_') )
|
||||
{
|
||||
// '_' is the escape character for GTK+
|
||||
continue;
|
||||
}
|
||||
return wxStripMenuCodes(wxConvertFromGTKToWXLabel(menu->GetTitle()));
|
||||
}
|
||||
|
||||
// don't remove ampersands '&' since if we have them in the menu title
|
||||
// it means that they were doubled to indicate "&" instead of accelerator
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString wxMenuBar::GetMenuLabel(size_t pos) const
|
||||
{
|
||||
wxMenuList::compatibility_iterator node = m_menus.Item( pos );
|
||||
|
||||
label += *pc;
|
||||
}
|
||||
wxCHECK_MSG( node, wxT("invalid"), wxT("menu not found") );
|
||||
|
||||
return label;
|
||||
wxMenu* menu = node->GetData();
|
||||
|
||||
return wxConvertFromGTKToWXLabel(menu->GetTitle());
|
||||
}
|
||||
|
||||
void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
|
||||
@@ -743,6 +773,12 @@ wxMenuItem::~wxMenuItem()
|
||||
/* static */
|
||||
wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
|
||||
{
|
||||
// The argument to this function will now always be in wxWidgets standard label
|
||||
// format, not GTK+ format, so we do what the other ports do.
|
||||
|
||||
return wxStripMenuCodes(text);
|
||||
|
||||
#if 0
|
||||
wxString label;
|
||||
|
||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
||||
@@ -779,6 +815,7 @@ wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
|
||||
// wxPrintf( wxT("GetLabelFromText(): text %s label %s\n"), text.c_str(), label.c_str() );
|
||||
|
||||
return label;
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxMenuItem::SetText( const wxString& str )
|
||||
@@ -986,6 +1023,14 @@ bool wxMenuItem::IsChecked() const
|
||||
return ((GtkCheckMenuItem*)m_menuItem)->active != 0;
|
||||
}
|
||||
|
||||
wxString wxMenuItem::GetItemLabel() const
|
||||
{
|
||||
wxString label = wxConvertFromGTKToWXLabel(m_text);
|
||||
if (!m_hotKey.IsEmpty())
|
||||
label = label + wxT("\t") + m_hotKey;
|
||||
return label;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMenu
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -91,6 +91,40 @@ static wxString wxReplaceUnderscore( const wxString& title )
|
||||
return str;
|
||||
}
|
||||
|
||||
static wxString wxConvertFromGTKToWXLabel(const wxString& gtkLabel)
|
||||
{
|
||||
wxString label;
|
||||
for ( const wxChar *pc = gtkLabel.c_str(); *pc; pc++ )
|
||||
{
|
||||
// '_' is the escape character for GTK+.
|
||||
|
||||
if ( *pc == wxT('_') && *(pc+1) == wxT('_'))
|
||||
{
|
||||
// An underscore was escaped.
|
||||
label += wxT('_');
|
||||
pc++;
|
||||
}
|
||||
else if ( *pc == wxT('_') )
|
||||
{
|
||||
// Convert GTK+ hotkey symbol to wxWidgets/Windows standard
|
||||
label += wxT('&');
|
||||
}
|
||||
else if ( *pc == wxT('&') )
|
||||
{
|
||||
// Double the ampersand to escape it as far as wxWidgets is concerned
|
||||
label += wxT("&&");
|
||||
}
|
||||
else
|
||||
{
|
||||
// don't remove ampersands '&' since if we have them in the menu title
|
||||
// it means that they were doubled to indicate "&" instead of accelerator
|
||||
label += *pc;
|
||||
}
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// activate message from GTK
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -408,7 +442,7 @@ wxMenu *wxMenuBar::Remove(size_t pos)
|
||||
|
||||
static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
|
||||
{
|
||||
if (wxMenuItem::GetLabelFromText(menu->GetTitle()) == wxMenuItem::GetLabelFromText(menuString))
|
||||
if (wxMenuItem::GetLabelFromText(wxConvertFromGTKToWXLabel(menu->GetTitle())) == wxMenuItem::GetLabelFromText(menuString))
|
||||
{
|
||||
int res = menu->FindItem( itemString );
|
||||
if (res != wxNOT_FOUND)
|
||||
@@ -501,23 +535,19 @@ wxString wxMenuBar::GetLabelTop( size_t pos ) const
|
||||
|
||||
wxMenu* menu = node->GetData();
|
||||
|
||||
wxString label;
|
||||
wxString text( menu->GetTitle() );
|
||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
||||
{
|
||||
if ( *pc == wxT('_') )
|
||||
{
|
||||
// '_' is the escape character for GTK+
|
||||
continue;
|
||||
}
|
||||
return wxStripMenuCodes(wxConvertFromGTKToWXLabel(menu->GetTitle()));
|
||||
}
|
||||
|
||||
// don't remove ampersands '&' since if we have them in the menu title
|
||||
// it means that they were doubled to indicate "&" instead of accelerator
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString wxMenuBar::GetMenuLabel(size_t pos) const
|
||||
{
|
||||
wxMenuList::compatibility_iterator node = m_menus.Item( pos );
|
||||
|
||||
label += *pc;
|
||||
}
|
||||
wxCHECK_MSG( node, wxT("invalid"), wxT("menu not found") );
|
||||
|
||||
return label;
|
||||
wxMenu* menu = node->GetData();
|
||||
|
||||
return wxConvertFromGTKToWXLabel(menu->GetTitle());
|
||||
}
|
||||
|
||||
void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
|
||||
@@ -736,6 +766,12 @@ wxMenuItem::~wxMenuItem()
|
||||
/* static */
|
||||
wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
|
||||
{
|
||||
// The argument to this function will now always be in wxWidgets standard label
|
||||
// format, not GTK+ format, so we do what the other ports do.
|
||||
|
||||
return wxStripMenuCodes(text);
|
||||
|
||||
#if 0
|
||||
wxString label;
|
||||
|
||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
||||
@@ -762,6 +798,7 @@ wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
|
||||
}
|
||||
|
||||
// wxPrintf( wxT("GetLabelFromText(): text %s label %s\n"), text.c_str(), label.c_str() );
|
||||
#endif
|
||||
|
||||
return label;
|
||||
}
|
||||
@@ -927,6 +964,14 @@ bool wxMenuItem::IsChecked() const
|
||||
return ((GtkCheckMenuItem*)m_menuItem)->active != 0;
|
||||
}
|
||||
|
||||
wxString wxMenuItem::GetItemLabel() const
|
||||
{
|
||||
wxString label = wxConvertFromGTKToWXLabel(m_text);
|
||||
if (!m_hotKey.IsEmpty())
|
||||
label = label + wxT("\t") + m_hotKey;
|
||||
return label;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMenu
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -94,14 +94,14 @@ void wxInsertMenuItemsInMenu(wxMenu* menu, MenuRef wm, MenuItemIndex insertAfter
|
||||
subMenu = item->GetSubMenu() ;
|
||||
if (subMenu)
|
||||
{
|
||||
wxInsertMenuItemsInMenu(subMenu, (MenuRef)subMenu->GetHMenu(), 0);
|
||||
wxInsertMenuItemsInMenu(subMenu, (MenuRef)subMenu->GetHMenu(), 0);
|
||||
}
|
||||
if ( item->IsSeparator() )
|
||||
{
|
||||
if ( wm && newItems)
|
||||
InsertMenuItemTextWithCFString( wm,
|
||||
CFSTR(""), insertAfter, kMenuItemAttrSeparator, 0);
|
||||
|
||||
CFSTR(""), insertAfter, kMenuItemAttrSeparator, 0);
|
||||
|
||||
newItems = false;
|
||||
}
|
||||
else
|
||||
@@ -110,9 +110,9 @@ void wxInsertMenuItemsInMenu(wxMenu* menu, MenuRef wm, MenuItemIndex insertAfter
|
||||
entry = wxAcceleratorEntry::Create( item->GetText() ) ;
|
||||
|
||||
MenuItemIndex winListPos = (MenuItemIndex)-1;
|
||||
OSStatus err = GetIndMenuItemWithCommandID(wm,
|
||||
OSStatus err = GetIndMenuItemWithCommandID(wm,
|
||||
wxIdToMacCommand ( item->GetId() ), 1, NULL, &winListPos);
|
||||
|
||||
|
||||
if ( wm && err == menuItemNotFoundErr )
|
||||
{
|
||||
// NB: the only way to determine whether or not we should add
|
||||
@@ -126,7 +126,7 @@ void wxInsertMenuItemsInMenu(wxMenu* menu, MenuRef wm, MenuItemIndex insertAfter
|
||||
|
||||
delete entry ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -210,10 +210,10 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
{
|
||||
if ( pos == (size_t)-1 )
|
||||
AppendMenuItemTextWithCFString( MAC_WXHMENU(m_hMenu),
|
||||
CFSTR(""), kMenuItemAttrSeparator, 0,NULL);
|
||||
CFSTR(""), kMenuItemAttrSeparator, 0,NULL);
|
||||
else
|
||||
InsertMenuItemTextWithCFString( MAC_WXHMENU(m_hMenu),
|
||||
CFSTR(""), pos, kMenuItemAttrSeparator, 0);
|
||||
CFSTR(""), pos, kMenuItemAttrSeparator, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -655,10 +655,10 @@ void wxMenuBar::MacInstallMenuBar()
|
||||
// However, the change from 10.2 to 10.3 suggests it is preferred
|
||||
#if TARGET_API_MAC_OSX
|
||||
InsertMenuItemTextWithCFString( appleMenu,
|
||||
CFSTR(""), 0, kMenuItemAttrSeparator, 0);
|
||||
CFSTR(""), 0, kMenuItemAttrSeparator, 0);
|
||||
#endif
|
||||
InsertMenuItemTextWithCFString( appleMenu,
|
||||
CFSTR("About..."), 0, 0, 0);
|
||||
CFSTR("About..."), 0, 0, 0);
|
||||
MacInsertMenu( appleMenu , 0 ) ;
|
||||
|
||||
// clean-up the help menu before adding new items
|
||||
@@ -738,7 +738,7 @@ void wxMenuBar::MacInstallMenuBar()
|
||||
{
|
||||
if ( mh )
|
||||
AppendMenuItemTextWithCFString( mh,
|
||||
CFSTR(""), kMenuItemAttrSeparator, 0,NULL);
|
||||
CFSTR(""), kMenuItemAttrSeparator, 0,NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -766,42 +766,42 @@ void wxMenuBar::MacInstallMenuBar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( ( m_titles[i] == wxT("Window") || m_titles[i] == wxT("&Window") )
|
||||
|
||||
else if ( ( m_titles[i] == wxT("Window") || m_titles[i] == wxT("&Window") )
|
||||
&& GetAutoWindowMenu() )
|
||||
{
|
||||
{
|
||||
if ( MacGetWindowMenuHMenu() == NULL )
|
||||
{
|
||||
CreateStandardWindowMenu( 0 , (MenuHandle*) &s_macWindowMenuHandle ) ;
|
||||
}
|
||||
|
||||
|
||||
MenuRef wm = (MenuRef)MacGetWindowMenuHMenu();
|
||||
if ( wm == NULL )
|
||||
break;
|
||||
|
||||
|
||||
// get the insertion point in the standard menu
|
||||
MenuItemIndex winListStart;
|
||||
GetIndMenuItemWithCommandID(wm,
|
||||
GetIndMenuItemWithCommandID(wm,
|
||||
kHICommandWindowListSeparator, 1, NULL, &winListStart);
|
||||
|
||||
|
||||
// add a separator so that the standard items and the custom items
|
||||
// aren't mixed together, but only if this is the first run
|
||||
OSStatus err = GetIndMenuItemWithCommandID(wm,
|
||||
OSStatus err = GetIndMenuItemWithCommandID(wm,
|
||||
'WXWM', 1, NULL, NULL);
|
||||
|
||||
|
||||
if ( err == menuItemNotFoundErr )
|
||||
{
|
||||
InsertMenuItemTextWithCFString( wm,
|
||||
CFSTR(""), winListStart-1, kMenuItemAttrSeparator, 'WXWM');
|
||||
}
|
||||
|
||||
wxInsertMenuItemsInMenu(menu, wm, winListStart);
|
||||
|
||||
wxInsertMenuItemsInMenu(menu, wm, winListStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i], m_font.GetEncoding() ) ;
|
||||
menu->MacBeforeDisplay(false) ;
|
||||
|
||||
|
||||
::InsertMenu(MAC_WXHMENU(_wxMenuAt(m_menus, i)->GetHMenu()), 0);
|
||||
}
|
||||
}
|
||||
@@ -876,6 +876,15 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||
wxT("invalid menu index in wxMenuBar::GetLabelTop") );
|
||||
|
||||
return wxStripMenuCodes(m_titles[pos]);
|
||||
}
|
||||
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString wxMenuBar::GetMenuLabel(size_t pos) const
|
||||
{
|
||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||
wxT("invalid menu index in wxMenuBar::GetMenuLabel") );
|
||||
|
||||
return m_titles[pos];
|
||||
}
|
||||
|
||||
|
@@ -66,10 +66,10 @@ void wxMenuItem::UpdateItemBitmap()
|
||||
DoUpdateItemBitmap( mhandle, index );
|
||||
}
|
||||
|
||||
void wxMenuItem::DoUpdateItemBitmap( WXHMENU menu, wxUint16 index)
|
||||
void wxMenuItem::DoUpdateItemBitmap( WXHMENU menu, wxUint16 index)
|
||||
{
|
||||
MenuHandle mhandle = (MenuHandle) menu;
|
||||
|
||||
|
||||
if ( mhandle == NULL || index == 0)
|
||||
return ;
|
||||
|
||||
@@ -83,7 +83,7 @@ void wxMenuItem::DoUpdateItemBitmap( WXHMENU menu, wxUint16 index)
|
||||
if ( info.contentType == kControlContentIconRef )
|
||||
SetMenuItemIconHandle( mhandle , index ,
|
||||
kMenuIconRefType , (Handle) info.u.iconRef ) ;
|
||||
else if ( info.contentType == kControlContentCGImageRef )
|
||||
else if ( info.contentType == kControlContentCGImageRef )
|
||||
SetMenuItemIconHandle( mhandle , index ,
|
||||
kMenuCGImageRefType , (Handle) info.u.imageRef ) ;
|
||||
}
|
||||
|
@@ -639,6 +639,15 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||
wxT("invalid menu index in wxMenuBar::GetLabelTop") );
|
||||
|
||||
return wxStripMenuCodes(m_titles[pos]);
|
||||
}
|
||||
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString wxMenuBar::GetMenuLabel(size_t pos) const
|
||||
{
|
||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||
wxT("invalid menu index in wxMenuBar::GetMenuLabel") );
|
||||
|
||||
return m_titles[pos];
|
||||
}
|
||||
|
||||
|
@@ -234,6 +234,8 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
|
||||
if ( !menu )
|
||||
return;
|
||||
|
||||
m_titles[pos] = label;
|
||||
|
||||
Widget w = (Widget)menu->GetButtonWidget();
|
||||
if (w)
|
||||
{
|
||||
@@ -247,6 +249,8 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
|
||||
|
||||
wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||
{
|
||||
return wxStripMenuCodes(m_titles[pos]);
|
||||
#if 0
|
||||
wxMenu *menu = GetMenu(pos);
|
||||
if ( menu )
|
||||
{
|
||||
@@ -263,8 +267,19 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||
}
|
||||
|
||||
return wxEmptyString;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString wxMenuBar::GetMenuLabel(size_t pos) const
|
||||
{
|
||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||
wxT("invalid menu index in wxMenuBar::GetMenuLabel") );
|
||||
|
||||
return m_titles[pos];
|
||||
}
|
||||
|
||||
|
||||
bool wxMenuBar::Append(wxMenu * menu, const wxString& title)
|
||||
{
|
||||
return Insert(GetMenuCount(), menu, title);
|
||||
|
@@ -433,7 +433,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
!pItem->GetBackgroundColour().Ok() &&
|
||||
!pItem->GetFont().Ok() )
|
||||
{
|
||||
// try to use InsertMenuItem() as it's guaranteed to look correct
|
||||
// try to use InsertMenuItem() as it's guaranteed to look correct
|
||||
// while our owner-drawn code is not
|
||||
|
||||
// first compile-time check
|
||||
@@ -441,7 +441,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
#if defined(MIIM_BITMAP) && (_WIN32_WINNT >= 0x0500)
|
||||
WinStruct<wxMENUITEMINFO_> mii;
|
||||
if ( wxGetWinVersion() >= wxWinVersion_98 )
|
||||
{
|
||||
{
|
||||
mii.fMask = MIIM_STRING | MIIM_DATA | MIIM_BITMAP;
|
||||
if ( pItem->IsCheckable() )
|
||||
{
|
||||
@@ -1086,6 +1086,15 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||
return wxMenuItem::GetLabelFromText(m_titles[pos]);
|
||||
}
|
||||
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString wxMenuBar::GetMenuLabel(size_t pos) const
|
||||
{
|
||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||
wxT("invalid menu index in wxMenuBar::GetMenuLabel") );
|
||||
|
||||
return m_titles[pos];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMenuBar construction
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@@ -892,9 +892,19 @@ wxString wxMenuBar::GetLabelTop(
|
||||
{
|
||||
wxCHECK_MSG( nPos < GetMenuCount(), wxEmptyString,
|
||||
wxT("invalid menu index in wxMenuBar::GetLabelTop") );
|
||||
return m_titles[nPos];
|
||||
return wxStripMenuCodes(m_titles[nPos]);
|
||||
} // end of wxMenuBar::GetLabelTop
|
||||
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString wxMenuBar::GetMenuLabel(size_t pos) const
|
||||
{
|
||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||
wxT("invalid menu index in wxMenuBar::GetMenuLabel") );
|
||||
|
||||
return m_titles[pos];
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMenuBar construction
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@@ -395,6 +395,15 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||
return wxMenuItem::GetLabelFromText(m_titles[pos]);
|
||||
}
|
||||
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString wxMenuBar::GetMenuLabel(size_t pos) const
|
||||
{
|
||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||
wxT("invalid menu index in wxMenuBar::GetMenuLabel") );
|
||||
|
||||
return m_titles[pos];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMenuBar construction
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@@ -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;
|
||||
@@ -1822,9 +1826,9 @@ bool wxMenuBar::IsEnabledTop(size_t pos) const
|
||||
|
||||
void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
|
||||
{
|
||||
wxCHECK_RET( pos < GetCount(), _T("invalid index in EnableTop") );
|
||||
wxCHECK_RET( pos < GetCount(), _T("invalid index in SetLabelTop") );
|
||||
|
||||
if ( label != m_menuInfos[pos].GetLabel() )
|
||||
if ( label != m_menuInfos[pos].GetOriginalLabel() )
|
||||
{
|
||||
m_menuInfos[pos].SetLabel(label);
|
||||
|
||||
@@ -1840,6 +1844,16 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||
return m_menuInfos[pos].GetLabel();
|
||||
}
|
||||
|
||||
// Gets the original label at the top-level of the menubar
|
||||
wxString wxMenuBar::GetMenuLabel(size_t pos) const
|
||||
{
|
||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||
wxT("invalid menu index in wxMenuBar::GetMenuLabel") );
|
||||
|
||||
return m_menuInfos[pos].GetOriginalLabel();
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenuBar drawing
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -39,6 +39,14 @@
|
||||
*wxLog*DoCreateOnDemand*;
|
||||
*wxLogChain*DetachOldLog*;
|
||||
*wxMemoryFSHandler*AddFileWithMimeType*;
|
||||
*wxMenuBar*GetMenuLabel*;
|
||||
*wxMenuBarBase*SetMenuLabel*;
|
||||
*wxMenuBarBase*GetMenuLabelText*;
|
||||
*wxMenuBase*GetLabelText*;
|
||||
*wxMenuItemBase*SetItemLabel*;
|
||||
*wxMenuItemBase*GetItemLabelText*;
|
||||
*wxMenuItemBase*GetLabelText*;
|
||||
*wxMenuItem*GetItemLabel*;
|
||||
*wxMetafileDC*DoGetTextExtent*;
|
||||
*wxWindowMSW*GetThemedBorderStyle*;
|
||||
*wxWizard*GetBitmap*;
|
||||
|
Reference in New Issue
Block a user