]> git.saurik.com Git - wxWidgets.git/blob - samples/render/renddll.cpp
Fix recently broken generation of wxEVT_CHAR_HOOK events in wxMSW.
[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 int DrawHeaderButton(wxWindow * WXUNUSED(win),
31 wxDC& dc,
32 const wxRect& rect,
33 int WXUNUSED(flags) = 0,
34 wxHeaderSortIconType WXUNUSED(sortArrow) = wxHDR_SORT_ICON_NONE,
35 wxHeaderButtonParams* WXUNUSED(params) = NULL)
36 {
37 dc.SetBrush(*wxCYAN_BRUSH);
38 dc.SetTextForeground(*wxRED);
39 dc.DrawRoundedRectangle(rect, 10);
40 dc.DrawLabel("MyDllRenderer", wxNullBitmap, rect, wxALIGN_CENTER);
41
42 return dc.GetTextExtent("MyDllRenderer").x;
43 }
44
45 virtual wxRendererVersion GetVersion() const
46 {
47 return wxRendererVersion(wxRendererVersion::Current_Version,
48 wxRendererVersion::Current_Age);
49 }
50
51 #if 0 // just for debugging
52 MyDllRenderer()
53 {
54 wxMessageBox(wxT("Creating MyDllRenderer"), wxT("Renderer Sample"));
55 }
56
57 virtual ~MyDllRenderer()
58 {
59 wxMessageBox(wxT("Deleting MyDllRenderer"), wxT("Renderer Sample"));
60 }
61 #endif // 0
62 };
63
64 extern "C"
65 WXEXPORT wxRendererNative *wxCreateRenderer()
66 {
67 return new MyDllRenderer;
68 }