.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.DelegateRendererNative: ========================================================================================================================================== |phoenix_title| **wx.DelegateRendererNative** ========================================================================================================================================== :ref:`wx.DelegateRendererNative` allows reuse of renderers code by forwarding all the :ref:`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 :ref:`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 :ref:`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. .. seealso:: :ref:`wx.RendererNative` | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class DelegateRendererNative:
| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.DelegateRendererNative.__init__` The default constructor does the same thing as the other one except that it uses the :ref:`generic renderer ` instead of the user-specified `rendererNative`. :meth:`~wx.DelegateRendererNative.DrawCheckBox` Draw a check box. :meth:`~wx.DelegateRendererNative.DrawCheckMark` Draw a check mark. :meth:`~wx.DelegateRendererNative.DrawComboBoxDropButton` Draw a button like the one used by :ref:`wx.ComboBox` to show a drop down window. :meth:`~wx.DelegateRendererNative.DrawDropArrow` Draw a drop down arrow that is suitable for use outside a combo box. :meth:`~wx.DelegateRendererNative.DrawFocusRect` Draw a focus rectangle using the specified rectangle. :meth:`~wx.DelegateRendererNative.DrawHeaderButton` Draw the header control button (used, for example, by :ref:`wx.ListCtrl`). :meth:`~wx.DelegateRendererNative.DrawHeaderButtonContents` Draw the contents of a header control button (label, sort arrows, etc.). :meth:`~wx.DelegateRendererNative.DrawItemSelectionRect` Draw a selection rectangle underneath the text as used e.g. :meth:`~wx.DelegateRendererNative.DrawPushButton` Draw a blank push button that looks very similar to :ref:`wx.Button`. :meth:`~wx.DelegateRendererNative.DrawSplitterBorder` Draw the border for sash window: this border must be such that the sash drawn by :meth:`~DelegateRendererNative.DrawSplitterSash` blends into it well. :meth:`~wx.DelegateRendererNative.DrawSplitterSash` Draw a sash. :meth:`~wx.DelegateRendererNative.DrawTitleBarBitmap` Draw a title bar button in the given state. :meth:`~wx.DelegateRendererNative.DrawTreeItemButton` Draw the expanded/collapsed icon for a tree control item. :meth:`~wx.DelegateRendererNative.GetCheckBoxSize` Returns the size of a check box. :meth:`~wx.DelegateRendererNative.GetCheckMarkSize` Returns the size of a check mark. :meth:`~wx.DelegateRendererNative.GetExpanderSize` Returns the size of the expander used in tree-like controls. :meth:`~wx.DelegateRendererNative.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. :meth:`~wx.DelegateRendererNative.GetHeaderButtonMargin` Returns the horizontal margin on the left and right sides of header button's label. :meth:`~wx.DelegateRendererNative.GetSplitterParams` Get the splitter parameters, see :ref:`wx.SplitterRenderParams`. :meth:`~wx.DelegateRendererNative.GetVersion` This function is used for version checking: :meth:`~DelegateRendererNative.Load` refuses to load any shared libraries implementing an older or incompatible version. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.DelegateRendererNative.Version` See :meth:`~wx.DelegateRendererNative.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. .. method:: __init__(self, *args, **kw) |overload| Overloaded Implementations: :html:`

` **__init__** `(self)` The default constructor does the same thing as the other one except that it uses the :ref:`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. :html:`

` **__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. :param `rendererNative`: :type `rendererNative`: wx.RendererNative .. note:: This object does not take ownership of (i.e. won't delete) `rendererNative`. :html:`

` .. method:: 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``. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int .. method:: DrawCheckMark(self, win, dc, rect, flags=0) Draw a check mark. `flags` may have the ``CONTROL_DISABLED`` bit set, see ``CONTROL_FLAGS``. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int .. versionadded:: 4.1/wxWidgets-3.1.3 .. method:: DrawComboBoxDropButton(self, win, dc, rect, flags=0) Draw a button like the one used by :ref:`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``. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int .. method:: 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``. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int .. method:: DrawFocusRect(self, win, dc, rect, flags=0) Draw a focus rectangle using the specified rectangle. :ref:`wx.ListCtrl`. The only supported flags is ``CONTROL_SELECTED`` for items which are selected. see ``CONTROL_FLAGS``. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int .. method:: DrawHeaderButton(self, win, dc, rect, flags=0, sortArrow=HDR_SORT_ICON_NONE, params=None) Draw the header control button (used, for example, by :ref:`wx.ListCtrl`). Depending on platforms the `flags` parameter may support the ``CONTROL_SELECTED`` ``CONTROL_DISABLED`` and ``CONTROL_CURRENT`` bits, see ``CONTROL_FLAGS``. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int :param `sortArrow`: :type `sortArrow`: wx.HeaderSortIconType :param `params`: :type `params`: wx.HeaderButtonParams :rtype: `int` :returns: The optimal width to contain the unabbreviated label text or bitmap, the sort arrow if present, and internal margins. .. method:: 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 :meth:`DrawHeaderButton` . Depending on platforms the `flags` parameter may support the ``CONTROL_SELECTED`` ``CONTROL_DISABLED`` and ``CONTROL_CURRENT`` bits, see ``CONTROL_FLAGS``. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int :param `sortArrow`: :type `sortArrow`: wx.HeaderSortIconType :param `params`: :type `params`: wx.HeaderButtonParams :rtype: `int` :returns: The optimal width to contain the unabbreviated label text or bitmap, the sort arrow if present, and internal margins. .. method:: DrawItemSelectionRect(self, win, dc, rect, flags=0) Draw a selection rectangle underneath the text as used e.g. in a :ref:`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`. Additionally ``CONTROL_CELL`` may be used to draw a cell inside a bigger selection area. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int .. seealso:: :meth:`~wx.RendererNative.DrawItemText` .. method:: DrawPushButton(self, win, dc, rect, flags=0) Draw a blank push button that looks very similar to :ref:`wx.Button`. `flags` may have the ``CONTROL_PRESSED`` , ``CONTROL_CURRENT`` or ``CONTROL_ISDEFAULT`` bit set, see ``CONTROL_FLAGS``. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int .. method:: DrawSplitterBorder(self, win, dc, rect, flags=0) Draw the border for sash window: this border must be such that the sash drawn by :meth:`DrawSplitterSash` blends into it well. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int .. method:: 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. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `size`: :type `size`: wx.Size :param `position`: :type `position`: int :param `orient`: :type `orient`: wx.Orientation :param `flags`: :type `flags`: int .. method:: DrawTitleBarBitmap(self, win, dc, rect, button, flags=0) Draw a title bar button in the given state. .. method:: 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``. :param `win`: :type `win`: wx.Window :param `dc`: :type `dc`: wx.DC :param `rect`: :type `rect`: wx.Rect :param `flags`: :type `flags`: int .. method:: GetCheckBoxSize(self, win, flags=0) Returns the size of a check box. :param `win`: A valid, i.e. non-null, window pointer which is used to get the theme defining the checkbox size under some platforms. :type `win`: wx.Window :param `flags`: 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. :type `flags`: int :rtype: :ref:`wx.Size` .. method:: GetCheckMarkSize(self, win) Returns the size of a check mark. :param `win`: A valid, i.e. non-null, window pointer which is used to get the theme defining the checkmark size under some platforms. :type `win`: wx.Window :rtype: :ref:`wx.Size` .. versionadded:: 4.1/wxWidgets-3.1.3 .. method:: GetExpanderSize(self, win) Returns the size of the expander used in tree-like controls. :param `win`: A valid, i.e. non-null, window pointer which is used to get the theme defining the expander size under some platforms. :type `win`: wx.Window :rtype: :ref:`wx.Size` .. versionadded:: 4.1/wxWidgets-3.1.3 .. method:: 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. :param `win`: :type `win`: wx.Window :rtype: `int` .. method:: GetHeaderButtonMargin(self, win) Returns the horizontal margin on the left and right sides of header button's label. :param `win`: :type `win`: wx.Window :rtype: `int` .. versionadded:: 2.9.2 .. method:: GetSplitterParams(self, win) Get the splitter parameters, see :ref:`wx.SplitterRenderParams`. The `win` parameter should be a :ref:`wx.SplitterWindow`. :param `win`: :type `win`: wx.Window :rtype: :ref:`wx.SplitterRenderParams` .. method:: GetVersion(self) This function is used for version checking: :meth:`~wx.RendererNative.Load` refuses to load any shared libraries implementing an older or incompatible version. :rtype: :ref:`wx.RendererVersion` .. note:: The implementation of this method is always the same in all renderers (simply construct :ref:`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. .. attribute:: Version See :meth:`~wx.DelegateRendererNative.GetVersion`