#include <Pt/Forms/PanelStyler.h>
Renders the look of a panel-like widget. More...
Inherits Renderer.
Public Member Functions | |
| PanelRenderer (std::size_t refs=0) | |
| Constructs a renderer with reference count refs. | |
| virtual | ~PanelRenderer () |
| Destroys the renderer. | |
| PanelRenderer * | create () 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 the given content size. | |
| Gfx::RectF | layoutFrame (PaintSurface &surface, const Gfx::RectF &frameRect) |
| Returns the inner content rectangle within the outer frame rect. | |
| const Painter & | textPainter (PaintSurface &surface) |
| Returns a painter with the current font and text color applied. | |
| void | renderBackground (PaintContext &context, const Gfx::RectF &rect, const PanelState &state) |
| Paints the panel background within the widget rect. | |
| void | renderFrame (PaintContext &context, const Gfx::RectF &rect, const PanelState &state) |
| Paints the frame border within the outer frame rect. | |
| void | renderText (PaintContext &context, const Gfx::RectF &rect, const String &text, const Gfx::PointF &pos, const PanelState &state) |
| Draws text at pos, clipped to the widget rect. | |
| void | renderIcon (PaintContext &context, const Gfx::RectF &rect, const Pixmap &picture, const Gfx::PointF &pos, const PanelState &state) |
| Draws picture at pos, clipped to the widget rect. | |
| 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 PanelRenderer * | onCreate () 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::RectF | onLayoutFrame (PaintSurface &surface, const Gfx::RectF &frameRect)=0 |
| Returns the content rectangle within frameRect. | |
| virtual const Painter & | onGetTextPainter (PaintSurface &surface)=0 |
| Returns a painter with the current font and text color. | |
| virtual void | onRenderBackground (PaintContext &context, const Gfx::RectF &rect, const PanelState &state)=0 |
| Paints the background fill for state. | |
| virtual void | onRenderFrame (PaintContext &context, const Gfx::RectF &rect, const PanelState &state)=0 |
| Paints the frame for state. | |
| virtual void | onRenderText (PaintContext &context, const Gfx::RectF &rect, const String &text, const Gfx::PointF &pos, const PanelState &state)=0 |
| Paints text at pos for state. | |
| virtual void | onRenderIcon (PaintContext &context, const Gfx::RectF &rect, const Pixmap &picture, const Gfx::PointF &pos, const PanelState &state)=0 |
| Paints picture at pos for state. | |
A PanelRenderer is a Style::Facet for Panel and Label. 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.
renderBackground() fills the whole control. renderFrame() draws the border.
Derive a renderer to change the look of panels and labels. Register it on a Style, or assign it with Panel::setRenderer() or Label::setRenderer().
|
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.