ScrollBarStyler Class Reference

#include <Pt/Forms/ScrollBarStyler.h>

Binds a scroll bar to the current style renderer. More...

Inherits Styler.

Public Member Functions

 ScrollBarStyler ()
 Constructs an unbound scroll bar styler.
const Gfx::Brushbackground () const
 Returns the effective background brush.
void setBackground (const Gfx::Brush &brush)
 Sets the widget-local background brush to brush.
const Gfx::Brushforeground () const
 Returns the effective foreground brush.
void setForeground (const Gfx::Brush &brush)
 Sets the widget-local foreground brush to brush.
const Gfx::Pencontour () const
 Returns the effective contour pen.
void setContour (const Gfx::Pen &pen)
 Sets the widget-local contour pen to pen.
Gfx::SizeF measureFrame (PaintSurface &surface, const Gfx::SizeF &contentSize, Direction direction) const
 Measures the frame enclosing contentSize.
Gfx::SizeF measureButton (PaintSurface &surface, Direction direction) const
 Measures a decrease or increase button 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) const
 Lays out the track and decrease and increase buttons within rect.
void layoutHandle (PaintSurface &surface, const Gfx::RectF &trackRect, Direction direction, float fraction, float viewProportion, Gfx::RectF &handleRect) const
 Lays out the handle within trackRect.
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) const
 Renders the scroll bar chrome within rect for state.
void setRenderer (ScrollBarRenderer *renderer=0)
 Assigns a specific scroll bar renderer.
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

virtual StyleOptionsonBindOptions (const StyleOptions &global)
 Binds the overlay to global and returns it.
virtual RendereronStyleRenderer (const Style &style)
 Returns the shared scroll-bar renderer from style, or 0.
virtual RendereronCreateRenderer (const Style &style)
 Creates an independent clone of the style renderer, or 0.
void init (Renderer *renderer)
 Replaces the bound renderer with renderer.

Detailed Description

A ScrollBar owns a ScrollBarStyler. Applications do not construct one. Call Styler::bind() from onInvalidate(). When the overlay has no local options, bind uses the shared renderer from the style. Local options use a private clone. setRenderer() keeps an assigned renderer until it is cleared. A null renderer falls back on the next bind.

Appearance getters return effective tokens after bind. Setters write widget-local options. Measure, layout, and paint call the typed methods on this styler, not a public renderer accessor.

Member Function Documentation

◆ setRenderer()

void setRenderer ( ScrollBarRenderer * renderer = 0)

A null renderer falls back to the current style on the next bind.

◆ bind()

bool bind ( const Style & style,
const StyleOptions & styleOptions )
inherited

Returns true when the effective renderer or the effective options changed.

◆ init()

void init ( Renderer * renderer)
protectedinherited

A non-null renderer is a custom renderer. bind() keeps it until init() is called with 0, which falls back to the current style.