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