TabViewRenderer Class Referenceabstract

#include <Pt/Forms/TabViewStyler.h>

Renders the look of a tab view. More...

Inherits Renderer.

Public Member Functions

 TabViewRenderer (std::size_t refs=0)
 Constructs a renderer with reference count refs.
virtual ~TabViewRenderer ()
 Destroys the renderer.
TabViewRenderercreate () const
 Creates a new default-constructed instance that the caller owns.
Gfx::SizeF measureTab (PaintSurface &surface, const Pt::String &text)
 Returns the natural size of a tab labeled text.
Gfx::RectF layoutTab (PaintSurface &surface, const Gfx::RectF &tabRect)
 Returns the label rectangle within tabRect.
const PaintertextPainter (PaintSurface &surface)
 Returns a painter with the current font and text color.
void renderBackground (PaintContext &context, const Gfx::RectF &contentRect, const TabViewState &state)
 Paints the background for state.
void renderChrome (PaintContext &context, const Gfx::RectF &contentRect, const Gfx::RectF &activeTabRect, const TabViewState &state)
 Paints the frame for state.
void renderTab (PaintContext &context, const Gfx::RectF &tabRect, const Pt::String &text, const Gfx::PointF &textPos, const TabViewItemState &state)
 Paints a tab labeled text 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 TabViewRendereronCreate () 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 onMeasureTab (PaintSurface &surface, const Pt::String &text)=0
 Returns the natural size of a tab labeled text.
virtual Gfx::RectF onLayoutTab (PaintSurface &surface, const Gfx::RectF &tabRect)=0
 Returns the label rectangle within tabRect.
virtual const PainteronGetTextPainter (PaintSurface &surface)=0
 Returns a painter with the current font and text color.
virtual void onRenderBackground (PaintContext &context, const Gfx::RectF &contentRect, const TabViewState &state)=0
 Paints the background for state.
virtual void onRenderChrome (PaintContext &context, const Gfx::RectF &contentRect, const Gfx::RectF &activeTabRect, const TabViewState &state)=0
 Paints the frame for state.
virtual void onRenderTab (PaintContext &context, const Gfx::RectF &tabRect, const Pt::String &text, const Gfx::PointF &textPos, const TabViewItemState &state)=0
 Paints a tab labeled text for state.

Detailed Description

A TabViewRenderer is a Style::Facet for the tab-view 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.

View chrome uses TabViewState. Each tab uses TabViewItemState. renderTab() takes tab state, not view state.

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