1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface for wxRendererNative
7 // Created: 9-June-2005
9 // Copyright: (c) 2005 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
15 //---------------------------------------------------------------------------
19 #include "wx/renderer.h"
23 // control state flags used in wxRenderer and wxColourScheme
26 wxCONTROL_DISABLED = 0x00000001, // control is disabled
27 wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus
28 wxCONTROL_PRESSED = 0x00000004, // (button) is pressed
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
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
40 wxCONTROL_FLAGS_MASK = 0x000000ff,
42 // this is a pseudo flag not used directly by wxRenderer but rather by some
43 // controls internally
44 wxCONTROL_DIRTY = 0x80000000
49 DocStr(wxSplitterRenderParams,
50 "This is just a simple struct used as a return value of
51 `wx.RendererNative.GetSplitterParams` and contains some platform
52 specific metrics about splitters.
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.
61 struct wxSplitterRenderParams
63 wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_);
64 ~wxSplitterRenderParams();
66 // the width of the splitter sash
67 const wxCoord widthSash;
69 // the width of the border of the splitter window
72 // true if the splitter changes its appearance when the mouse is over it
73 const bool isHotSensitive;
78 DocStr(wxHeaderButtonParams,
79 "Extra (optional) parameters for `wx.RendererNative.DrawHeaderButton`", "");
81 struct wxHeaderButtonParams
83 wxHeaderButtonParams();
84 ~wxHeaderButtonParams();
86 // So wxColour_helper will be used when assigning to the colour items in the struct
87 %typemap(in) wxColour* (wxColour temp) {
89 if ( ! wxColour_helper($input, &$1)) SWIG_fail;
91 wxColour m_arrowColour;
92 wxColour m_selectionColour;
95 wxColour m_labelColour;
96 wxBitmap m_labelBitmap;
100 enum 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
107 DocStr(wxRendererVersion,
108 "This simple struct represents the `wx.RendererNative` interface
109 version and is only used as the return value of
110 `wx.RendererNative.GetVersion`.", "");
112 struct wxRendererVersion
114 wxRendererVersion(int version_, int age_);
115 ~wxRendererVersion();
124 // check if the given version is compatible with the current one
125 static bool IsCompatible(const wxRendererVersion& ver);
131 //---------------------------------------------------------------------------
134 DocStr(wxRendererNative,
135 "One of the design principles of wxWidgets is to use the native
136 widgets on every platform in order to be as close as possible to
137 the native look and feel on every platform. However there are
138 still cases when some generic widgets are needed for various
139 reasons, but it can sometimes take a lot of messy work to make
140 them conform to the native LnF.
142 The wx.RendererNative class is a collection of functions that have
143 platform-specific implementations for drawing certain parts of
144 genereic controls in ways that are as close to the native look as
147 Note that each drawing function restores the `wx.DC` attributes if it
148 changes them, so it is safe to assume that the same pen, brush and
149 colours that were active before the call to this function are still in
153 class wxRendererNative
159 virtual void , DrawHeaderButton(wxWindow *win,
163 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
164 wxHeaderButtonParams* params=NULL),
165 "Draw the header control button (such as what is used by `wx.ListCtrl`
166 in report mode.)", "");
170 virtual void , DrawHeaderButtonContents(wxWindow *win,
174 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
175 wxHeaderButtonParams* params=NULL),
176 "Draw the contents of a header control button, (label, sort
177 arrows, etc.) Normally this is only called by `DrawHeaderButton`.", "");
180 virtual int , GetHeaderButtonHeight(wxWindow *win),
181 "Returns the default height of a header button, either a fixed platform
182 height if available, or a generic height based on the window's font.", "");
186 virtual void , DrawTreeItemButton(wxWindow *win,
190 "Draw the expanded/collapsed icon for a tree control item.", "");
194 virtual void , DrawSplitterBorder(wxWindow *win,
198 "Draw the border for a sash window: this border must be such that the
199 sash drawn by `DrawSplitterSash` blends into it well.", "");
203 virtual void , DrawSplitterSash(wxWindow *win,
207 wxOrientation orient,
209 "Draw a sash. The orient parameter defines whether the sash should be
210 vertical or horizontal and how the position should be interpreted.", "");
214 virtual void , DrawComboBoxDropButton(wxWindow *win,
218 "Draw a button like the one used by `wx.ComboBox` to show a drop down
219 window. The usual appearance is a downwards pointing arrow.
221 The ``flags`` parameter may have the ``wx.CONTROL_PRESSED`` or
222 ``wx.CONTROL_CURRENT`` bits set.", "");
226 virtual void , DrawDropArrow(wxWindow *win,
230 "Draw a drop down arrow that is suitable for use outside a combo
231 box. Arrow will have a transparent background.
233 ``rect`` is not entirely filled by the arrow. Instead, you should use
234 bounding rectangle of a drop down button which arrow matches the size
235 you need. ``flags`` may have the ``wx.CONTROL_PRESSED`` or
236 ``wx.CONTROL_CURRENT`` bit set.", "");
240 virtual void , DrawCheckBox(wxWindow *win,
244 "Draw a check button. Flags may use wx.CONTROL_CHECKED,
245 wx.CONTROL_UNDETERMINED and wx.CONTROL_CURRENT.", "");
249 virtual void , DrawPushButton(wxWindow *win,
253 "Draw a blank button. Flags may be wx.CONTROL_PRESSED, wx.CONTROL_CURRENT and
254 wx.CONTROL_ISDEFAULT", "");
258 virtual void , DrawItemSelectionRect(wxWindow *win,
262 "Draw rectangle indicating that an item in e.g. a list control has been
265 The flags parameter may be:
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 ==================== ============================================
277 virtual wxSplitterRenderParams , GetSplitterParams(const wxWindow *win),
278 "Get the splitter parameters, see `wx.SplitterRenderParams`.", "");
284 static wxRendererNative& , Get(),
285 "Return the currently used renderer", "");
288 MustHaveApp(GetGeneric);
290 static wxRendererNative& , GetGeneric(),
291 "Return the generic implementation of the renderer. Under some
292 platforms, this is the default renderer implementation, others have
293 platform-specific default renderer which can be retrieved by calling
294 `wx.RendererNative.GetDefault`.", "");
297 MustHaveApp(GetDefault);
299 static wxRendererNative& , GetDefault(),
300 "Return the default (native) implementation for this platform -- this
301 is 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
303 may be different from the return value of `wx.RendererNative.Get`.", "");
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);
315 static wxRendererNative *, Set(wxRendererNative *renderer),
316 "Set the renderer to use, passing None reverts to using the default
317 renderer. Returns the previous renderer used with Set or None.", "");
322 virtual wxRendererVersion , GetVersion() const,
323 "Returns the version of the renderer. Will be used for ensuring
324 compatibility of dynamically loaded renderers.", "");
327 %property(SplitterParams, GetSplitterParams, doc="See `GetSplitterParams`");
328 %property(Version, GetVersion, doc="See `GetVersion`");
332 //---------------------------------------------------------------------------