]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_renderer.i
Buffered DCs now take non-const bitmaps
[wxWidgets.git] / wxPython / src / _renderer.i
CommitLineData
c95499b9
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _renderer.i
3// Purpose: SWIG interface for wxRendererNative
4//
5// Author: Robin Dunn
6//
7// Created: 9-June-2005
8// RCS-ID: $Id$
9// Copyright: (c) 2005 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15//---------------------------------------------------------------------------
16%newgroup
17
18%{
19#include "wx/renderer.h"
20%}
21
22
23// control state flags used in wxRenderer and wxColourScheme
24enum
25{
26 wxCONTROL_DISABLED = 0x00000001, // control is disabled
27 wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus
28 wxCONTROL_PRESSED = 0x00000004, // (button) is pressed
6ecc8943
RD
29 wxCONTROL_SPECIAL = 0x00000008, // control-specific bit:
30 wxCONTROL_ISDEFAULT = wxCONTROL_SPECIAL, // only for the buttons
31 wxCONTROL_ISSUBMENU = wxCONTROL_SPECIAL, // only for the menu items
32 wxCONTROL_EXPANDED = wxCONTROL_SPECIAL, // only for the tree items
33 wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL, // only for the status bar panes
c95499b9
RD
34 wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control
35 wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox
36 wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
37 wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
38 wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE, // (check) undetermined state
39
80752b57 40 wxCONTROL_FLAGS_MASK = 0x000000ff,
c95499b9
RD
41
42 // this is a pseudo flag not used directly by wxRenderer but rather by some
43 // controls internally
44 wxCONTROL_DIRTY = 0x80000000
45};
46
47
48
49DocStr(wxSplitterRenderParams,
50"This is just a simple struct used as a return value of
51`wx.RendererNative.GetSplitterParams` and contains some platform
52specific metrics about splitters.
53
54 * widthSash: the width of the splitter sash.
55 * border: the width of the border of the splitter window.
56 * isHotSensitive: ``True`` if the splitter changes its
57 appearance when the mouse is over it.
58
59", "");
60
61struct wxSplitterRenderParams
62{
63 wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_);
64 ~wxSplitterRenderParams();
65
66 // the width of the splitter sash
67 const wxCoord widthSash;
68
69 // the width of the border of the splitter window
70 const wxCoord border;
71
72 // true if the splitter changes its appearance when the mouse is over it
73 const bool isHotSensitive;
74};
75
76
77
4b94ddc4
RD
78DocStr(wxHeaderButtonParams,
79"Extra (optional) parameters for `wx.RendererNative.DrawHeaderButton`", "");
80
81struct wxHeaderButtonParams
82{
83 wxHeaderButtonParams();
84 ~wxHeaderButtonParams();
85
86 // So wxColour_helper will be used when assigning to the colour items in the struct
87 %typemap(in) wxColour* (wxColour temp) {
88 $1 = &temp;
89 if ( ! wxColour_helper($input, &$1)) SWIG_fail;
90 }
91 wxColour m_arrowColour;
92 wxColour m_selectionColour;
93 wxString m_labelText;
94 wxFont m_labelFont;
95 wxColour m_labelColour;
96 wxBitmap m_labelBitmap;
97 int m_labelAlignment;
98};
99
80752b57
RD
100enum wxHeaderSortIconType {
101 wxHDR_SORT_ICON_NONE, // Header button has no sort arrow
102 wxHDR_SORT_ICON_UP, // Header button an an up sort arrow icon
103 wxHDR_SORT_ICON_DOWN // Header button an a down sort arrow icon
104};
4b94ddc4 105
c95499b9
RD
106
107DocStr(wxRendererVersion,
108"This simple struct represents the `wx.RendererNative` interface
109version and is only used as the return value of
110`wx.RendererNative.GetVersion`.", "");
111
112struct wxRendererVersion
113{
114 wxRendererVersion(int version_, int age_);
115 ~wxRendererVersion();
116
117 enum
118 {
119 Current_Version,
120 Current_Age
121 };
122
123
124 // check if the given version is compatible with the current one
125 static bool IsCompatible(const wxRendererVersion& ver);
126
127 const int version;
128 const int age;
129};
130
131//---------------------------------------------------------------------------
132
133
134DocStr(wxRendererNative,
4b94ddc4
RD
135"One of the design principles of wxWidgets is to use the native
136widgets on every platform in order to be as close as possible to
137the native look and feel on every platform. However there are
138still cases when some generic widgets are needed for various
139reasons, but it can sometimes take a lot of messy work to make
140them conform to the native LnF.
c95499b9
RD
141
142The wx.RendererNative class is a collection of functions that have
143platform-specific implementations for drawing certain parts of
144genereic controls in ways that are as close to the native look as
145possible.
293524e1
RD
146
147Note that each drawing function restores the `wx.DC` attributes if it
148changes them, so it is safe to assume that the same pen, brush and
149colours that were active before the call to this function are still in
150effect after it.
c95499b9
RD
151", "");
152
153class wxRendererNative
154{
155public:
156
157
158 DocDeclStr(
159 virtual void , DrawHeaderButton(wxWindow *win,
160 wxDC& dc,
161 const wxRect& rect,
4b94ddc4 162 int flags = 0,
80752b57 163 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
4b94ddc4 164 wxHeaderButtonParams* params=NULL),
3c31306c 165 "Draw the header control button (such as what is used by `wx.ListCtrl`
c95499b9
RD
166in report mode.)", "");
167
168
4b94ddc4
RD
169 DocDeclStr(
170 virtual void , DrawHeaderButtonContents(wxWindow *win,
171 wxDC& dc,
172 const wxRect& rect,
173 int flags = 0,
80752b57 174 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
4b94ddc4
RD
175 wxHeaderButtonParams* params=NULL),
176 "Draw the contents of a header control button, (label, sort
177arrows, etc.) Normally this is only called by `DrawHeaderButton`.", "");
178
179 DocDeclStr(
180 virtual int , GetHeaderButtonHeight(wxWindow *win),
181 "Returns the default height of a header button, either a fixed platform
182height if available, or a generic height based on the window's font.", "");
183
184
c95499b9
RD
185 DocDeclStr(
186 virtual void , DrawTreeItemButton(wxWindow *win,
187 wxDC& dc,
188 const wxRect& rect,
189 int flags = 0),
190 "Draw the expanded/collapsed icon for a tree control item.", "");
191
192
193 DocDeclStr(
194 virtual void , DrawSplitterBorder(wxWindow *win,
195 wxDC& dc,
196 const wxRect& rect,
197 int flags = 0),
198 "Draw the border for a sash window: this border must be such that the
199sash drawn by `DrawSplitterSash` blends into it well.", "");
200
201
202 DocDeclStr(
203 virtual void , DrawSplitterSash(wxWindow *win,
204 wxDC& dc,
205 const wxSize& size,
206 wxCoord position,
207 wxOrientation orient,
208 int flags = 0),
209 "Draw a sash. The orient parameter defines whether the sash should be
210vertical or horizontal and how the position should be interpreted.", "");
211
212
213 DocDeclStr(
214 virtual void , DrawComboBoxDropButton(wxWindow *win,
215 wxDC& dc,
216 const wxRect& rect,
217 int flags = 0),
218 "Draw a button like the one used by `wx.ComboBox` to show a drop down
219window. The usual appearance is a downwards pointing arrow.
220
221The ``flags`` parameter may have the ``wx.CONTROL_PRESSED`` or
222``wx.CONTROL_CURRENT`` bits set.", "");
223
224
225 DocDeclStr(
226 virtual void , DrawDropArrow(wxWindow *win,
227 wxDC& dc,
228 const wxRect& rect,
229 int flags = 0),
230 "Draw a drop down arrow that is suitable for use outside a combo
231box. Arrow will have a transparent background.
232
233``rect`` is not entirely filled by the arrow. Instead, you should use
234bounding rectangle of a drop down button which arrow matches the size
235you need. ``flags`` may have the ``wx.CONTROL_PRESSED`` or
236``wx.CONTROL_CURRENT`` bit set.", "");
237
238
e0de65e8 239 DocDeclStr(
07e3a44f
RD
240 virtual void , DrawCheckBox(wxWindow *win,
241 wxDC& dc,
242 const wxRect& rect,
243 int flags = 0),
e0de65e8
RD
244 "Draw a check button. Flags may use wx.CONTROL_CHECKED,
245wx.CONTROL_UNDETERMINED and wx.CONTROL_CURRENT.", "");
246
c95499b9 247
07e3a44f
RD
248 DocDeclStr(
249 virtual void , DrawPushButton(wxWindow *win,
250 wxDC& dc,
251 const wxRect& rect,
252 int flags = 0),
253 "Draw a blank button. Flags may be wx.CONTROL_PRESSED, wx.CONTROL_CURRENT and
254wx.CONTROL_ISDEFAULT", "");
255
256
257 DocDeclStr(
258 virtual void , DrawItemSelectionRect(wxWindow *win,
259 wxDC& dc,
260 const wxRect& rect,
261 int flags = 0),
262 "Draw rectangle indicating that an item in e.g. a list control has been
263selected or focused
264
265The flags parameter may be:
266
267 ==================== ============================================
268 wx.CONTROL_SELECTED item is selected, e.g. draw background
269 wx.CONTROL_CURRENT item is the current item, e.g. dotted border
270 wx.CONTROL_FOCUSED the whole control has focus, e.g. blue
271 background vs. grey otherwise
272 ==================== ============================================
273", "");
274
e0de65e8 275
c95499b9
RD
276 DocDeclStr(
277 virtual wxSplitterRenderParams , GetSplitterParams(const wxWindow *win),
278 "Get the splitter parameters, see `wx.SplitterRenderParams`.", "");
279
280
281
293524e1 282 MustHaveApp(Get);
c95499b9
RD
283 DocDeclStr(
284 static wxRendererNative& , Get(),
285 "Return the currently used renderer", "");
286
287
293524e1 288 MustHaveApp(GetGeneric);
c95499b9
RD
289 DocDeclStr(
290 static wxRendererNative& , GetGeneric(),
291 "Return the generic implementation of the renderer. Under some
292platforms, this is the default renderer implementation, others have
293platform-specific default renderer which can be retrieved by calling
a2cccbc3 294`wx.RendererNative.GetDefault`.", "");
c95499b9
RD
295
296
293524e1 297 MustHaveApp(GetDefault);
c95499b9
RD
298 DocDeclStr(
299 static wxRendererNative& , GetDefault(),
300 "Return the default (native) implementation for this platform -- this
a2cccbc3
RD
301is also the one used by default but this may be changed by calling
302`wx.RendererNative.Set` in which case the return value of this method
303may be different from the return value of `wx.RendererNative.Get`.", "");
c95499b9
RD
304
305
306
307
308// // load the renderer from the specified DLL, the returned pointer must be
309// // deleted by caller if not NULL when it is not used any more
310// static wxRendererNative *Load(const wxString& name);
311
312
293524e1 313 MustHaveApp(Set);
c95499b9
RD
314 DocDeclStr(
315 static wxRendererNative *, Set(wxRendererNative *renderer),
316 "Set the renderer to use, passing None reverts to using the default
317renderer. Returns the previous renderer used with Set or None.", "");
318
319
320
321 DocDeclStr(
322 virtual wxRendererVersion , GetVersion() const,
323 "Returns the version of the renderer. Will be used for ensuring
324compatibility of dynamically loaded renderers.", "");
7012bb9f 325
c95499b9 326
7012bb9f
RD
327 %property(SplitterParams, GetSplitterParams, doc="See `GetSplitterParams`");
328 %property(Version, GetVersion, doc="See `GetVersion`");
c95499b9
RD
329};
330
331
332//---------------------------------------------------------------------------