]>
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 | ||
47 | // draw the border for sash window: this border must be such that the sash | |
48 | // drawn by DrawSash() blends into it well | |
49 | virtual void DrawSplitterBorder(wxWindow *win, | |
50 | wxDC& dc, | |
51 | const wxRect& rect, | |
52 | int flags = 0) | |
53 | { | |
54 | } | |
55 | ||
56 | // draw a (vertical) sash | |
57 | virtual void DrawSplitterSash(wxWindow *win, | |
58 | wxDC& dc, | |
59 | const wxSize& size, | |
60 | wxCoord position, | |
61 | wxOrientation orient, | |
62 | int flags = 0) | |
63 | { | |
64 | } | |
65 | ||
60c474a0 MB |
66 | // draw a combobox dropdown button |
67 | // | |
68 | // flags may only use wxCONTROL_PRESSED | |
69 | virtual void DrawComboBoxDropButton(wxWindow *win, | |
70 | wxDC& dc, | |
71 | const wxRect& rect, | |
72 | int flags = 0) | |
73 | { | |
74 | } | |
75 | ||
d3c71b9e MW |
76 | // draw a dropdown arrow |
77 | // | |
78 | // flags may use wxCONTROL_PRESSED and wxCONTROL_CURRENT | |
79 | virtual void DrawDropArrow(wxWindow *win, | |
80 | wxDC& dc, | |
81 | const wxRect& rect, | |
82 | int flags = 0) | |
83 | { | |
84 | } | |
85 | ||
c59e5089 VZ |
86 | // get the splitter parameters: the x field of the returned point is the |
87 | // sash width and the y field is the border width | |
88 | virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) | |
89 | { | |
90 | return wxSplitterRenderParams(0, 0, 0); | |
91 | } | |
92 | ||
04857cb7 VZ |
93 | virtual wxRendererVersion GetVersion() const |
94 | { | |
95 | return wxRendererVersion(wxRendererVersion::Current_Version, | |
96 | wxRendererVersion::Current_Age); | |
97 | } | |
98 | ||
c59e5089 VZ |
99 | #if 0 // just for debugging |
100 | MyDllRenderer() | |
101 | { | |
102 | wxMessageBox(_T("Creating MyDllRenderer"), _T("Renderer Sample")); | |
103 | } | |
104 | ||
105 | virtual ~MyDllRenderer() | |
106 | { | |
107 | wxMessageBox(_T("Deleting MyDllRenderer"), _T("Renderer Sample")); | |
108 | } | |
109 | #endif // 0 | |
110 | }; | |
111 | ||
112 | extern "C" | |
113 | WXEXPORT wxRendererNative *wxCreateRenderer() | |
114 | { | |
115 | return new MyDllRenderer; | |
116 | } | |
117 |