Add wxMarkupText::RenderItemText()

Add new method allowing to use wxRendererNative::DrawItemText() for actually
rendering the text instead of wxDC::DrawLabel().

This will be used for markup support in (generic) wxDataViewCtrl.
This commit is contained in:
Vadim Zeitlin
2016-06-15 04:34:03 +02:00
parent 8760e4fb70
commit acd77439f9
2 changed files with 117 additions and 31 deletions

View File

@@ -15,6 +15,8 @@
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxRect;
class wxMarkupParserOutput;
// ----------------------------------------------------------------------------
// wxMarkupText: allows to measure and draw the text containing markup.
// ----------------------------------------------------------------------------
@@ -53,6 +55,11 @@ public:
// The same rules for mnemonics as in the ctor apply to this string.
void SetMarkup(const wxString& markup) { m_markup = markup; }
// This is a convenience method which can be used with the string in which
// mnemonics should be completely ignored, i.e. not interpreted in any way
// but just handled as ordinary characters.
void SetMarkupText(const wxString& markup);
// Return the width and height required by the given string and optionally
// the height of the visible part above the baseline (i.e. ascent minus
@@ -70,6 +77,18 @@ public:
// and set the clipping region before rendering if necessary.
void Render(wxDC& dc, const wxRect& rect, int flags);
// Similar to Render(), but uses wxRendererNative::DrawItemText() instead
// of generic wxDC::DrawLabel(), so is more suitable for use in controls
// that already use DrawItemText() for its items.
//
// The meaning of the flags here is different than in the overload above:
// they're passed to DrawItemText() and Render_ShowAccels is not supported
// here.
void RenderItemText(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int rendererFlags);
private:
wxString m_markup;
};