From: Francesco Montorsi Date: Sun, 5 Aug 2007 18:54:22 +0000 (+0000) Subject: added the static function GetLabelText() to wxStaticText which was mentioned in the... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/19cf1ef3a7077dd99a90f141847b8a9b67b318c9 added the static function GetLabelText() to wxStaticText which was mentioned in the docs but not implemented; also fixed the return type documented for wxControl::GetLabel*() functions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/control.tex b/docs/latex/wx/control.tex index 4b01800192..584363605b 100644 --- a/docs/latex/wx/control.tex +++ b/docs/latex/wx/control.tex @@ -35,7 +35,7 @@ Simulates the effect of the user issuing a command to the item. See \helpref{wxC \membersection{wxControl::GetLabel}\label{wxcontrolgetlabel} -\constfunc{const wxString\&}{GetLabel}{\void} +\constfunc{wxString}{GetLabel}{\void} Returns the control's text. @@ -48,10 +48,10 @@ undesired. \constfunc{const wxString\&}{GetLabelText}{\void} -\func{static const wxString\&}{GetLabelText}{\param{const wxString\& }{label}} +\func{static wxString}{GetLabelText}{\param{const wxString\& }{label}} -Returns the control's label or the given \arg{label} string for the static -version without the mnemonics characters. +Returns the control's label, or the given \arg{label} string for the static +version, without the mnemonics characters. \membersection{wxControl::SetLabel}\label{wxcontrolsetlabel} diff --git a/docs/latex/wx/stattext.tex b/docs/latex/wx/stattext.tex index 188ed07ce9..00be03aa2c 100644 --- a/docs/latex/wx/stattext.tex +++ b/docs/latex/wx/stattext.tex @@ -106,12 +106,15 @@ label text is needed. \membersection{wxStaticText::GetLabelText}\label{wxstatictextgetlabeltext} -\constfunc{const wxString\&}{GetLabelText}{\void} +\constfunc{wxString}{GetLabelText}{\void} -Returns the control's label or the given \arg{label} string for the static -version without the mnemonics characters (if any) and without the markup -(if the control has \texttt{wxST\_MARKUP} style). +\func{static wxString}{GetLabelText}{\param{const wxString\& }{label}} +The first form returns the control's label without the mnemonics characters (if any) +and without the markup (if the control has \texttt{wxST\_MARKUP} style). + +The second (static) version returns the given \arg{label} string without the mnemonics +characters (if any) and without the markup. \membersection{wxStaticText::SetLabel}\label{wxstatictextsetlabel} diff --git a/include/wx/stattext.h b/include/wx/stattext.h index 8795777ea8..3a1c6cb047 100644 --- a/include/wx/stattext.h +++ b/include/wx/stattext.h @@ -58,6 +58,9 @@ public: // public utilities (symmetric to those in wxControl about mnemonics): + // get the string without mnemonic characters ('&') and without markup + static wxString GetLabelText(const wxString& label); + // removes the markup accepted by wxStaticText when wxST_MARKUP is used, // and then returns the cleaned string static wxString RemoveMarkup(const wxString& str); diff --git a/src/common/stattextcmn.cpp b/src/common/stattextcmn.cpp index b40340b5c7..b4b6acee00 100644 --- a/src/common/stattextcmn.cpp +++ b/src/common/stattextcmn.cpp @@ -154,6 +154,14 @@ wxString wxStaticTextBase::GetLabelText() const return RemoveMnemonics(ret); } +/*static*/ +wxString wxStaticTextBase::GetLabelText(const wxString& label) +{ + // remove markup + wxString ret = RemoveMarkup(label); + return RemoveMnemonics(ret); +} + /*static*/ wxString wxStaticTextBase::RemoveMarkup(const wxString& text) {