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:
@@ -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
|
||||
|
Reference in New Issue
Block a user