misc fixes
[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@wxwindows.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 class MyDllRenderer : public wxRendererNative
21 {
22 public:
23 // draw the header control button (used by wxListCtrl)
24 virtual void DrawHeaderButton(wxWindow *win,
25 wxDC& dc,
26 const wxRect& rect,
27 int flags = 0)
28 {
29 dc.SetBrush(*wxCYAN_BRUSH);
30 dc.SetTextForeground(*wxRED);
31 dc.DrawRoundedRectangle(rect, 10);
32 dc.DrawLabel(_T("MyDllRenderer"), wxNullBitmap, rect, wxALIGN_CENTER);
33 }
34
35 // draw the expanded/collapsed icon for a tree control item
36 virtual void DrawTreeItemButton(wxWindow *win,
37 wxDC& dc,
38 const wxRect& rect,
39 int flags = 0)
40 {
41 }
42
43 // draw the border for sash window: this border must be such that the sash
44 // drawn by DrawSash() blends into it well
45 virtual void DrawSplitterBorder(wxWindow *win,
46 wxDC& dc,
47 const wxRect& rect,
48 int flags = 0)
49 {
50 }
51
52 // draw a (vertical) sash
53 virtual void DrawSplitterSash(wxWindow *win,
54 wxDC& dc,
55 const wxSize& size,
56 wxCoord position,
57 wxOrientation orient,
58 int flags = 0)
59 {
60 }
61
62 // get the splitter parameters: the x field of the returned point is the
63 // sash width and the y field is the border width
64 virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win)
65 {
66 return wxSplitterRenderParams(0, 0, 0);
67 }
68
69 #if 0 // just for debugging
70 MyDllRenderer()
71 {
72 wxMessageBox(_T("Creating MyDllRenderer"), _T("Renderer Sample"));
73 }
74
75 virtual ~MyDllRenderer()
76 {
77 wxMessageBox(_T("Deleting MyDllRenderer"), _T("Renderer Sample"));
78 }
79 #endif // 0
80 };
81
82 extern "C"
83 WXEXPORT wxRendererNative *wxCreateRenderer()
84 {
85 return new MyDllRenderer;
86 }
87