wxRuby Documentation Home

# Wx::DelegateRendererNative

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.

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
RendererNative and their implementation is
trivial: they are simply forwarded to the real renderer. Note that the ``real’’
renderer may, in turn, be a 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.

## Derived from

RendererNative

## Methods

- DelegateRendererNative.new
- DelegateRendererNative#draw_xxx

### DelegateRendererNative.new

DelegateRendererNative.new(%(arg-type)RendererNative% rendererNative)

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.

Note that this object does not take ownership of (i.e. won’t delete)
rendererNative.

### DelegateRendererNative#draw_xxx

draw_xxx(%(arg-type)% $$)

This class also provides all the virtual methods of
RendererNative, please refer to that class
documentation for the details.

[This page automatically generated from the Textile source at 2023-06-09 00:45:31 +0000]