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