ComboBoxRenderer Class Referenceabstract

#include <Pt/Forms/ComboBoxStyler.h>

Renders the look of a combo box. More...

Inherits Renderer.

Public Member Functions

 ComboBoxRenderer (std::size_t refs=0)
 Constructs a renderer with reference count refs.
virtual ~ComboBoxRenderer ()
 Destroys the renderer.
ComboBoxRenderercreate () 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 measureButton (PaintSurface &surface)
 Returns the natural size of the drop button.
void layoutChrome (PaintSurface &surface, const Gfx::RectF &rect, Gfx::RectF &entryRect, Gfx::RectF &buttonRect, Gfx::RectF &textRect)
 Places the entry, drop button, and text in rect.
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 &entryRect, const Gfx::RectF &buttonRect, const ComboBoxState &state, const ComboBoxButtonState &buttonState)
 Paints entry and drop button for state.
void renderButton (PaintContext &context, const Gfx::RectF &buttonRect, const ComboBoxState &state, const ComboBoxButtonState &buttonState)
 Paints the drop button for state.
void renderText (PaintContext &context, const Gfx::RectF &textRect, const String &text, const Gfx::PointF &textPos, const Gfx::RectF &cursor, const ComboBoxState &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 ComboBoxRendereronCreate () 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 onMeasureButton (PaintSurface &surface)=0
 Returns the natural size of the drop button.
virtual void onLayoutChrome (PaintSurface &surface, const Gfx::RectF &rect, Gfx::RectF &entryRect, Gfx::RectF &buttonRect, Gfx::RectF &textRect)=0
 Places the entry, drop button, and text in rect.
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 &entryRect, const Gfx::RectF &buttonRect, const ComboBoxState &state, const ComboBoxButtonState &buttonState)
 Paints entry and drop button for state.
virtual void onRenderEntry (PaintContext &context, const Gfx::RectF &entryRect, const ComboBoxState &state)=0
 Paints the entry for state.
virtual void onRenderButton (PaintContext &context, const Gfx::RectF &buttonRect, const ComboBoxState &state, const ComboBoxButtonState &buttonState)=0
 Paints the drop button for state.
virtual void onRenderText (PaintContext &context, const Gfx::RectF &textRect, const String &text, const Gfx::PointF &textPos, const Gfx::RectF &cursor, const ComboBoxState &state)=0
 Paints text at textPos for state.

Detailed Description

A ComboBoxRenderer is a Style::Facet for the combo-box 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 combo boxes. Register it on a Style, or assign it to a widget with ComboBox::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.