]>
Commit | Line | Data |
---|---|---|
c59e5089 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: renddll.cpp | |
3 | // Purpose: Example of a renderer implemented in a DLL | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 04.08.03 | |
7 | // RCS-ID: $Id$ | |
be5a51fb | 8 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> |
c59e5089 VZ |
9 | // Licence: wxWindows licence |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wxprec.h" | |
13 | ||
9c743a7c VS |
14 | #ifdef __BORLANDC__ |
15 | #pragma hdrstop | |
16 | #endif | |
17 | ||
c59e5089 VZ |
18 | #include "wx/renderer.h" |
19 | ||
174f7a2e VS |
20 | #ifndef WX_PRECOMP |
21 | #include "wx/dc.h" | |
22 | #endif | |
23 | ||
c59e5089 VZ |
24 | class MyDllRenderer : public wxRendererNative |
25 | { | |
26 | public: | |
27 | // draw the header control button (used by wxListCtrl) | |
28 | virtual void DrawHeaderButton(wxWindow *win, | |
29 | wxDC& dc, | |
30 | const wxRect& rect, | |
31 | int flags = 0) | |
32 | { | |
33 | dc.SetBrush(*wxCYAN_BRUSH); | |
34 | dc.SetTextForeground(*wxRED); | |
35 | dc.DrawRoundedRectangle(rect, 10); | |
36 | dc.DrawLabel(_T("MyDllRenderer"), wxNullBitmap, rect, wxALIGN_CENTER); | |
37 | } | |
38 | ||
39 | // draw the expanded/collapsed icon for a tree control item | |
40 | virtual void DrawTreeItemButton(wxWindow *win, | |
41 | wxDC& dc, | |
42 | const wxRect& rect, | |
43 | int flags = 0) | |
44 | { | |
45 | } | |
46 | ||
991d57f8 WS |
47 | // draw check button |
48 | virtual void DrawCheckButton(wxWindow *win, | |
49 | wxDC& dc, | |
50 | const wxRect& rect, | |
51 | int flags = 0) | |
52 | { | |
53 | } | |
54 | ||
c59e5089 VZ |
55 | // draw the border for sash window: this border must be such that the sash |
56 | // drawn by DrawSash() blends into it well | |
57 | virtual void DrawSplitterBorder(wxWindow *win, | |
58 | wxDC& dc, | |
59 | const wxRect& rect, | |
60 | int flags = 0) | |
61 | { | |
62 | } | |
63 | ||
64 | // draw a (vertical) sash | |
65 | virtual void DrawSplitterSash(wxWindow *win, | |
66 | wxDC& dc, | |
67 | const wxSize& size, | |
68 | wxCoord position, | |
69 | wxOrientation orient, | |
70 | int flags = 0) | |
71 | { | |
72 | } | |
73 | ||
60c474a0 MB |
74 | // draw a combobox dropdown button |
75 | // | |
76 | // flags may only use wxCONTROL_PRESSED | |
77 | virtual void DrawComboBoxDropButton(wxWindow *win, | |
78 | wxDC& dc, | |
79 | const wxRect& rect, | |
80 | int flags = 0) | |
81 | { | |
82 | } | |
83 | ||
d3c71b9e MW |
84 | // draw a dropdown arrow |
85 | // | |
86 | // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT | |
87 | virtual void DrawDropArrow(wxWindow *win, | |
88 | wxDC& dc, | |
89 | const wxRect& rect, | |
90 | int flags = 0) | |
91 | { | |
92 | } | |
93 | ||
c59e5089 VZ |
94 | // get the splitter parameters: the x field of the returned point is the |
95 | // sash width and the y field is the border width | |
96 | virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) | |
97 | { | |
98 | return wxSplitterRenderParams(0, 0, 0); | |
99 | } | |
100 | ||
04857cb7 VZ |
101 | virtual wxRendererVersion GetVersion() const |
102 | { | |
103 | return wxRendererVersion(wxRendererVersion::Current_Version, | |
104 | wxRendererVersion::Current_Age); | |
105 | } | |
106 | ||
c59e5089 VZ |
107 | #if 0 // just for debugging |
108 | MyDllRenderer() | |
109 | { | |
110 | wxMessageBox(_T("Creating MyDllRenderer"), _T("Renderer Sample")); | |
111 | } | |
112 | ||
113 | virtual ~MyDllRenderer() | |
114 | { | |
115 | wxMessageBox(_T("Deleting MyDllRenderer"), _T("Renderer Sample")); | |
116 | } | |
117 | #endif // 0 | |
118 | }; | |
119 | ||
120 | extern "C" | |
121 | WXEXPORT wxRendererNative *wxCreateRenderer() | |
122 | { | |
123 | return new MyDllRenderer; | |
124 | } |