SliderRenderer Class Referenceabstract

#include <Pt/Forms/SliderStyler.h>

Renders the look of a slider. More...

Inherits Renderer.

Public Member Functions

 SliderRenderer (std::size_t refs=0)
 Constructs a renderer with reference count refs.
virtual ~SliderRenderer ()
 Destroys the renderer.
SliderRenderercreate () 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 measureTrack (PaintSurface &surface)
 Returns the natural size of the track.
Gfx::SizeF measureHandle (PaintSurface &surface)
 Returns the natural size of the handle.
void layoutChrome (PaintSurface &surface, const Gfx::RectF &rect, const Gfx::SizeF &trackSize, const Gfx::SizeF &handleSize, Gfx::RectF &trackRect, Gfx::RectF &handleRect)
 Places the track and handle in rect.
void layoutHandle (PaintSurface &surface, const Gfx::RectF &trackRect, float fraction, Gfx::RectF &handleRect)
 Places the handle for fraction along trackRect.
void renderChrome (PaintContext &context, const Gfx::RectF &rect, const Gfx::RectF &trackRect, const Gfx::RectF &handleRect, const SliderState &state)
 Paints track and handle for state.
void renderTrack (PaintContext &context, const Gfx::RectF &trackRect, const SliderState &state)
 Paints the track for state.
void renderHandle (PaintContext &context, const Gfx::RectF &handleRect, const SliderState &state)
 Paints the handle 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 SliderRendereronCreate () 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 onMeasureTrack (PaintSurface &surface)=0
 Returns the natural size of the track.
virtual Gfx::SizeF onMeasureHandle (PaintSurface &surface)=0
 Returns the natural size of the handle.
virtual void onLayoutChrome (PaintSurface &surface, const Gfx::RectF &rect, const Gfx::SizeF &trackSize, const Gfx::SizeF &handleSize, Gfx::RectF &trackRect, Gfx::RectF &handleRect)=0
 Places the track and handle in rect.
virtual void onLayoutHandle (PaintSurface &surface, const Gfx::RectF &trackRect, float fraction, Gfx::RectF &handleRect)=0
 Places the handle for fraction along trackRect.
virtual void onRenderChrome (PaintContext &context, const Gfx::RectF &rect, const Gfx::RectF &trackRect, const Gfx::RectF &handleRect, const SliderState &state)
 Paints track and handle for state.
virtual void onRenderTrack (PaintContext &context, const Gfx::RectF &trackRect, const SliderState &state)=0
 Paints the track for state.
virtual void onRenderHandle (PaintContext &context, const Gfx::RectF &handleRect, const SliderState &state)=0
 Paints the handle for state.

Detailed Description

A SliderRenderer is a Style::Facet for the slider 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.

Track and handle are public primitives. Custom widgets such as scrubbers, timelines, mixers, range editors, and color controls may reuse them. renderChrome() may paint track and handle together. A derived renderer may override renderTrack() and renderHandle() instead.

Derive a renderer to change the look of sliders. Register it on a Style, or assign it to a widget with Slider::setRenderer().

Member Function Documentation

◆ onReset()

virtual void onReset ( const StyleOptions & options)
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.