Add wxRendererNative::DrawItemText() for list-like controls
Add a new method that should be used for drawing the elements of list-like controls (i.e. wx{List,Tree,DataView}Ctrl and similar). Implement it for wxMSW natively and provide a straightforward generic fallback for the other ports. See #16414.
This commit is contained in:
committed by
Vadim Zeitlin
parent
ba4bfc5414
commit
b7a89f8746
@@ -84,10 +84,32 @@ private:
|
||||
wxDECLARE_NO_COPY_CLASS(wxUxThemeFont);
|
||||
};
|
||||
|
||||
typedef int(__stdcall *DTT_CALLBACK_PROC)(HDC hdc, const wchar_t * pszText, int cchText, RECT * prc, unsigned int dwFlags, WXLPARAM lParam);
|
||||
|
||||
typedef struct _DTTOPTS
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD dwFlags;
|
||||
COLORREF crText;
|
||||
COLORREF crBorder;
|
||||
COLORREF crShadow;
|
||||
int iTextShadowType;
|
||||
POINT ptShadowOffset;
|
||||
int iBorderSize;
|
||||
int iFontPropId;
|
||||
int iColorPropId;
|
||||
int iStateId;
|
||||
BOOL fApplyOverlay;
|
||||
int iGlowSize;
|
||||
DTT_CALLBACK_PROC pfnDrawTextCallback;
|
||||
WXLPARAM lParam;
|
||||
} DTTOPTS, *PDTTOPTS;
|
||||
|
||||
typedef HTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(HWND, const wchar_t *);
|
||||
typedef HRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(HTHEME);
|
||||
typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(HTHEME, HDC, int, int, const RECT *, const RECT *);
|
||||
typedef HRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, DWORD, const RECT *);
|
||||
typedef HRESULT (__stdcall *PFNWXUDRAWTHEMETEXTEX)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, RECT *, const DTTOPTS *);
|
||||
typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME, HDC, int, int, const RECT *, RECT *);
|
||||
typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(HTHEME, HDC, int, int, const RECT *, RECT *);
|
||||
typedef HRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(HTHEME, HDC, int, int, const RECT *, /* enum */ THEMESIZE, SIZE *);
|
||||
@@ -161,6 +183,7 @@ public:
|
||||
wxUX_THEME_DECLARE(PFNWXUCLOSETHEMEDATA, CloseThemeData)
|
||||
wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEBACKGROUND, DrawThemeBackground)
|
||||
wxUX_THEME_DECLARE(PFNWXUDRAWTHEMETEXT, DrawThemeText)
|
||||
wxUX_THEME_DECLARE(PFNWXUDRAWTHEMETEXTEX, DrawThemeTextEx)
|
||||
wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDCONTENTRECT, GetThemeBackgroundContentRect)
|
||||
wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDEXTENT, GetThemeBackgroundExtent)
|
||||
wxUX_THEME_DECLARE(PFNWXUGETTHEMEPARTSIZE, GetThemePartSize)
|
||||
|
@@ -329,6 +329,14 @@ public:
|
||||
int max,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// Draw text using the appropriate color for normal and selected states.
|
||||
virtual void DrawItemText(wxWindow* win,
|
||||
wxDC& dc,
|
||||
const wxString& text,
|
||||
const wxRect& rect,
|
||||
int align = wxALIGN_LEFT | wxALIGN_TOP,
|
||||
int flags = 0) = 0;
|
||||
|
||||
// geometry functions
|
||||
// ------------------
|
||||
|
||||
@@ -515,6 +523,14 @@ public:
|
||||
int flags = 0)
|
||||
{ m_rendererNative.DrawGauge(win, dc, rect, value, max, flags); }
|
||||
|
||||
virtual void DrawItemText(wxWindow* win,
|
||||
wxDC& dc,
|
||||
const wxString& text,
|
||||
const wxRect& rect,
|
||||
int align = wxALIGN_LEFT | wxALIGN_TOP,
|
||||
int flags = 0)
|
||||
{ m_rendererNative.DrawItemText(win, dc, text, rect, align, flags); }
|
||||
|
||||
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win)
|
||||
{ return m_rendererNative.GetSplitterParams(win); }
|
||||
|
||||
|
Reference in New Issue
Block a user