#include <Pt/Forms/ListBoxStyler.h>
Renders the look of a list item. More...
Inherits Renderer.
Public Member Functions | |
| ListItemRenderer (std::size_t refs=0) | |
| Constructs a renderer with reference count refs. | |
| virtual | ~ListItemRenderer () |
| Destroys the renderer. | |
| ListItemRenderer * | create () const |
| Creates a new default-constructed instance that the caller owns. | |
| Gfx::SizeF | measureContent (PaintSurface &surface, const Gfx::SizeF &iconSize, const Gfx::SizeF &textSize) |
| Returns the size of content with iconSize and textSize. | |
| Gfx::SizeF | measureFrame (PaintSurface &surface, const Gfx::SizeF &contentSize) |
| Returns the outer size including the frame for contentSize. | |
| const Painter & | textPainter (PaintSurface &surface) |
| Returns a painter with the current font and text color. | |
| Gfx::RectF | layoutFrame (PaintSurface &surface, const Gfx::RectF &rect) |
| Returns the content rectangle within rect. | |
| void | layoutContent (PaintSurface &surface, const Gfx::RectF &contentRect, const Gfx::SizeF &iconSize, const Gfx::SizeF &textSize, Gfx::RectF &iconRect, Gfx::RectF &textRect) |
| Places the icon and text in contentRect. | |
| void | renderBackground (PaintContext &context, const Gfx::RectF &rect, const ListItemState &state) |
| Paints the background for state. | |
| void | renderHighlight (PaintContext &context, const Gfx::RectF &rect, const ListItemState &state) |
| Paints the highlight for state. | |
| void | renderText (PaintContext &context, const Gfx::RectF &textRect, const String &text, const Gfx::PointF &pos, const ListItemState &state) |
| Paints text at pos for state. | |
| void | renderIcon (PaintContext &context, const Gfx::RectF &iconRect, const Pixmap &picture, const Gfx::PointF &pos, const ListItemState &state) |
| Paints picture at pos 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 ListItemRenderer * | 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 | onMeasureContent (PaintSurface &surface, const Gfx::SizeF &iconSize, const Gfx::SizeF &textSize)=0 |
| Returns the size of content with iconSize and textSize. | |
| virtual Gfx::SizeF | onMeasureFrame (PaintSurface &surface, const Gfx::SizeF &contentSize)=0 |
| Measures the frame enclosing contentSize. | |
| virtual const Painter & | onGetTextPainter (PaintSurface &surface)=0 |
| Returns a painter with the current font and text color. | |
| virtual Gfx::RectF | onLayoutFrame (PaintSurface &surface, const Gfx::RectF &rect)=0 |
| Returns the content rectangle within rect. | |
| virtual void | onLayoutContent (PaintSurface &surface, const Gfx::RectF &contentRect, const Gfx::SizeF &iconSize, const Gfx::SizeF &textSize, Gfx::RectF &iconRect, Gfx::RectF &textRect)=0 |
| Places the icon and text in contentRect. | |
| virtual void | onRenderBackground (PaintContext &context, const Gfx::RectF &rect, const ListItemState &state)=0 |
| Paints the background for state. | |
| virtual void | onRenderHighlight (PaintContext &context, const Gfx::RectF &rect, const ListItemState &state)=0 |
| Paints the highlight for state. | |
| virtual void | onRenderText (PaintContext &context, const Gfx::RectF &textRect, const String &text, const Gfx::PointF &pos, const ListItemState &state)=0 |
| Paints text at pos for state. | |
| virtual void | onRenderIcon (PaintContext &context, const Gfx::RectF &iconRect, const Pixmap &picture, const Gfx::PointF &pos, const ListItemState &state)=0 |
| Paints picture at pos for state. | |
A ListItemRenderer is a Style::Facet for the list-item 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.
Item methods take rectangles, text, icons, and item state. They do not take the list.
Derive a renderer to change the look of list items. Register it on a Style, or assign it to a widget with ListBoxItem::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.