Add markup support to generic wxStaticText implementation.

wxMarkupText allows to easily support markup in the controls that we draw
ourselves so use it in wxGenericStaticText to have a possibility to use
markup on all platforms, even those where there is no native markup support in
wxStaticText itself.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67067 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-02-27 12:48:38 +00:00
parent de1cc37868
commit 2814e718ba
2 changed files with 83 additions and 9 deletions

View File

@@ -22,7 +22,7 @@
class WXDLLIMPEXP_CORE wxGenericStaticText : public wxStaticTextBase
{
public:
wxGenericStaticText() { }
wxGenericStaticText() { Init(); }
wxGenericStaticText(wxWindow *parent,
wxWindowID id,
@@ -32,6 +32,8 @@ public:
long style = 0,
const wxString& name = wxStaticTextNameStr)
{
Init();
Create(parent, id, label, pos, size, style, name);
}
@@ -43,6 +45,8 @@ public:
long style = 0,
const wxString& name = wxStaticTextNameStr);
virtual ~wxGenericStaticText();
// overridden base class virtual methods
virtual void SetLabel(const wxString& label);
@@ -56,12 +60,30 @@ protected:
void DoSetSize(int x, int y, int width, int height, int sizeFlags);
#if wxUSE_MARKUP
virtual bool DoSetLabelMarkup(const wxString& markup);
#endif // wxUSE_MARKUP
private:
void Init()
{
#if wxUSE_MARKUP
m_markupText = NULL;
#endif // wxUSE_MARKUP
}
void OnPaint(wxPaintEvent& event);
void DoDrawLabel(wxDC& dc, const wxRect& rect);
// These fields are only used if m_markupText == NULL.
wxString m_label;
int m_mnemonic;
#if wxUSE_MARKUP
class wxMarkupText *m_markupText;
#endif // wxUSE_MARKUP
DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericStaticText)
};