tbx  0.7.5
Public Member Functions | List of all members
tbx::view::FontItemRenderer Class Reference

ItemRenderer to render text with a given font in a fixed height. More...

#include <fontitemrenderer.h>

Inheritance diagram for tbx::view::FontItemRenderer:
tbx::view::TypedItemRenderer< std::string > tbx::view::ItemRenderer

Public Member Functions

 FontItemRenderer (tbx::view::ItemViewValue< std::string > *vv)
 Construct with object to give value to render. More...
 
 FontItemRenderer (tbx::Font font, ItemViewValue< std::string > *vv)
 Construct renderer with give font and object to give value to render. More...
 
tbx::Font font ()
 Get the font used to render an item.
 
void font (tbx::Font font)
 Set the font to render an item. More...
 
unsigned int height () const
 Get the height of the renderer. More...
 
void height (unsigned int height)
 Set the height of the renderer. More...
 
unsigned int baseline () const
 Get the font base line. More...
 
void baseline (unsigned int baseline)
 Set the font base line. More...
 
virtual void render (const ItemRenderer::Info &info)
 Render text in black using font set. More...
 
virtual unsigned int width (unsigned int index) const
 Used to measure the width of a column. More...
 
virtual unsigned int height (unsigned int index) const
 Get font row height. More...
 
virtual tbx::Size size (unsigned int index) const
 Called to get the size of the cell. More...
 
- Public Member Functions inherited from tbx::view::TypedItemRenderer< std::string >
 TypedItemRenderer (ItemViewValue< std::string > *vp)
 Construct the item view renderer. More...
 
- Public Member Functions inherited from tbx::view::ItemRenderer
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...
 

Additional Inherited Members

- Protected Attributes inherited from tbx::view::TypedItemRenderer< std::string >
ItemViewValue< std::string > * _value_provider
 Object to retrieve the value for a rendered.
 

Detailed Description

ItemRenderer to render text with a given font in a fixed height.

Constructor & Destructor Documentation

◆ FontItemRenderer() [1/2]

tbx::view::FontItemRenderer::FontItemRenderer ( tbx::view::ItemViewValue< std::string > *  vv)
inline

Construct with object to give value to render.

Parameters
vvobject that returns a string to render

◆ FontItemRenderer() [2/2]

tbx::view::FontItemRenderer::FontItemRenderer ( tbx::Font  font,
ItemViewValue< std::string > *  vv 
)
inline

Construct renderer with give font and object to give value to render.

Parameters
fontFont to use
vvobject that returns a string to render

Member Function Documentation

◆ baseline() [1/2]

unsigned int tbx::view::FontItemRenderer::baseline ( ) const
inline

Get the font base line.

Returns
position above the bottom of the item for the text baseline

◆ baseline() [2/2]

void tbx::view::FontItemRenderer::baseline ( unsigned int  baseline)
inline

Set the font base line.

Parameters
baselinenew font base line. Not checked so invalid values could cause display problems.

◆ font()

void tbx::view::FontItemRenderer::font ( tbx::Font  font)

Set the font to render an item.

Also sets the height and baseline

Parameters
fontfont to use

◆ height() [1/3]

unsigned int tbx::view::FontItemRenderer::height ( ) const
inline

Get the height of the renderer.

Returns
height of the renderer

◆ height() [2/3]

void tbx::view::FontItemRenderer::height ( unsigned int  height)
inline

Set the height of the renderer.

Parameters
heightthe new height. This is not checked so should be larger than the tallest character

◆ height() [3/3]

virtual unsigned int tbx::view::FontItemRenderer::height ( unsigned int  index) const
inlinevirtual

Get font row height.

Parameters
index(unused in this renderer)

Implements tbx::view::ItemRenderer.

◆ render()

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

Render text in black using font set.

Parameters
infoInformation on what to render and where

Implements tbx::view::ItemRenderer.

◆ size()

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

Called to get the size of the cell.

Parameters
indexzero based index of item to get the size for

Implements tbx::view::ItemRenderer.

◆ width()

unsigned int tbx::view::FontItemRenderer::width ( unsigned int  index) const
virtual

Used to measure the width of a column.

Parameters
indexzero based index of item to get the width for

Implements tbx::view::ItemRenderer.


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