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 wxXPMHandler::SaveFile for images with more than 92 colors.
|
||||||
- Fixed a crash in wxGrid on creation due to OnSize being called too soon.
|
- Fixed a crash in wxGrid on creation due to OnSize being called too soon.
|
||||||
- Added XRC handler for wxPropertySheetDialog (Sander Berents).
|
- 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:
|
wxMSW:
|
||||||
|
|
||||||
|
@@ -423,7 +423,7 @@ item was not found.
|
|||||||
|
|
||||||
\constfunc{wxString}{GetLabel}{\param{int}{ id}}
|
\constfunc{wxString}{GetLabel}{\param{int}{ id}}
|
||||||
|
|
||||||
Returns a menu item label.
|
Returns a menu item label, including any mnemonics and accelerators.
|
||||||
|
|
||||||
\wxheading{Parameters}
|
\wxheading{Parameters}
|
||||||
|
|
||||||
@@ -435,7 +435,26 @@ The item label, or the empty string if the item was not found.
|
|||||||
|
|
||||||
\wxheading{See also}
|
\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}
|
\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.
|
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}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop}
|
\helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop}
|
||||||
@@ -977,6 +998,56 @@ Returns the menu at {\it menuIndex} (zero-based).
|
|||||||
Returns the number of menus in this menubar.
|
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}
|
\membersection{wxMenuBar::Insert}\label{wxmenubarinsert}
|
||||||
|
|
||||||
\func{bool}{Insert}{\param{size\_t }{pos}, \param{wxMenu *}{menu}, \param{const wxString\& }{title}}
|
\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.
|
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}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{wxMenuBar::GetLabelTop}{wxmenubargetlabeltop}
|
\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.
|
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}
|
\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
|
Returns the text associated with the menu item without any accelerator
|
||||||
characters it might contain.
|
characters it might contain.
|
||||||
|
|
||||||
|
This function is deprecated in favour of \helpref{GetItemLabelText}{wxmenuitemgetitemlabeltext}.
|
||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{GetText}{wxmenuitemgettext},
|
\helpref{GetText}{wxmenuitemgettext},
|
||||||
\helpref{GetLabelFromText}{wxmenuitemgetlabelfromtext}
|
\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}
|
\membersection{wxMenuItem::GetLabelFromText}\label{wxmenuitemgetlabelfromtext}
|
||||||
|
|
||||||
\func{static wxString}{GetLabelFromText}{\param{const wxString\& }{text}}
|
\func{static wxString}{GetLabelFromText}{\param{const wxString\& }{text}}
|
||||||
@@ -183,12 +229,13 @@ wxMenuItem::GetLabelFromText("&Hello\tCtrl-H");
|
|||||||
|
|
||||||
will return just {\tt "Hello"}.
|
will return just {\tt "Hello"}.
|
||||||
|
|
||||||
|
This function is deprecated; please use \helpref{wxMenuItem::GetLabelText}{wxmenuitemgetlabeltext} instead.
|
||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{GetText}{wxmenuitemgettext},
|
\helpref{GetText}{wxmenuitemgettext},
|
||||||
\helpref{GetLabel}{wxmenuitemgetlabel}
|
\helpref{GetLabel}{wxmenuitemgetlabel}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxMenuItem::GetMarginWidth}\label{wxmenuitemgetmarginwidth}
|
\membersection{wxMenuItem::GetMarginWidth}\label{wxmenuitemgetmarginwidth}
|
||||||
|
|
||||||
\constfunc{int}{GetMarginWidth}{\void}
|
\constfunc{int}{GetMarginWidth}{\void}
|
||||||
@@ -221,6 +268,8 @@ instead.
|
|||||||
Returns the text associated with the menu item, such as it was passed to the
|
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.
|
wxMenuItem constructor, i.e. with any accelerator characters it may contain.
|
||||||
|
|
||||||
|
This function is deprecated in favour of \helpref{GetItemLabel}{wxmenuitemgetitemlabel}.
|
||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{GetLabel}{wxmenuitemgetlabel},
|
\helpref{GetLabel}{wxmenuitemgetlabel},
|
||||||
@@ -314,6 +363,13 @@ Sets the font associated with the menu item (Windows only).
|
|||||||
Sets the help string.
|
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}
|
\membersection{wxMenuItem::SetMarginWidth}\label{wxmenuitemsetmarginwidth}
|
||||||
|
|
||||||
\constfunc{void}{SetMarginWidth}{\param{int}{ width}}
|
\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.
|
Sets the text associated with the menu item.
|
||||||
|
|
||||||
|
This function is deprecated in favour of \helpref{SetItemLabel}{wxmenuitemsetitemlabel}.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxMenuItem::SetTextColour}\label{wxmenuitemsettextcolour}
|
\membersection{wxMenuItem::SetTextColour}\label{wxmenuitemsettextcolour}
|
||||||
|
|
||||||
|
@@ -183,6 +183,14 @@ private:
|
|||||||
bool m_shouldShowMenu;
|
bool m_shouldShowMenu;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
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_
|
#endif // _WX_COCOA_MENU_H_
|
||||||
|
@@ -94,6 +94,14 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
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_
|
#endif // _WX_COCOA_MENUITEM_H_
|
||||||
|
@@ -57,6 +57,13 @@ private:
|
|||||||
void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
|
void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
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
|
GtkWidget* m_labelWidget; // Label widget
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
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);
|
void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
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
|
GtkWidget* m_labelWidget; // Label widget
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -174,6 +174,13 @@ private:
|
|||||||
static wxMenuBar* s_macCommonMenuBar ;
|
static wxMenuBar* s_macCommonMenuBar ;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
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_
|
#endif // _WX_MENU_H_
|
||||||
|
@@ -75,6 +75,14 @@ private:
|
|||||||
void* m_menu ; // the appropriate menu , may also be a system menu
|
void* m_menu ; // the appropriate menu , may also be a system menu
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
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
|
#endif //_MENUITEM_H
|
||||||
|
@@ -160,6 +160,13 @@ private:
|
|||||||
static wxMenuBar* s_macCommonMenuBar ;
|
static wxMenuBar* s_macCommonMenuBar ;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
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_
|
#endif // _WX_MENU_H_
|
||||||
|
@@ -72,6 +72,14 @@ private:
|
|||||||
void* m_menu ; // the appropriate menu , may also be a system menu
|
void* m_menu ; // the appropriate menu , may also be a system menu
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
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
|
#endif //_MENUITEM_H
|
||||||
|
@@ -375,6 +375,14 @@ protected:
|
|||||||
static bool ms_locked;
|
static bool ms_locked;
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(wxMenuBase)
|
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;
|
wxFrame *m_menuBarFrame;
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(wxMenuBarBase)
|
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
|
// different from the item's label which only contains the text shown
|
||||||
// in the menu
|
// in the menu
|
||||||
virtual void SetText(const wxString& str);
|
virtual void SetText(const wxString& str);
|
||||||
|
|
||||||
wxString GetLabel() const { return GetLabelFromText(m_text); }
|
wxString GetLabel() const { return GetLabelFromText(m_text); }
|
||||||
const wxString& GetText() const { return 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
|
// declare them ourselves - but don't implement as they shouldn't be used
|
||||||
wxMenuItemBase(const wxMenuItemBase& item);
|
wxMenuItemBase(const wxMenuItemBase& item);
|
||||||
wxMenuItemBase& operator=(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;
|
wxFont m_font;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
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_
|
#endif // _WX_MOTIF_MENU_H_
|
||||||
|
@@ -63,6 +63,15 @@ private:
|
|||||||
wxBitmap m_bitmap; // Bitmap for menuitem, if any
|
wxBitmap m_bitmap; // Bitmap for menuitem, if any
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
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
|
#endif // _WX_MOTIF_MENUITEM_H
|
||||||
|
@@ -229,6 +229,13 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar)
|
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_
|
#endif // _WX_MENU_H_
|
||||||
|
@@ -87,6 +87,14 @@ private:
|
|||||||
bool m_isRadioGroupStart;
|
bool m_isRadioGroupStart;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem)
|
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
|
#endif //_MENUITEM_H
|
||||||
|
@@ -287,6 +287,13 @@ private:
|
|||||||
{ wxWindow::Refresh(bErase, pRect); }
|
{ wxWindow::Refresh(bErase, pRect); }
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
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_
|
#endif // _WX_MENU_H_
|
||||||
|
@@ -117,6 +117,15 @@ private:
|
|||||||
bool m_bIsRadioGroupStart;
|
bool m_bIsRadioGroupStart;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
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
|
}; // end of CLASS wxMenuItem
|
||||||
|
|
||||||
#endif //_MENUITEM_H
|
#endif //_MENUITEM_H
|
||||||
|
@@ -192,6 +192,13 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar)
|
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_
|
#endif // _WX_MENU_H_
|
||||||
|
@@ -82,6 +82,14 @@ private:
|
|||||||
bool m_isRadioGroupStart;
|
bool m_isRadioGroupStart;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem)
|
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
|
#endif //_MENUITEM_H
|
||||||
|
@@ -270,6 +270,13 @@ private:
|
|||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
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_
|
#endif // _WX_UNIV_MENU_H_
|
||||||
|
@@ -121,6 +121,14 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
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_
|
#endif // _WX_UNIV_MENUITEM_H_
|
||||||
|
@@ -227,6 +227,13 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
|||||||
return wxStringWithNSString([[m_cocoaNSMenu itemAtIndex:itemindex] title]);
|
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)
|
void wxMenuBar::Attach(wxFrame *frame)
|
||||||
{
|
{
|
||||||
wxMenuBarBase::Attach(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;
|
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
|
#endif // wxUSE_MENUS
|
||||||
|
@@ -91,6 +91,40 @@ static wxString wxReplaceUnderscore( const wxString& title )
|
|||||||
return str;
|
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
|
// 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 )
|
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 );
|
int res = menu->FindItem( itemString );
|
||||||
if (res != wxNOT_FOUND)
|
if (res != wxNOT_FOUND)
|
||||||
@@ -518,23 +552,19 @@ wxString wxMenuBar::GetLabelTop( size_t pos ) const
|
|||||||
|
|
||||||
wxMenu* menu = node->GetData();
|
wxMenu* menu = node->GetData();
|
||||||
|
|
||||||
wxString label;
|
return wxStripMenuCodes(wxConvertFromGTKToWXLabel(menu->GetTitle()));
|
||||||
wxString text( menu->GetTitle() );
|
}
|
||||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
|
||||||
{
|
|
||||||
if ( *pc == wxT('_') )
|
|
||||||
{
|
|
||||||
// '_' is the escape character for GTK+
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't remove ampersands '&' since if we have them in the menu title
|
// Gets the original label at the top-level of the menubar
|
||||||
// it means that they were doubled to indicate "&" instead of accelerator
|
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 )
|
void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
|
||||||
@@ -743,6 +773,12 @@ wxMenuItem::~wxMenuItem()
|
|||||||
/* static */
|
/* static */
|
||||||
wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
|
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;
|
wxString label;
|
||||||
|
|
||||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
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() );
|
// wxPrintf( wxT("GetLabelFromText(): text %s label %s\n"), text.c_str(), label.c_str() );
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenuItem::SetText( const wxString& str )
|
void wxMenuItem::SetText( const wxString& str )
|
||||||
@@ -986,6 +1023,14 @@ bool wxMenuItem::IsChecked() const
|
|||||||
return ((GtkCheckMenuItem*)m_menuItem)->active != 0;
|
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
|
// wxMenu
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -91,6 +91,40 @@ static wxString wxReplaceUnderscore( const wxString& title )
|
|||||||
return str;
|
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
|
// 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 )
|
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 );
|
int res = menu->FindItem( itemString );
|
||||||
if (res != wxNOT_FOUND)
|
if (res != wxNOT_FOUND)
|
||||||
@@ -501,23 +535,19 @@ wxString wxMenuBar::GetLabelTop( size_t pos ) const
|
|||||||
|
|
||||||
wxMenu* menu = node->GetData();
|
wxMenu* menu = node->GetData();
|
||||||
|
|
||||||
wxString label;
|
return wxStripMenuCodes(wxConvertFromGTKToWXLabel(menu->GetTitle()));
|
||||||
wxString text( menu->GetTitle() );
|
}
|
||||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
|
||||||
{
|
|
||||||
if ( *pc == wxT('_') )
|
|
||||||
{
|
|
||||||
// '_' is the escape character for GTK+
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't remove ampersands '&' since if we have them in the menu title
|
// Gets the original label at the top-level of the menubar
|
||||||
// it means that they were doubled to indicate "&" instead of accelerator
|
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 )
|
void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
|
||||||
@@ -736,6 +766,12 @@ wxMenuItem::~wxMenuItem()
|
|||||||
/* static */
|
/* static */
|
||||||
wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
|
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;
|
wxString label;
|
||||||
|
|
||||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
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() );
|
// wxPrintf( wxT("GetLabelFromText(): text %s label %s\n"), text.c_str(), label.c_str() );
|
||||||
|
#endif
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
@@ -927,6 +964,14 @@ bool wxMenuItem::IsChecked() const
|
|||||||
return ((GtkCheckMenuItem*)m_menuItem)->active != 0;
|
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
|
// wxMenu
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -876,6 +876,15 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
|||||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||||
wxT("invalid menu index in wxMenuBar::GetLabelTop") );
|
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];
|
return m_titles[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -639,6 +639,15 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
|||||||
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
|
||||||
wxT("invalid menu index in wxMenuBar::GetLabelTop") );
|
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];
|
return m_titles[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -234,6 +234,8 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
|
|||||||
if ( !menu )
|
if ( !menu )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_titles[pos] = label;
|
||||||
|
|
||||||
Widget w = (Widget)menu->GetButtonWidget();
|
Widget w = (Widget)menu->GetButtonWidget();
|
||||||
if (w)
|
if (w)
|
||||||
{
|
{
|
||||||
@@ -247,6 +249,8 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
|
|||||||
|
|
||||||
wxString wxMenuBar::GetLabelTop(size_t pos) const
|
wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||||
{
|
{
|
||||||
|
return wxStripMenuCodes(m_titles[pos]);
|
||||||
|
#if 0
|
||||||
wxMenu *menu = GetMenu(pos);
|
wxMenu *menu = GetMenu(pos);
|
||||||
if ( menu )
|
if ( menu )
|
||||||
{
|
{
|
||||||
@@ -263,8 +267,19 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
return wxEmptyString;
|
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)
|
bool wxMenuBar::Append(wxMenu * menu, const wxString& title)
|
||||||
{
|
{
|
||||||
return Insert(GetMenuCount(), menu, title);
|
return Insert(GetMenuCount(), menu, title);
|
||||||
|
@@ -1086,6 +1086,15 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
|||||||
return wxMenuItem::GetLabelFromText(m_titles[pos]);
|
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
|
// wxMenuBar construction
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -892,9 +892,19 @@ wxString wxMenuBar::GetLabelTop(
|
|||||||
{
|
{
|
||||||
wxCHECK_MSG( nPos < GetMenuCount(), wxEmptyString,
|
wxCHECK_MSG( nPos < GetMenuCount(), wxEmptyString,
|
||||||
wxT("invalid menu index in wxMenuBar::GetLabelTop") );
|
wxT("invalid menu index in wxMenuBar::GetLabelTop") );
|
||||||
return m_titles[nPos];
|
return wxStripMenuCodes(m_titles[nPos]);
|
||||||
} // end of wxMenuBar::GetLabelTop
|
} // 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
|
// wxMenuBar construction
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -395,6 +395,15 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
|||||||
return wxMenuItem::GetLabelFromText(m_titles[pos]);
|
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
|
// wxMenuBar construction
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -67,6 +67,8 @@ public:
|
|||||||
|
|
||||||
void SetLabel(const wxString& text)
|
void SetLabel(const wxString& text)
|
||||||
{
|
{
|
||||||
|
m_originalLabel = text;
|
||||||
|
|
||||||
// remember the accel char (may be -1 if none)
|
// remember the accel char (may be -1 if none)
|
||||||
m_indexAccel = wxControl::FindAccelIndex(text, &m_label);
|
m_indexAccel = wxControl::FindAccelIndex(text, &m_label);
|
||||||
|
|
||||||
@@ -79,6 +81,7 @@ public:
|
|||||||
// accessors
|
// accessors
|
||||||
|
|
||||||
const wxString& GetLabel() const { return m_label; }
|
const wxString& GetLabel() const { return m_label; }
|
||||||
|
const wxString& GetOriginalLabel() const { return m_originalLabel; }
|
||||||
bool IsEnabled() const { return m_isEnabled; }
|
bool IsEnabled() const { return m_isEnabled; }
|
||||||
wxCoord GetWidth(wxMenuBar *menubar) const
|
wxCoord GetWidth(wxMenuBar *menubar) const
|
||||||
{
|
{
|
||||||
@@ -105,6 +108,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString m_label;
|
wxString m_label;
|
||||||
|
wxString m_originalLabel;
|
||||||
wxCoord m_width;
|
wxCoord m_width;
|
||||||
int m_indexAccel;
|
int m_indexAccel;
|
||||||
bool m_isEnabled;
|
bool m_isEnabled;
|
||||||
@@ -1822,9 +1826,9 @@ bool wxMenuBar::IsEnabledTop(size_t pos) const
|
|||||||
|
|
||||||
void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
|
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);
|
m_menuInfos[pos].SetLabel(label);
|
||||||
|
|
||||||
@@ -1840,6 +1844,16 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const
|
|||||||
return m_menuInfos[pos].GetLabel();
|
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
|
// wxMenuBar drawing
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -39,6 +39,14 @@
|
|||||||
*wxLog*DoCreateOnDemand*;
|
*wxLog*DoCreateOnDemand*;
|
||||||
*wxLogChain*DetachOldLog*;
|
*wxLogChain*DetachOldLog*;
|
||||||
*wxMemoryFSHandler*AddFileWithMimeType*;
|
*wxMemoryFSHandler*AddFileWithMimeType*;
|
||||||
|
*wxMenuBar*GetMenuLabel*;
|
||||||
|
*wxMenuBarBase*SetMenuLabel*;
|
||||||
|
*wxMenuBarBase*GetMenuLabelText*;
|
||||||
|
*wxMenuBase*GetLabelText*;
|
||||||
|
*wxMenuItemBase*SetItemLabel*;
|
||||||
|
*wxMenuItemBase*GetItemLabelText*;
|
||||||
|
*wxMenuItemBase*GetLabelText*;
|
||||||
|
*wxMenuItem*GetItemLabel*;
|
||||||
*wxMetafileDC*DoGetTextExtent*;
|
*wxMetafileDC*DoGetTextExtent*;
|
||||||
*wxWindowMSW*GetThemedBorderStyle*;
|
*wxWindowMSW*GetThemedBorderStyle*;
|
||||||
*wxWizard*GetBitmap*;
|
*wxWizard*GetBitmap*;
|
||||||
|
Reference in New Issue
Block a user