tbx  0.7.6
Public Member Functions | List of all members
tbx::IconPainter Class Reference

Class to draw an icon in a redraw listener. More...

#include <iconpainter.h>

Inheritance diagram for tbx::IconPainter:
tbx::RedrawListener tbx::Listener

Public Member Functions

 IconPainter ()
 Construct an icon painter. More...
 
virtual ~IconPainter ()
 Icon painter destructor.
 
BBoxbounds ()
 Reference to the bounds of the icon. More...
 
const BBoxbounds () const
 return the bounds of the icon in work area coordinates
 
IconPaintertext (std::string text)
 Set the text for the icon painter. More...
 
IconPaintervalidation (std::string val)
 Set the validation string for the icon. More...
 
IconPaintersprite (std::string sprite)
 Set the sprite for the icon. More...
 
IconPaintersprite_area (SpriteArea *sprite_area)
 Set the sprite area to use for the icon. More...
 
IconPainteruse_wimp_sprite_area ()
 Use sprite from WIMP sprite pool. More...
 
IconPainteruse_client_sprite_area ()
 Use application client area for the sprite. More...
 
IconPaintertext_icon (bool t)
 Set icon as a text icon. More...
 
bool text_icon () const
 Check if this is a text icon.
 
IconPaintersprite_icon (bool s)
 Set icon as a sprite icon.
 
bool sprite_icon () const
 Check if this is a sprite icon.
 
IconPainterborder (bool f)
 Add a border to the icon.
 
IconPainterhcentred (bool f)
 Set horizontally centred flag. More...
 
IconPaintervcentred (bool f)
 Set vertically centred flag. More...
 
IconPainterfilled (bool f)
 Set filled flag. More...
 
IconPainterrjust (bool f)
 Set right justified flag. More...
 
IconPainterhalf_sprite (bool f)
 Set show sprite at half size flag. More...
 
IconPainterinverted (bool f)
 Set inverted flag. More...
 
IconPaintershaded (bool f)
 Set shaded flag. More...
 
IconPainterforeground (unsigned int col)
 Set foreground colour of sprite. More...
 
IconPainterbackground (unsigned int col)
 Set background colour of sprite. More...
 
IconPaintertext_and_sprite_left ()
 Text and sprite left justified, text at bottom, sprite at top for text and sprite icons.
 
IconPaintertext_and_sprite_right ()
 Text and sprite right justified, text at bottom, sprite at top for text and sprite icons.
 
IconPaintertext_12_sprite_left ()
 Sprite at left, text +12 units right of it, text and sprite vertically centred for text and sprite icons.
 
IconPaintertext_left_sprite_right ()
 text at left, sprite at right, text and sprite vertically centred for text and sprite icons.
 
IconPaintertext_and_sprite_centred ()
 text and sprite centred, text at bottom, sprite at top for text and sprite icons.
 
IconPaintertop_text_and_sprite_centred ()
 text and sprite centred text at top, sprite at bottom for text and sprite icons.
 
IconPainteron_top_text_and_sprite_centred ()
 text and sprite centred (text on top) text and sprite centred for text and sprite icons.
 
IconPaintertext_right_sprite_left ()
 text at right, sprite at left text and sprite centred for text and sprite icons.
 
virtual void redraw (const RedrawEvent &event)
 Redraw the icon.
 
- Public Member Functions inherited from tbx::Listener
virtual ~Listener ()
 Destroy the listener object.
 

Additional Inherited Members

- Protected Member Functions inherited from tbx::Listener
 Listener ()
 Construct the Listener object.
 

Detailed Description

Class to draw an icon in a redraw listener.

The IconPainter can either be added to the window directly as it is a RedrawListener or the redraw method can be called using the redraw parameter from another redraw listener for the window.

Constructor & Destructor Documentation

◆ IconPainter()

tbx::IconPainter::IconPainter ( )

Construct an icon painter.

By default the icon painter is set to wimp colour 7 on 0 with no content

Member Function Documentation

◆ background()

IconPainter& tbx::IconPainter::background ( unsigned int  col)
inline

Set background colour of sprite.

Parameters
colWimpColour for background

◆ bounds()

BBox& tbx::IconPainter::bounds ( )
inline

Reference to the bounds of the icon.

The bounds are in work area coordinates

◆ filled()

IconPainter& tbx::IconPainter::filled ( bool  f)
inline

Set filled flag.

Parameters
ftrue to fill the icon

◆ foreground()

IconPainter& tbx::IconPainter::foreground ( unsigned int  col)
inline

Set foreground colour of sprite.

Parameters
colWimpColour for foreground

◆ half_sprite()

IconPainter& tbx::IconPainter::half_sprite ( bool  f)
inline

Set show sprite at half size flag.

Parameters
ftrue to show the sprite half size

◆ hcentred()

IconPainter& tbx::IconPainter::hcentred ( bool  f)
inline

Set horizontally centred flag.

Parameters
ftrue to horizontally centre the icon

◆ inverted()

IconPainter& tbx::IconPainter::inverted ( bool  f)
inline

Set inverted flag.

Parameters
ftrue to show icon inverted

◆ rjust()

IconPainter& tbx::IconPainter::rjust ( bool  f)
inline

Set right justified flag.

Parameters
ftrue to right justify the icon

◆ shaded()

IconPainter& tbx::IconPainter::shaded ( bool  f)
inline

Set shaded flag.

Parameters
ftrue to show the icon shaded

◆ sprite()

IconPainter & tbx::IconPainter::sprite ( std::string  sprite)

Set the sprite for the icon.

Replaces the validiation string with the sprite name and sets the sprite_icon flag

◆ sprite_area()

IconPainter & tbx::IconPainter::sprite_area ( SpriteArea sprite_area)

Set the sprite area to use for the icon.

If the sprite area is set the icon can not display text as well.

Call use_wimp_sprite_area to reset.

◆ text()

IconPainter & tbx::IconPainter::text ( std::string  text)

Set the text for the icon painter.

This automatically sets the icon_text flag

◆ text_icon()

IconPainter& tbx::IconPainter::text_icon ( bool  t)
inline

Set icon as a text icon.

This flag is automatically set if you use the text method.

◆ use_client_sprite_area()

IconPainter & tbx::IconPainter::use_client_sprite_area ( )

Use application client area for the sprite.

Note: You can not display text as will for this icon type.

◆ use_wimp_sprite_area()

IconPainter & tbx::IconPainter::use_wimp_sprite_area ( )

Use sprite from WIMP sprite pool.

Text can also be shown if the sprite if from the WIMP sprite pool.

◆ validation()

IconPainter & tbx::IconPainter::validation ( std::string  val)

Set the validation string for the icon.

See the RISC OS PRM for details.

Note: This can replace the sprite if not set

◆ vcentred()

IconPainter& tbx::IconPainter::vcentred ( bool  f)
inline

Set vertically centred flag.

Parameters
ftrue to vertically centre the icon

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