reorder GetLabel(), GetLabelText(), SetLabel() and SetLabelText() function declarations, implementations and relative documentations.

Add wxStaticTextBase::GetLabelWithoutMarkup() and use it in the wxMSW implementation of wxStaticText::SetLabel() to close bug #11446; the function RemoveMarkup() which was previously used in fact could not check for presence/absence of wxST_MARKUP style since it's a static function.

Add wxStaticTextBase::SetLabelText() functions for symmetry with wxControlBase::SetLabelText()

Add test unit for both wxControl::*Label* and wxStaticText::*Label* functions.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2010-03-21 21:39:15 +00:00
parent 90497db95b
commit 32ee98eb76
18 changed files with 522 additions and 381 deletions

View File

@@ -154,15 +154,28 @@ wxString wxStaticTextBase::GetLabelText() const
return RemoveMnemonics(ret);
}
/*static*/
void wxStaticTextBase::SetLabelText(const wxString& text)
{
wxString str = text;
if (HasFlag(wxST_MARKUP))
str = EscapeMarkup(str); // escapes markup and the & characters (which are also mnemonics)
else
str = EscapeMnemonics(text); // escape only the mnemonics
SetLabel(str);
}
/* static */
wxString wxStaticTextBase::GetLabelText(const wxString& label)
{
// remove markup
wxString ret = RemoveMarkup(label);
// always remove the markup (this function is static
// and cannot check for wxST_MARKUP presence/absence)
return RemoveMnemonics(ret);
}
/*static*/
/* static */
wxString wxStaticTextBase::RemoveMarkup(const wxString& text)
{
// strip out of "text" the markup for platforms which don't support it natively
@@ -293,6 +306,17 @@ void wxStaticTextBase::UpdateLabel()
DoSetLabel(newlabel);
}
wxString wxStaticTextBase::GetLabelWithoutMarkup() const
{
wxString ret(m_labelOrig);
if (HasFlag(wxST_MARKUP))
ret = RemoveMarkup(ret);
// unlike GetLabelText() we don't remove the mnemonics here!
return ret;
}
wxString wxStaticTextBase::GetEllipsizedLabelWithoutMarkup() const
{
// this function should be used only by ports which do not support