]> git.saurik.com Git - wxWidgets.git/blame - samples/render/renddll.cpp
updates from Adrián González Alba
[wxWidgets.git] / samples / render / renddll.cpp
CommitLineData
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
62068930
VZ
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
26class MyDllRenderer : public wxDelegateRendererNative
c59e5089
VZ
27{
28public:
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
04857cb7
VZ
41 virtual wxRendererVersion GetVersion() const
42 {
43 return wxRendererVersion(wxRendererVersion::Current_Version,
44 wxRendererVersion::Current_Age);
45 }
46
c59e5089
VZ
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
60extern "C"
61WXEXPORT wxRendererNative *wxCreateRenderer()
62{
63 return new MyDllRenderer;
64}