X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5c87527c5a81eda63e7ccbda2f226ca02716e7da..f1b63efe8993c6c0460354bc2da7331526d43efa:/include/wx/control.h?ds=sidebyside diff --git a/include/wx/control.h b/include/wx/control.h index 2bf0c472ad..e2db727b4c 100644 --- a/include/wx/control.h +++ b/include/wx/control.h @@ -53,9 +53,6 @@ public: // get the control alignment (left/right/centre, top/bottom/centre) int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } - // get just the text of the label, without mnemonic characters ('&') - wxString GetLabelText() const { return GetLabelText(GetLabel()); } - virtual void SetLabel(const wxString& label) { m_labelOrig = label; @@ -72,6 +69,14 @@ public: return m_labelOrig; } + // get just the text of the label, without mnemonic characters ('&') + wxString GetLabelText() const { return GetLabelText(GetLabel()); } + + void SetLabelText(const wxString& text) + { + SetLabel(EscapeMnemonics(text)); + } + // static utilities: // replaces parts of the string with ellipsis if needed @@ -84,6 +89,9 @@ public: // removes the mnemonics characters static wxString RemoveMnemonics(const wxString& str); + // escapes (by doubling them) the mnemonics + static wxString EscapeMnemonics(const wxString& str); + // return the accel index in the string or -1 if none and puts the modified // string into second parameter if non NULL static int FindAccelIndex(const wxString& label,