wx.DelegateRendererNative¶
wx.DelegateRendererNative allows reuse of renderers code by forwarding all the wx.RendererNative methods to the given object and thus allowing you to only modify some of its methods – without having to reimplement all of them.
Note that the “normal”, inheritance-based approach, doesn’t work with the renderers as it is impossible to derive from a class unknown at compile-time and the renderer is only chosen at run-time. So suppose that you want to only add something to the drawing of the tree control buttons but leave all the other methods unchanged – the only way to do it, considering that the renderer class which you want to customize might not even be written yet when you write your code (it could be written later and loaded from a DLL
during run-time), is by using this class.
Except for the constructor, it has exactly the same methods as wx.RendererNative and their implementation is trivial: they are simply forwarded to the real renderer. Note that the “real” renderer may, in turn, be a wx.DelegateRendererNative as well and that there may be arbitrarily many levels like this – but at the end of the chain there must be a real renderer which does the drawing.
See also
Class Hierarchy¶
Methods Summary¶
The default constructor does the same thing as the other one except that it uses the generic renderer instead of the user-specified rendererNative. |
|
Draw a check box. |
|
Draw a check mark. |
|
Draw a button like the one used by wx.ComboBox to show a drop down window. |
|
Draw a drop down arrow that is suitable for use outside a combo box. |
|
Draw a focus rectangle using the specified rectangle. |
|
Draw the header control button (used, for example, by wx.ListCtrl). |
|
Draw the contents of a header control button (label, sort arrows, etc.). |
|
Draw a selection rectangle underneath the text as used e.g. |
|
Draw a blank push button that looks very similar to wx.Button. |
|
Draw the border for sash window: this border must be such that the sash drawn by |
|
Draw a sash. |
|
Draw a title bar button in the given state. |
|
Draw the expanded/collapsed icon for a tree control item. |
|
Returns the size of a check box. |
|
Returns the size of a check mark. |
|
Returns the size of the expander used in tree-like controls. |
|
Returns the height of a header button, either a fixed platform height if available, or a generic height based on the win window’s font. |
|
Returns the horizontal margin on the left and right sides of header button’s label. |
|
Get the splitter parameters, see wx.SplitterRenderParams. |
|
This function is used for version checking: |
Properties Summary¶
See |
Class API¶
- class wx.DelegateRendererNative(RendererNative)¶
Possible constructors:
DelegateRendererNative() -> None DelegateRendererNative(rendererNative) -> None
DelegateRendererNative allows reuse of renderers code by forwarding all the RendererNative methods to the given object and thus allowing you to only modify some of its methods without having to reimplement all of them.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self)
The default constructor does the same thing as the other one except that it uses the generic renderer instead of the user-specified rendererNative.
In any case, this sets up the delegate renderer object to follow all calls to the specified real renderer.
- Return type:
None
__init__ (self, rendererNative)
This constructor uses the user-specified rendererNative to set up the delegate renderer object to follow all calls to the specified real renderer.
- Parameters:
rendererNative (wx.RendererNative)
- Return type:
None
Note
This object does not take ownership of (i.e. won’t delete) rendererNative.
- DrawCheckBox(self, win, dc, rect, flags=0)¶
Draw a check box.
flags may have the
CONTROL_CHECKED
,CONTROL_CURRENT
orCONTROL_UNDETERMINED
bit set, seeCONTROL_FLAGS
.
- DrawCheckMark(self, win, dc, rect, flags=0)¶
Draw a check mark.
flags may have the
CONTROL_DISABLED
bit set, seeCONTROL_FLAGS
.Added in version 4.1/wxWidgets-3.1.3.
- DrawComboBoxDropButton(self, win, dc, rect, flags=0)¶
Draw a button like the one used by wx.ComboBox to show a drop down window.
The usual appearance is a downwards pointing arrow.
flags may have the
CONTROL_PRESSED
orCONTROL_CURRENT
bit set, seeCONTROL_FLAGS
.
- DrawDropArrow(self, win, dc, rect, flags=0)¶
Draw a drop down arrow that is suitable for use outside a combo box.
Arrow will have transparent background.
rect is not entirely filled by the arrow. Instead, you should use bounding rectangle of a drop down button which arrow matches the size you need.
flags may have the
CONTROL_PRESSED
orCONTROL_CURRENT
bit set, seeCONTROL_FLAGS
.
- DrawFocusRect(self, win, dc, rect, flags=0)¶
Draw a focus rectangle using the specified rectangle.
The only supported flags is
CONTROL_SELECTED
for items which are selected. seeCONTROL_FLAGS
.
- DrawHeaderButton(self, win, dc, rect, flags=0, sortArrow=HDR_SORT_ICON_NONE, params=None)¶
Draw the header control button (used, for example, by wx.ListCtrl).
Depending on platforms the flags parameter may support the
CONTROL_SELECTED
CONTROL_DISABLED
andCONTROL_CURRENT
bits, seeCONTROL_FLAGS
.- Parameters:
win (wx.Window)
dc (wx.DC)
rect (wx.Rect)
flags (int)
sortArrow (HeaderSortIconType)
params (wx.HeaderButtonParams)
- Return type:
int
- Returns:
The optimal width to contain the unabbreviated label text or bitmap, the sort arrow if present, and internal margins.
- DrawHeaderButtonContents(self, win, dc, rect, flags=0, sortArrow=HDR_SORT_ICON_NONE, params=None)¶
Draw the contents of a header control button (label, sort arrows, etc.).
This function is normally only called by
DrawHeaderButton
.Depending on platforms the flags parameter may support the
CONTROL_SELECTED
CONTROL_DISABLED
andCONTROL_CURRENT
bits, seeCONTROL_FLAGS
.- Parameters:
win (wx.Window)
dc (wx.DC)
rect (wx.Rect)
flags (int)
sortArrow (HeaderSortIconType)
params (wx.HeaderButtonParams)
- Return type:
int
- Returns:
The optimal width to contain the unabbreviated label text or bitmap, the sort arrow if present, and internal margins.
- DrawItemSelectionRect(self, win, dc, rect, flags=0)¶
Draw a selection rectangle underneath the text as used e.g.
in a wx.ListCtrl.
The supported flags are
CONTROL_SELECTED
for items which are selected (e.g. often a blue rectangle) andCONTROL_CURRENT
for the item that has the focus (often a dotted line around the item’s text).CONTROL_FOCUSED
may be used to indicate if the control has the focus (otherwise the selection rectangle is e.g. often grey and not blue). This may be ignored by the renderer or deduced by the code directly from the win. AdditionallyCONTROL_CELL
may be used to draw a cell inside a bigger selection area.See also
- DrawPushButton(self, win, dc, rect, flags=0)¶
Draw a blank push button that looks very similar to wx.Button.
flags may have the
CONTROL_PRESSED
,CONTROL_CURRENT
orCONTROL_ISDEFAULT
bit set, seeCONTROL_FLAGS
.
- DrawSplitterBorder(self, win, dc, rect, flags=0)¶
Draw the border for sash window: this border must be such that the sash drawn by
DrawSplitterSash
blends into it well.
- DrawSplitterSash(self, win, dc, size, position, orient, flags=0)¶
Draw a sash.
The orient parameter defines whether the sash should be vertical or horizontal and how the position should be interpreted.
- Parameters:
win (wx.Window)
dc (wx.DC)
size (wx.Size)
position (int)
orient (Orientation)
flags (int)
- Return type:
None
- DrawTitleBarBitmap(self, win, dc, rect, button, flags=0)¶
Draw a title bar button in the given state.
- Return type:
None
- DrawTreeItemButton(self, win, dc, rect, flags=0)¶
Draw the expanded/collapsed icon for a tree control item.
To draw an expanded button the flags parameter must contain
CONTROL_EXPANDED
bit, seeCONTROL_FLAGS
.
- GetCheckBoxSize(self, win, flags=0)¶
Returns the size of a check box.
- Parameters:
win (wx.Window) – A valid, i.e. non-null, window pointer which is used to get the theme defining the checkbox size under some platforms.
flags (int) – The only acceptable flag is
CONTROL_CELL
which means that just the size of the checkbox itself is returned, without any margins that are included by default. This parameter is only available in wxWidgets 3.1.4 or later.
- Return type:
- GetCheckMarkSize(self, win)¶
Returns the size of a check mark.
- Parameters:
win (wx.Window) – A valid, i.e. non-null, window pointer which is used to get the theme defining the checkmark size under some platforms.
- Return type:
Added in version 4.1/wxWidgets-3.1.3.
- GetExpanderSize(self, win)¶
Returns the size of the expander used in tree-like controls.
- Parameters:
win (wx.Window) – A valid, i.e. non-null, window pointer which is used to get the theme defining the expander size under some platforms.
- Return type:
Added in version 4.1/wxWidgets-3.1.3.
- GetHeaderButtonHeight(self, win)¶
Returns the height of a header button, either a fixed platform height if available, or a generic height based on the win window’s font.
- Parameters:
win (wx.Window)
- Return type:
int
- GetHeaderButtonMargin(self, win)¶
Returns the horizontal margin on the left and right sides of header button’s label.
- Parameters:
win (wx.Window)
- Return type:
int
Added in version 2.9.2.
- GetSplitterParams(self, win)¶
Get the splitter parameters, see wx.SplitterRenderParams.
The win parameter should be a wx.SplitterWindow.
- Parameters:
win (wx.Window)
- Return type:
- GetVersion(self)¶
This function is used for version checking:
Load
refuses to load any shared libraries implementing an older or incompatible version.- Return type:
Note
The implementation of this method is always the same in all renderers (simply construct wx.RendererVersion using the
RendererVersion::Current_XXX
values), but it has to be in the derived, not base, class, to detect mismatches between the renderers versions and so you have to implement it anew in all renderers.
Properties¶
- Version¶
See
GetVersion