#include <Pt/Forms/Styler.h>
Manages renderer binding for one control family. More...
Inherits NonCopyable.
Inherited by ButtonStyler, CheckBoxStyler, ComboBoxStyler, LineEditStyler, ListBoxStyler, ListItemStyler, PanelStyler, ProgressBarStyler, ScrollBarStyler, SliderStyler, SpinBoxStyler, and TabViewStyler.
Public Member Functions | |
| Styler () | |
| Constructor. | |
| virtual | ~Styler () |
| Destructor. | |
| bool | bind (const Style &style, const StyleOptions &styleOptions) |
| Binds this styler to style and styleOptions. | |
| bool | isBound () const |
| Returns true if a renderer is bound. | |
Protected Member Functions | |
| void | init (Renderer *renderer) |
| Replaces the bound renderer with renderer. | |
| virtual StyleOptions & | onBindOptions (const StyleOptions &global)=0 |
| Binds the overlay to global and returns it. | |
| virtual Renderer * | onStyleRenderer (const Style &style)=0 |
| Returns the shared style renderer, or 0. | |
| virtual Renderer * | onCreateRenderer (const Style &style)=0 |
| Creates an independent clone of the style renderer, or 0. | |
A Styler connects a control family to the current Style and StyleOptions. Widgets own a derived styler. Applications do not construct Styler. Derive from it only to add a styler for a new control family.
Use bind() to associate the styler with a style and the application options. It returns true when the effective renderer or the effective options changed. Call bind() from onInvalidate() after the base implementation.
When the overlay contains no local options, bind() uses the shared renderer from the style and does not reset it. When the overlay contains local options, it uses a private clone and resets that clone with the overlay. A renderer assigned through the derived setRenderer() remains until it is cleared. Passing a null renderer falls back to the current style on the next bind().
Styler does not provide a public renderer accessor. Measure, layout, and paint use typed methods on the derived styler.
| bool bind | ( | const Style & | style, |
| const StyleOptions & | styleOptions ) |
Returns true when the effective renderer or the effective options changed.
|
protected |
A non-null renderer is a custom renderer. bind() keeps it until init() is called with 0, which falls back to the current style.
|
protectedpure virtual |
Bind the derived overlay with StyleOptions::bind() against global. Do not reset the shared style renderer here.
Implemented in ButtonStyler, CheckBoxStyler, ComboBoxStyler, LineEditStyler, ListBoxStyler, ListItemStyler, PanelStyler, ProgressBarStyler, ScrollBarStyler, SliderStyler, SpinBoxStyler, and TabViewStyler.
Do not reset or clone the returned renderer.
Implemented in ButtonStyler, CheckBoxStyler, ComboBoxStyler, LineEditStyler, ListBoxStyler, ListItemStyler, PanelStyler, ProgressBarStyler, ScrollBarStyler, SliderStyler, SpinBoxStyler, and TabViewStyler.
The clone must have a reference count of 0.
Implemented in ButtonStyler, CheckBoxStyler, ComboBoxStyler, LineEditStyler, ListBoxStyler, ListItemStyler, PanelStyler, ProgressBarStyler, ScrollBarStyler, SliderStyler, SpinBoxStyler, and TabViewStyler.