ProgressBarRenderer Class Referenceabstract

#include <Pt/Forms/ProgressBarStyler.h>

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

Inherits Renderer.

Public Member Functions

 ProgressBarRenderer (std::size_t refs=0)
 Constructs a renderer with reference count refs.
virtual ~ProgressBarRenderer ()
 Destroys the renderer.
ProgressBarRenderercreate () 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 measureBar (PaintSurface &surface)
 Returns the natural size of the track.
void layoutChrome (PaintSurface &surface, const Gfx::RectF &rect, const Gfx::SizeF &barSize, const Gfx::SizeF &textSize, Gfx::RectF &barRect, Gfx::RectF &textRect)
 Places the track and text rectangles in rect.
void layoutBar (PaintSurface &surface, const Gfx::RectF &barRect, float progressRatio, Gfx::RectF &trackRect, Gfx::RectF &chunkRect)
 Places the track and filled portion for progressRatio.
const PaintertextPainter (PaintSurface &surface)
 Returns a painter with the current font and text color.
void renderChrome (PaintContext &context, const Gfx::RectF &rect, const Gfx::RectF &trackRect, const Gfx::RectF &chunkRect, const Gfx::RectF &textRect, const String &text, const Gfx::PointF &textPos, const ProgressBarState &state)
 Paints track, filled portion, and text for state.
void renderBar (PaintContext &context, const Gfx::RectF &trackRect, const Gfx::RectF &chunkRect, const ProgressBarState &state)
 Paints the track and filled portion for state.
void renderTrack (PaintContext &context, const Gfx::RectF &trackRect, const ProgressBarState &state)
 Paints the track for state.
void renderChunk (PaintContext &context, const Gfx::RectF &chunkRect, const ProgressBarState &state)
 Paints the filled portion for state.
void renderText (PaintContext &context, const Gfx::RectF &textRect, const Gfx::RectF &chunkRect, const String &text, const Gfx::PointF &textPos, const ProgressBarState &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 ProgressBarRendereronCreate () 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 onMeasureBar (PaintSurface &surface)=0
 Returns the natural size of the track.
virtual void onLayoutChrome (PaintSurface &surface, const Gfx::RectF &rect, const Gfx::SizeF &barSize, const Gfx::SizeF &textSize, Gfx::RectF &barRect, Gfx::RectF &textRect)=0
 Places the track and text rectangles in rect.
virtual void onLayoutBar (PaintSurface &surface, const Gfx::RectF &barRect, float progressRatio, Gfx::RectF &trackRect, Gfx::RectF &chunkRect)=0
 Places the track and filled portion for progressRatio.
virtual const PainteronGetTextPainter (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 &trackRect, const Gfx::RectF &chunkRect, const Gfx::RectF &textRect, const String &text, const Gfx::PointF &textPos, const ProgressBarState &state)
 Paints track, filled portion, and text for state.
virtual void onRenderBar (PaintContext &context, const Gfx::RectF &trackRect, const Gfx::RectF &chunkRect, const ProgressBarState &state)
 Paints the track and filled portion for state.
virtual void onRenderTrack (PaintContext &context, const Gfx::RectF &trackRect, const ProgressBarState &state)=0
 Paints the track for state.
virtual void onRenderChunk (PaintContext &context, const Gfx::RectF &chunkRect, const ProgressBarState &state)=0
 Paints the filled portion for state.
virtual void onRenderText (PaintContext &context, const Gfx::RectF &textRect, const Gfx::RectF &chunkRect, const String &text, const Gfx::PointF &textPos, const ProgressBarState &state)=0
 Paints text at textPos for state.

Detailed Description

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

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