ScrollBarRenderer Class Referenceabstract

#include <Pt/Forms/ScrollBarStyler.h>

Renders the look of a scroll bar. More...

Inherits Renderer.

Inherited by PlatinumScrollBarRenderer.

Public Member Functions

 ScrollBarRenderer (std::size_t refs=0)
 Constructs a renderer with reference count refs.
 
virtual ~ScrollBarRenderer ()
 Destroys the renderer.
 
ScrollBarRenderercreate () const
 Creates a new default-constructed instance that the caller owns.
 
Gfx::SizeF measureFrame (PaintSurface &surface, const Gfx::SizeF &contentSize, Direction direction)
 Returns the outer size including the frame for contentSize.
 
Gfx::SizeF measureTrack (PaintSurface &surface, Direction direction)
 Returns the natural size of the track for direction.
 
Gfx::SizeF measureHandle (PaintSurface &surface, Direction direction)
 Returns the natural size of the handle for direction.
 
Gfx::SizeF measureButton (PaintSurface &surface, Direction direction)
 Returns the natural size of a decrease or increase control for direction.
 
void layoutChrome (PaintSurface &surface, const Gfx::RectF &rect, Direction direction, const Gfx::SizeF &buttonSize, Gfx::RectF &trackRect, Gfx::RectF &decreaseRect, Gfx::RectF &increaseRect)
 Places the track and decrease and increase controls in rect.
 
void layoutHandle (PaintSurface &surface, const Gfx::RectF &trackRect, Direction direction, float fraction, float viewProportion, Gfx::RectF &handleRect)
 Places the handle in trackRect for fraction and viewProportion.
 
void renderChrome (PaintContext &context, const Gfx::RectF &rect, Direction direction, const Gfx::RectF &trackRect, const Gfx::RectF &handleRect, const Gfx::RectF &decreaseRect, const Gfx::RectF &increaseRect, const ScrollBarState &state)
 Paints track, handle, and buttons for state.
 
void renderTrack (PaintContext &context, const Gfx::RectF &trackRect, Direction direction, const ScrollBarState &state)
 Paints the track for state.
 
void renderHandle (PaintContext &context, const Gfx::RectF &handleRect, Direction direction, const ScrollBarState &state)
 Paints the handle for state.
 
void renderDecreaseButton (PaintContext &context, const Gfx::RectF &buttonRect, Direction direction, const ScrollBarState &state)
 Paints the decrease control for state.
 
void renderIncreaseButton (PaintContext &context, const Gfx::RectF &buttonRect, Direction direction, const ScrollBarState &state)
 Paints the increase control 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 ScrollBarRendereronCreate () const =0
 Creates a new instance of the same concrete type.
 
virtual void onReset (const StyleOptions &options)=0
 Resets this facet with options. More...
 
virtual Gfx::SizeF onMeasureFrame (PaintSurface &surface, const Gfx::SizeF &contentSize, Direction direction)=0
 Measures the frame enclosing contentSize.
 
virtual Gfx::SizeF onMeasureTrack (PaintSurface &surface, Direction direction)=0
 Returns the natural size of the track for direction.
 
virtual Gfx::SizeF onMeasureHandle (PaintSurface &surface, Direction direction)=0
 Returns the natural size of the handle for direction.
 
virtual Gfx::SizeF onMeasureButton (PaintSurface &surface, Direction direction)=0
 Returns the natural size of a decrease or increase control for direction.
 
virtual void onLayoutChrome (PaintSurface &surface, const Gfx::RectF &rect, Direction direction, const Gfx::SizeF &buttonSize, Gfx::RectF &trackRect, Gfx::RectF &decreaseRect, Gfx::RectF &increaseRect)=0
 Places the track and decrease and increase controls in rect.
 
virtual void onLayoutHandle (PaintSurface &surface, const Gfx::RectF &trackRect, Direction direction, float fraction, float viewProportion, Gfx::RectF &handleRect)=0
 Places the handle in trackRect for fraction and viewProportion.
 
virtual void onRenderChrome (PaintContext &context, const Gfx::RectF &rect, Direction direction, const Gfx::RectF &trackRect, const Gfx::RectF &handleRect, const Gfx::RectF &decreaseRect, const Gfx::RectF &increaseRect, const ScrollBarState &state)
 Paints track, handle, and buttons for state.
 
virtual void onRenderTrack (PaintContext &context, const Gfx::RectF &trackRect, Direction direction, const ScrollBarState &state)=0
 Paints the track for state.
 
virtual void onRenderHandle (PaintContext &context, const Gfx::RectF &handleRect, Direction direction, const ScrollBarState &state)=0
 Paints the handle for state.
 
virtual void onRenderDecreaseButton (PaintContext &context, const Gfx::RectF &buttonRect, Direction direction, const ScrollBarState &state)=0
 Paints the decrease control for state.
 
virtual void onRenderIncreaseButton (PaintContext &context, const Gfx::RectF &buttonRect, Direction direction, const ScrollBarState &state)=0
 Paints the increase control for state.
 

Detailed Description

A ScrollBarRenderer is a Style::Facet for the scroll-bar 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, handle, and decrease and increase controls are public primitives.

Derive a renderer to change the look of scroll bars. Register it on a Style, or assign it to a widget with ScrollBar::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.