Replace wxST_MARKUP style with wxControl::SetLabelMarkup().

This is an incompatible change which removes the wxStaticText-specific
wxST_MARKUP style and adds wxControl::SetLabelMarkup() replacing it.

It doesn't actually change anything yet but it simplifies wxStaticText code a
lot by getting rid of many markup-related functions in it which had to behave
differently depending on whether wxST_MARKUP was used or not and also paves
way for adding markup support for the other controls in the future.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67055 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-02-27 12:47:26 +00:00
parent 6ea2bc50c8
commit 3da9cffc79
17 changed files with 290 additions and 343 deletions

View File

@@ -38,6 +38,8 @@
#include "wx/settings.h"
#endif
#include "wx/private/markupparser.h"
const char wxControlNameStr[] = "control";
// ============================================================================
@@ -230,6 +232,27 @@ wxControlBase::GetCompositeControlsDefaultAttributes(wxWindowVariant WXUNUSED(va
return attrs;
}
// ----------------------------------------------------------------------------
// wxControl markup support
// ----------------------------------------------------------------------------
/* static */
wxString wxControlBase::RemoveMarkup(const wxString& markup)
{
return wxMarkupParser::Strip(markup);
}
bool wxControlBase::DoSetLabelMarkup(const wxString& markup)
{
const wxString label = RemoveMarkup(markup);
if ( label.empty() && !markup.empty() )
return false;
SetLabel(label);
return true;
}
// ----------------------------------------------------------------------------
// wxControlBase - ellipsization code
// ----------------------------------------------------------------------------