tbx  0.7.6
Classes | Public Member Functions | List of all members
tbx::view::ItemRenderer Class Referenceabstract

Base class to render an indexed item. More...

#include <itemrenderer.h>

Inheritance diagram for tbx::view::ItemRenderer:
tbx::view::TypedItemRenderer< T > tbx::view::TypedItemRenderer< std::string > tbx::view::TypedItemRenderer< tbx::Sprite * > tbx::view::FontItemRenderer tbx::view::IconItemRenderer tbx::view::WimpFontItemRenderer tbx::view::SpriteItemRenderer

Classes

struct  Info
 Information on what needs to be redrawn. More...
 

Public Member Functions

virtual void render (const ItemRenderer::Info &info)=0
 Called to render each item that needs drawing. More...
 
virtual unsigned int width (unsigned int index) const =0
 Used to measure the width of a column.
 
virtual unsigned int height (unsigned int index) const =0
 Used to measure the height of column.
 
virtual Size size (unsigned int index) const =0
 Called to get the size of the item. More...
 
virtual bool hit_test (unsigned int index, const Size &size, const Point &pos) const
 Check if the point given hits content of the cell rather then a margin or background. More...
 
virtual bool intersects (unsigned int index, const Size &size, const BBox &box) const
 Check if the given rectangle intersects the content of the cell rather than a margin or background. More...
 

Detailed Description

Base class to render an indexed item.

Member Function Documentation

◆ hit_test()

virtual bool tbx::view::ItemRenderer::hit_test ( unsigned int  index,
const Size size,
const Point pos 
) const
inlinevirtual

Check if the point given hits content of the cell rather then a margin or background.

Default returns true so all the cell is content.

Parameters
indexindex of item to check
sizeof area item is rendered in
poslocation to check relative to bottom left of cell
Returns
true if content is at that location, otherwise false

Reimplemented in tbx::view::IconItemRenderer.

◆ intersects()

virtual bool tbx::view::ItemRenderer::intersects ( unsigned int  index,
const Size size,
const BBox box 
) const
inlinevirtual

Check if the given rectangle intersects the content of the cell rather than a margin or background.

Default returns true so all cell is content.

Parameters
indexindex of item to check
sizeof area item is rendered in
boxbox to check if it intersect the cell
Returns
true if some contents are in the box, otherwise false

Reimplemented in tbx::view::IconItemRenderer.

◆ render()

virtual void tbx::view::ItemRenderer::render ( const ItemRenderer::Info info)
pure virtual

Called to render each item that needs drawing.

The item is only clipped to the containing Windows visible area, not to the cell bounds so the content must be drawn entirely inside the cell bounding box or the clip area should be set before drawing.

Parameters
infoInformation on redraw event and item to be redrawn

Implemented in tbx::view::SpriteItemRenderer, tbx::view::WimpFontItemRenderer, tbx::view::IconItemRenderer, and tbx::view::FontItemRenderer.

◆ size()

virtual Size tbx::view::ItemRenderer::size ( unsigned int  index) const
pure virtual

Called to get the size of the item.

Should return the equivalent of Size(width(index), height(index))

Implemented in tbx::view::SpriteItemRenderer, tbx::view::WimpFontItemRenderer, tbx::view::IconItemRenderer, and tbx::view::FontItemRenderer.


The documentation for this class was generated from the following file: