]> git.saurik.com Git - wxWidgets.git/blame - samples/render/renddll.cpp
Avoid CRT deprecation warnings for MSVC build using makefiles too.
[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)
8eceaeb6
VZ
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)
c59e5089
VZ
36 {
37 dc.SetBrush(*wxCYAN_BRUSH);
38 dc.SetTextForeground(*wxRED);
39 dc.DrawRoundedRectangle(rect, 10);
8eceaeb6
VZ
40 dc.DrawLabel("MyDllRenderer", wxNullBitmap, rect, wxALIGN_CENTER);
41
42 return dc.GetTextExtent("MyDllRenderer").x;
c59e5089
VZ
43 }
44
04857cb7
VZ
45 virtual wxRendererVersion GetVersion() const
46 {
47 return wxRendererVersion(wxRendererVersion::Current_Version,
48 wxRendererVersion::Current_Age);
49 }
50
c59e5089
VZ
51#if 0 // just for debugging
52 MyDllRenderer()
53 {
9a83f860 54 wxMessageBox(wxT("Creating MyDllRenderer"), wxT("Renderer Sample"));
c59e5089
VZ
55 }
56
57 virtual ~MyDllRenderer()
58 {
9a83f860 59 wxMessageBox(wxT("Deleting MyDllRenderer"), wxT("Renderer Sample"));
c59e5089
VZ
60 }
61#endif // 0
62};
63
64extern "C"
65WXEXPORT wxRendererNative *wxCreateRenderer()
66{
67 return new MyDllRenderer;
68}