| Version: 3.2.5

Public Member Functions | List of all members
wxDelegateRendererNative Class Reference
Class List by Category » Graphics Device Interface (GDI)

`#include <wx/renderer.h>`

Inheritance diagram for wxDelegateRendererNative:
[legend]

## Detailed Description

wxDelegateRendererNative allows reuse of renderers code by forwarding all the wxRendererNative 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 wxRendererNative and their implementation is trivial: they are simply forwarded to the real renderer. Note that the "real" renderer may, in turn, be a wxDelegateRendererNative 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.

##

Library: wxCore
Category: Graphics Device Interface (GDI)

See also
  wxRendererNative

## Public Member Functions

| wxDelegateRendererNative ()
| The default constructor does the same thing as the other one except that it uses the generic renderer instead of the user-specified rendererNative. More...
| wxDelegateRendererNative (wxRendererNative &rendererNative)
| This constructor uses the user-specified rendererNative to set up the delegate renderer object to follow all calls to the specified real renderer. More...
virtual int | DrawHeaderButton (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0, wxHeaderSortIconType sortArrow=wxHDR_SORT_ICON_NONE, wxHeaderButtonParams *params=NULL)
| Draw the header control button (used, for example, by wxListCtrl). More...
virtual int | DrawHeaderButtonContents (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0, wxHeaderSortIconType sortArrow=wxHDR_SORT_ICON_NONE, wxHeaderButtonParams *params=NULL)
| Draw the contents of a header control button (label, sort arrows, etc.). More...
virtual int | GetHeaderButtonHeight (wxWindow *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. More...
virtual int | GetHeaderButtonMargin (wxWindow *win)
| Returns the horizontal margin on the left and right sides of header button's label. More...
virtual void | DrawTreeItemButton (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)
| Draw the expanded/collapsed icon for a tree control item. More...
virtual void | DrawSplitterBorder (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)
| Draw the border for sash window: this border must be such that the sash drawn by DrawSplitterSash() blends into it well. More...
virtual void | DrawSplitterSash (wxWindow *win, wxDC &dc, const wxSize &size, wxCoord position, wxOrientation orient, int flags=0)
| Draw a sash. More...
virtual void | DrawComboBoxDropButton (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)
| Draw a button like the one used by wxComboBox to show a drop down window. More...
virtual void | DrawDropArrow (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)
| Draw a drop down arrow that is suitable for use outside a combo box. More...
virtual void | DrawCheckBox (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)
| Draw a check box. More...
virtual void | DrawCheckMark (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)
| Draw a check mark. More...
virtual wxSize | GetCheckBoxSize (wxWindow *win, int flags=0)
| Returns the size of a check box. More...
virtual wxSize | GetCheckMarkSize (wxWindow *win)
| Returns the size of a check mark. More...
virtual wxSize | GetExpanderSize (wxWindow *win)
| Returns the size of the expander used in tree-like controls. More...
virtual void | DrawPushButton (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)
| Draw a blank push button that looks very similar to wxButton. More...
virtual void | DrawItemSelectionRect (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)
| Draw a selection rectangle underneath the text as used e.g. More...
virtual void | DrawFocusRect (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)
| Draw a focus rectangle using the specified rectangle. More...
virtual wxSplitterRenderParams | GetSplitterParams (const wxWindow *win)
| Get the splitter parameters, see wxSplitterRenderParams. More...
virtual wxRendererVersion | GetVersion () const
| This function is used for version checking: Load() refuses to load any shared libraries implementing an older or incompatible version. More...
Public Member Functions inherited from wxRendererNative
virtual | ~wxRendererNative ()
| Virtual destructor as for any base class. More...
virtual void | DrawGauge (wxWindow *win, wxDC &dc, const wxRect &rect, int value, int max, int flags=0)=0
| Draw a progress bar in the specified rectangle. More...
virtual void | DrawItemText (wxWindow *win, wxDC &dc, const wxString &text, const wxRect &rect, int align=wxALIGN_LEFT|wxALIGN_TOP, int flags=0, wxEllipsizeMode ellipsizeMode=wxELLIPSIZE_END)=0
| Draw item text in the correct color based on selection status. More...
virtual void | DrawCollapseButton (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0
| Draw a collapse button. More...
virtual wxSize | GetCollapseButtonSize (wxWindow *win, wxDC &dc)=0
| Returns the size of a collapse button. More...
virtual void | DrawChoice (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0
| Draw a native wxChoice. More...
virtual void | DrawComboBox (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0
| Draw a native wxComboBox. More...
virtual void | DrawTextCtrl (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0
| Draw a native wxTextCtrl frame. More...
virtual void | DrawRadioBitmap (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0
| Draw a native wxRadioButton bitmap. More...
virtual void | DrawTitleBarBitmap (wxWindow *win, wxDC &dc, const wxRect &rect, wxTitleBarButton button, int flags=0)=0
| Draw a title bar button in the given state. More...

## Additional Inherited Members

Static Public Member Functions inherited from wxRendererNative
static wxRendererNative & | Get ()
| Return the currently used renderer. More...
static wxRendererNative & | GetDefault ()
| Return the default (native) implementation for this platform – this is also the one used by default but this may be changed by calling Set() in which case the return value of this method may be different from the return value of Get(). More...
static wxRendererNative & | GetGeneric ()
| Return the generic implementation of the renderer. More...
static wxRendererNative * | Load (const wxString &name)
| Load the renderer from the specified DLL, the returned pointer must be deleted by caller if not NULL when it is not used any more. More...
static wxRendererNative * | Set (wxRendererNative *renderer)
| Set the renderer to use, passing NULL reverts to using the default renderer (the global renderer must always exist). More...

## Constructor & Destructor Documentation

## ◆ wxDelegateRendererNative() [1/2]

wxDelegateRendererNative::wxDelegateRendererNative | ( |  | ) |

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.

## ◆ wxDelegateRendererNative() [2/2]

wxDelegateRendererNative::wxDelegateRendererNative | ( | wxRendererNative & | rendererNative | ) |

This constructor uses the user-specified rendererNative to set up the delegate renderer object to follow all calls to the specified real renderer.

Note
  This object does not take ownership of (i.e. won't delete) rendererNative.

## Member Function Documentation

## ◆ DrawCheckBox()

virtual void wxDelegateRendererNative::DrawCheckBox | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`
| ) |  |

virtual

Draw a check box.

flags may have the `wxCONTROL_CHECKED`, `wxCONTROL_CURRENT` or `wxCONTROL_UNDETERMINED` bit set, see wxCONTROL_FLAGS.

Implements wxRendererNative.

## ◆ DrawCheckMark()

virtual void wxDelegateRendererNative::DrawCheckMark | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`
| ) |  |

virtual

Draw a check mark.

flags may have the `wxCONTROL_DISABLED` bit set, see wxCONTROL_FLAGS.

Since
  3.1.3

Implements wxRendererNative.

## ◆ DrawComboBoxDropButton()

virtual void wxDelegateRendererNative::DrawComboBoxDropButton | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`
| ) |  |

virtual

Draw a button like the one used by wxComboBox to show a drop down window.

The usual appearance is a downwards pointing arrow.

flags may have the `wxCONTROL_PRESSED` or `wxCONTROL_CURRENT` bit set, see wxCONTROL_FLAGS.

Implements wxRendererNative.

## ◆ DrawDropArrow()

virtual void wxDelegateRendererNative::DrawDropArrow | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`
| ) |  |

virtual

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 `wxCONTROL_PRESSED` or `wxCONTROL_CURRENT` bit set, see wxCONTROL_FLAGS.

Implements wxRendererNative.

## ◆ DrawFocusRect()

virtual void wxDelegateRendererNative::DrawFocusRect | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`
| ) |  |

virtual

Draw a focus rectangle using the specified rectangle.

wxListCtrl.

The only supported flags is `wxCONTROL_SELECTED` for items which are selected. see wxCONTROL_FLAGS.

Implements wxRendererNative.

## ◆ DrawHeaderButton()

virtual int wxDelegateRendererNative::DrawHeaderButton | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`,
|  | wxHeaderSortIconType | sortArrow = `wxHDR_SORT_ICON_NONE`,
|  | wxHeaderButtonParams * | params = `NULL`
| ) |  |

virtual

Draw the header control button (used, for example, by wxListCtrl).

Depending on platforms the flags parameter may support the `wxCONTROL_SELECTED` `wxCONTROL_DISABLED` and `wxCONTROL_CURRENT` bits, see wxCONTROL_FLAGS.

Returns
  The optimal width to contain the unabbreviated label text or bitmap, the sort arrow if present, and internal margins.

Implements wxRendererNative.

## ◆ DrawHeaderButtonContents()

virtual int wxDelegateRendererNative::DrawHeaderButtonContents | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`,
|  | wxHeaderSortIconType | sortArrow = `wxHDR_SORT_ICON_NONE`,
|  | wxHeaderButtonParams * | params = `NULL`
| ) |  |

virtual

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 `wxCONTROL_SELECTED` `wxCONTROL_DISABLED` and `wxCONTROL_CURRENT` bits, see wxCONTROL_FLAGS.

Returns
  The optimal width to contain the unabbreviated label text or bitmap, the sort arrow if present, and internal margins.

Implements wxRendererNative.

## ◆ DrawItemSelectionRect()

virtual void wxDelegateRendererNative::DrawItemSelectionRect | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`
| ) |  |

virtual

Draw a selection rectangle underneath the text as used e.g.

in a wxListCtrl.

The supported flags are `wxCONTROL_SELECTED` for items which are selected (e.g. often a blue rectangle) and `wxCONTROL_CURRENT` for the item that has the focus (often a dotted line around the item's text). `wxCONTROL_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 `wxCONTROL_CELL` may be used to draw a cell inside a bigger selection area.

See also
  DrawItemText()

Implements wxRendererNative.

## ◆ DrawPushButton()

virtual void wxDelegateRendererNative::DrawPushButton | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`
| ) |  |

virtual

Draw a blank push button that looks very similar to wxButton.

flags may have the `wxCONTROL_PRESSED`, `wxCONTROL_CURRENT` or `wxCONTROL_ISDEFAULT` bit set, see wxCONTROL_FLAGS.

Implements wxRendererNative.

## ◆ DrawSplitterBorder()

virtual void wxDelegateRendererNative::DrawSplitterBorder | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`
| ) |  |

virtual

Draw the border for sash window: this border must be such that the sash drawn by DrawSplitterSash() blends into it well.

Implements wxRendererNative.

## ◆ DrawSplitterSash()

virtual void wxDelegateRendererNative::DrawSplitterSash | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxSize & | size,
|  | wxCoord | position,
|  | wxOrientation | orient,
|  | int | flags = `0`
| ) |  |

virtual

Draw a sash.

The orient parameter defines whether the sash should be vertical or horizontal and how the position should be interpreted.

Implements wxRendererNative.

## ◆ DrawTreeItemButton()

virtual void wxDelegateRendererNative::DrawTreeItemButton | ( | wxWindow * | win,
|  | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | flags = `0`
| ) |  |

virtual

Draw the expanded/collapsed icon for a tree control item.

To draw an expanded button the flags parameter must contain `wxCONTROL_EXPANDED` bit, see wxCONTROL_FLAGS.

Implements wxRendererNative.

## ◆ GetCheckBoxSize()

virtual wxSize wxDelegateRendererNative::GetCheckBoxSize | ( | wxWindow * | win,
|  | int | flags = `0`
| ) |  |

virtual

Returns the size of a check box.

Parameters

  win | A valid, i.e. non-null, window pointer which is used to get the theme defining the checkbox size under some platforms.
  flags | The only acceptable flag is `wxCONTROL_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.

Implements wxRendererNative.

## ◆ GetCheckMarkSize()

virtual wxSize wxDelegateRendererNative::GetCheckMarkSize | ( | wxWindow * | win | ) |

virtual

Returns the size of a check mark.

Parameters

  win | A valid, i.e. non-null, window pointer which is used to get the theme defining the checkmark size under some platforms.

Since
  3.1.3

Implements wxRendererNative.

## ◆ GetExpanderSize()

virtual wxSize wxDelegateRendererNative::GetExpanderSize | ( | wxWindow * | win | ) |

virtual

Returns the size of the expander used in tree-like controls.

Parameters

  win | A valid, i.e. non-null, window pointer which is used to get the theme defining the expander size under some platforms.

Since
  3.1.3

Implements wxRendererNative.

## ◆ GetHeaderButtonHeight()

virtual int wxDelegateRendererNative::GetHeaderButtonHeight | ( | wxWindow * | win | ) |

virtual

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.

Implements wxRendererNative.

## ◆ GetHeaderButtonMargin()

virtual int wxDelegateRendererNative::GetHeaderButtonMargin | ( | wxWindow * | win | ) |

virtual

Returns the horizontal margin on the left and right sides of header button's label.

Since
  2.9.2

Implements wxRendererNative.

## ◆ GetSplitterParams()

virtual wxSplitterRenderParams wxDelegateRendererNative::GetSplitterParams | ( | const wxWindow * | win | ) |

virtual

Get the splitter parameters, see wxSplitterRenderParams.

The win parameter should be a wxSplitterWindow.

Implements wxRendererNative.

## ◆ GetVersion()

virtual wxRendererVersion wxDelegateRendererNative::GetVersion | ( |  | ) | const

virtual

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

Remarks
  The implementation of this method is always the same in all renderers (simply construct wxRendererVersion using the `wxRendererVersion::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.

Implements wxRendererNative.