#include <Pt/Forms/SpinBoxStyler.h>
Renders the look of a spin box. More...
Inherits Renderer.
Public Member Functions | |
| SpinBoxRenderer (std::size_t refs=0) | |
| Constructs a renderer with reference count refs. | |
| virtual | ~SpinBoxRenderer () |
| Destroys the renderer. | |
| SpinBoxRenderer * | create () const |
| Creates a new default-constructed instance that the caller owns. | |
| Gfx::SizeF | measureFrame (PaintSurface &surface, const Gfx::SizeF &contentSize) |
| Returns the outer size including the frame for contentSize. | |
| Gfx::SizeF | measureEntry (PaintSurface &surface, const Gfx::SizeF &contentSize) |
| Returns the entry size for contentSize. | |
| Gfx::SizeF | measureIndicator (PaintSurface &surface) |
| Returns the natural size of a step control. | |
| void | layoutChrome (PaintSurface &surface, const Gfx::RectF &rect, Gfx::RectF &entryRect, Gfx::RectF &upButtonRect, Gfx::RectF &downButtonRect, Gfx::RectF &textRect) |
| Places the entry, step controls, and text in rect. | |
| Gfx::RectF | layoutEntry (PaintSurface &surface, const Gfx::RectF &entryRect) |
| Returns the text rectangle within entryRect. | |
| const Painter & | textPainter (PaintSurface &surface) |
| Returns a painter with the current font and text color. | |
| void | renderChrome (PaintContext &context, const Gfx::RectF &rect, const Gfx::RectF &entryRect, const Gfx::RectF &upButtonRect, const Gfx::RectF &downButtonRect, const SpinBoxState &state) |
| Paints entry and step controls for state. | |
| void | renderText (PaintContext &context, const Gfx::RectF &textRect, const String &text, const Gfx::PointF &textPos, const Gfx::RectF &cursor, const SpinBoxState &state) |
| Paints text at textPos for state. | |
| 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 SpinBoxRenderer * | onCreate () const =0 |
| Creates a new instance of the same concrete type. | |
| virtual void | onReset (const StyleOptions &options)=0 |
| Resets this facet with options. | |
| virtual Gfx::SizeF | onMeasureFrame (PaintSurface &surface, const Gfx::SizeF &contentSize)=0 |
| Measures the frame enclosing contentSize. | |
| virtual Gfx::SizeF | onMeasureEntry (PaintSurface &surface, const Gfx::SizeF &contentSize)=0 |
| Measures the entry enclosing contentSize. | |
| virtual Gfx::SizeF | onMeasureIndicator (PaintSurface &surface)=0 |
| Returns the natural size of a step control. | |
| virtual void | onLayoutChrome (PaintSurface &surface, const Gfx::RectF &rect, Gfx::RectF &entryRect, Gfx::RectF &upButtonRect, Gfx::RectF &downButtonRect, Gfx::RectF &textRect)=0 |
| Places the entry, step controls, and text in rect. | |
| virtual Gfx::RectF | onLayoutEntry (PaintSurface &surface, const Gfx::RectF &entryRect)=0 |
| Returns the text rectangle within entryRect. | |
| virtual const Painter & | onGetTextPainter (PaintSurface &surface)=0 |
| Returns a painter with the current font and text color. | |
| virtual void | onRenderChrome (PaintContext &context, const Gfx::RectF &rect, const Gfx::RectF &entryRect, const Gfx::RectF &upButtonRect, const Gfx::RectF &downButtonRect, const SpinBoxState &state) |
| Paints entry and step controls for state. | |
| virtual void | onRenderEntry (PaintContext &context, const Gfx::RectF &entryRect, const SpinBoxState &state)=0 |
| Paints the entry for state. | |
| virtual void | onRenderUpButton (PaintContext &context, const Gfx::RectF &buttonRect, const SpinBoxState &state)=0 |
| Paints the up control for state. | |
| virtual void | onRenderDownButton (PaintContext &context, const Gfx::RectF &buttonRect, const SpinBoxState &state)=0 |
| Paints the down control for state. | |
| virtual void | onRenderText (PaintContext &context, const Gfx::RectF &textRect, const String &text, const Gfx::PointF &textPos, const Gfx::RectF &cursor, const SpinBoxState &state)=0 |
| Paints text at textPos for state. | |
A SpinBoxRenderer is a Style::Facet for the spin-box family. Named measure methods run inside-out. Named layout methods run outside-in. Named render methods paint prepared rectangles. The widget owns geometry and orchestrates those passes. The renderer does not mutate widget geometry.
Up and down controls are integrated subparts. A style may merge them with the entry or place them beside it. They are not public borrowable primitives.
Derive a renderer to change the look of spin boxes. Register it on a Style, or assign it to a widget with SpinBox::setRenderer().
|
protectedpure virtual |
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 from Style::Facet.