#include <Pt/Forms/Renderer.h>
Provides cloneable drawing for one control family. More...
Inherits Style::Facet.
Inherited by ButtonRenderer, CheckBoxRenderer, ComboBoxRenderer, LineEditRenderer, ListBoxRenderer, ListItemRenderer, PanelRenderer, ProgressBarRenderer, ScrollBarRenderer, SliderRenderer, SpinBoxRenderer, and TabViewRenderer.
Public Member Functions | |
| Renderer (const std::type_info &ti, std::size_t refs=0) | |
| Constructor. | |
| Renderer * | create () const |
| Creates a new instance with a reference count of 0. | |
| const std::type_info & | typeId () const |
| Returns the dynamic type used as the registry key. | |
| void | ref () |
| Adds one reference. | |
| std::size_t | unref () |
| Removes one reference and returns the remaining count. | |
| void | reset (const StyleOptions &options) |
| Resets this facet with options. | |
Protected Member Functions | |
| virtual Renderer * | onCreate () const =0 |
| Creates a new renderer of the same concrete type. | |
| virtual void | onReset (const StyleOptions &) |
| Resets this facet with options. | |
A Renderer is a Style::Facet that can clone itself. Shared instances remain in Style. Use reset() to apply application options. Use create() to allocate a new instance with a reference count of 0. FacetPtr and Style::set() take their own references.
Named measure, layout, and render methods belong on derived renderer types. Use Facet::onReset() to read style options and store drawing state for those methods.
A renderer may store a Painter. That painter keeps its brush, pen, font, clip, and composition after begin(). onReset() assigns the default attributes. A render method that changes them assigns the defaults again before it returns.
Derive a renderer for a control family and register it on a Style.
|
protectedvirtualinherited |
Resolves tokens from options and stores the painter and metric state used later by measure, layout, and render. Shared facets are reset when the application applies global options.
Reimplemented in ButtonRenderer, CheckBoxRenderer, ComboBoxRenderer, LineEditRenderer, ListBoxRenderer, ListItemRenderer, PanelRenderer, ProgressBarRenderer, ScrollBarRenderer, SliderRenderer, SpinBoxRenderer, and TabViewRenderer.