]>
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 | |
be5a51fb | 7 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> |
c59e5089 VZ |
8 | // Licence: wxWindows licence |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #include "wx/wxprec.h" | |
12 | ||
9c743a7c VS |
13 | #ifdef __BORLANDC__ |
14 | #pragma hdrstop | |
15 | #endif | |
16 | ||
c59e5089 VZ |
17 | #include "wx/renderer.h" |
18 | ||
174f7a2e VS |
19 | #ifndef WX_PRECOMP |
20 | #include "wx/dc.h" | |
21 | #endif | |
22 | ||
62068930 VZ |
23 | // derive from wxDelegateRendererNative and not wxRendererNative itself to be |
24 | // able to only reimplement the methods we want to show and not all of them | |
25 | class MyDllRenderer : public wxDelegateRendererNative | |
c59e5089 VZ |
26 | { |
27 | public: | |
28 | // draw the header control button (used by wxListCtrl) | |
8eceaeb6 VZ |
29 | virtual int DrawHeaderButton(wxWindow * WXUNUSED(win), |
30 | wxDC& dc, | |
31 | const wxRect& rect, | |
32 | int WXUNUSED(flags) = 0, | |
33 | wxHeaderSortIconType WXUNUSED(sortArrow) = wxHDR_SORT_ICON_NONE, | |
34 | wxHeaderButtonParams* WXUNUSED(params) = NULL) | |
c59e5089 VZ |
35 | { |
36 | dc.SetBrush(*wxCYAN_BRUSH); | |
37 | dc.SetTextForeground(*wxRED); | |
38 | dc.DrawRoundedRectangle(rect, 10); | |
8eceaeb6 VZ |
39 | dc.DrawLabel("MyDllRenderer", wxNullBitmap, rect, wxALIGN_CENTER); |
40 | ||
41 | return dc.GetTextExtent("MyDllRenderer").x; | |
c59e5089 VZ |
42 | } |
43 | ||
04857cb7 VZ |
44 | virtual wxRendererVersion GetVersion() const |
45 | { | |
46 | return wxRendererVersion(wxRendererVersion::Current_Version, | |
47 | wxRendererVersion::Current_Age); | |
48 | } | |
49 | ||
c59e5089 VZ |
50 | #if 0 // just for debugging |
51 | MyDllRenderer() | |
52 | { | |
9a83f860 | 53 | wxMessageBox(wxT("Creating MyDllRenderer"), wxT("Renderer Sample")); |
c59e5089 VZ |
54 | } |
55 | ||
56 | virtual ~MyDllRenderer() | |
57 | { | |
9a83f860 | 58 | wxMessageBox(wxT("Deleting MyDllRenderer"), wxT("Renderer Sample")); |
c59e5089 VZ |
59 | } |
60 | #endif // 0 | |
61 | }; | |
62 | ||
63 | extern "C" | |
64 | WXEXPORT wxRendererNative *wxCreateRenderer() | |
65 | { | |
66 | return new MyDllRenderer; | |
67 | } |