Phoenix Logo

phoenix_title 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

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

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


class_hierarchy Class Hierarchy

Inheritance diagram for class DelegateRendererNative:


method_summary Methods Summary

__init__ The default constructor does the same thing as the other one except that it uses the generic renderer instead of the user-specified rendererNative.
DrawCheckBox Draw a check box.
DrawComboBoxDropButton Draw a button like the one used by wx.ComboBox to show a drop down window.
DrawDropArrow Draw a drop down arrow that is suitable for use outside a combo box.
DrawFocusRect Draw a focus rectangle using the specified rectangle.
DrawHeaderButton Draw the header control button (used, for example, by wx.ListCtrl).
DrawHeaderButtonContents Draw the contents of a header control button (label, sort arrows, etc.).
DrawItemSelectionRect Draw a selection rectangle underneath the text as used e.g.
DrawPushButton Draw a blank push button that looks very similar to wx.Button.
DrawSplitterBorder Draw the border for sash window: this border must be such that the sash drawn by DrawSplitterSash blends into it well.
DrawSplitterSash Draw a sash.
DrawTreeItemButton Draw the expanded/collapsed icon for a tree control item.
GetCheckBoxSize Returns the size of a check box.
GetHeaderButtonHeight 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.
GetHeaderButtonMargin Returns the horizontal margin on the left and right sides of header button’s label.
GetSplitterParams Get the splitter parameters, see wx.SplitterRenderParams.
GetVersion This function is used for version checking: Load refuses to load any shared libraries implementing an older or incompatible version.

property_summary Properties Summary

Version See GetVersion

api Class API



class wx.DelegateRendererNative(RendererNative)

Possible constructors:

DelegateRendererNative()

DelegateRendererNative(rendererNative)

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)

overload Overloaded Implementations:



__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.



__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) –

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 or CONTROL_UNDETERMINED bit set, see CONTROL_FLAGS.

Parameters:


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 or CONTROL_CURRENT bit set, see CONTROL_FLAGS.

Parameters:


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 or CONTROL_CURRENT bit set, see CONTROL_FLAGS.

Parameters:


DrawFocusRect(self, win, dc, rect, flags=0)

Draw a focus rectangle using the specified rectangle.

wx.ListCtrl.

The only supported flags is CONTROL_SELECTED for items which are selected. see CONTROL_FLAGS.

Parameters:


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 and CONTROL_CURRENT bits, see CONTROL_FLAGS.

Parameters:
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 and CONTROL_CURRENT bits, see CONTROL_FLAGS.

Parameters:
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) and CONTROL_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.

Parameters:


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 or CONTROL_ISDEFAULT bit set, see CONTROL_FLAGS.

Parameters:


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.

Parameters:


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:


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, see CONTROL_FLAGS.

Parameters:


GetCheckBoxSize(self, win)

Returns the size of a check box.

The win parameter is not used currently and can be None.

Parameters:win (wx.Window) –
Return type: wx.Size


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

New 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: wx.SplitterRenderParams


GetVersion(self)

This function is used for version checking: Load refuses to load any shared libraries implementing an older or incompatible version.

Return type: wx.RendererVersion

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