Class to render an icon with text similar to the normal view in the filer.
More...
#include <iconitemrenderer.h>
|
| IconItemRenderer (ItemViewValue< std::string > *np, bool use_client=true) |
| Constructor for IconItemRenderer that uses the same value provider to give the text and sprite name. More...
|
|
| IconItemRenderer (ItemViewValue< std::string > *np, ItemViewValue< std::string > *sp, bool use_client=true) |
| Constructor for IconItemRenderer that uses the different value providers to give the text and sprite name. More...
|
|
virtual std::string | text (unsigned int index) const |
| Return the text for the icon. More...
|
|
virtual std::string | sprite_name (unsigned int index) const |
| Return the sprite name for the icon. More...
|
|
virtual bool | use_client_sprite_area (unsigned int index) const |
| Returns true to use the client sprite area to retrieve the sprite to display, or false for the wimp sprite area. More...
|
|
virtual void | render (const ItemRenderer::Info &info) |
| Called to render each item that needs drawing. More...
|
|
virtual unsigned int | width (unsigned int index) const |
| Return the width of the given item.
|
|
virtual unsigned int | height (unsigned int index) const |
| Return height of item.
|
|
virtual Size | size (unsigned int index) const |
| 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...
|
|
void | get_sprite_box (unsigned int index, const Size &size, BBox &sbox) const |
| Gets sprite box relative to bottom left corner.
|
|
void | get_text_box (unsigned int index, const Size &size, BBox &sbox) const |
| Get text box relative to bottom left corner.
|
|
| TypedItemRenderer (ItemViewValue< std::string > *vp) |
| Construct the item view renderer. More...
|
|
|
static tbx::Size | standard_size (unsigned int width=160, unsigned int sprite_height=68) |
| Return standard size for an icon with the given text width and sprite height. More...
|
|
Class to render an icon with text similar to the normal view in the filer.
i.e. An icon centered above some text.
Construct with ItemViewValue<std::string> value providers to the return the text and sprite name to render or derive from this class and override the text() and sprite_name() members.
tbx::view::IconItemRenderer::IconItemRenderer |
( |
bool |
use_client = true | ) |
|
|
protected |
Protected constructor for derived renderer which must provide the text() and sprite_name() overrides.
- Parameters
-
use_client | true to use client sprite area, false for wimp sprite area (default true) |
tbx::view::IconItemRenderer::IconItemRenderer |
( |
ItemViewValue< std::string > * |
np, |
|
|
bool |
use_client = true |
|
) |
| |
Constructor for IconItemRenderer that uses the same value provider to give the text and sprite name.
i.e. They are the same.
- Parameters
-
np | value provider to return the name used for the text and sprite |
use_client | true to use client sprite area, false for wimp sprite area (default true) |
tbx::view::IconItemRenderer::IconItemRenderer |
( |
ItemViewValue< std::string > * |
np, |
|
|
ItemViewValue< std::string > * |
sp, |
|
|
bool |
use_client = true |
|
) |
| |
Constructor for IconItemRenderer that uses the different value providers to give the text and sprite name.
- Parameters
-
np | value provider to return the text |
sp | value provider to return the sprite name |
use_client | true to use client sprite area, false for wimp sprite area (default true) |
bool tbx::view::IconItemRenderer::hit_test |
( |
unsigned int |
index, |
|
|
const Size & |
size, |
|
|
const Point & |
pos |
|
) |
| const |
|
virtual |
Check if the point given hits content of the cell rather then a margin or background.
- Parameters
-
index | index of item to check |
size | of area item is rendered in |
pos | location to check relative to bottom left of cell |
- Returns
- true if content is at that location, otherwise false
Reimplemented from tbx::view::ItemRenderer.
bool tbx::view::IconItemRenderer::intersects |
( |
unsigned int |
index, |
|
|
const Size & |
size, |
|
|
const BBox & |
box |
|
) |
| const |
|
virtual |
Check if the given rectangle intersects the content of the cell rather than a margin or background.
- Parameters
-
index | index of item to check |
size | of area item is rendered in |
box | box to check if it intersect the cell |
- Returns
- true if some contents are in the box, otherwise false
Reimplemented from tbx::view::ItemRenderer.
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
-
info | Information on redraw event and item to be redrawn |
Implements tbx::view::ItemRenderer.
Size tbx::view::IconItemRenderer::size |
( |
unsigned int |
index | ) |
const |
|
virtual |
Called to get the size of the item.
Should return the equivalent of Size(width(index), height(index))
Implements tbx::view::ItemRenderer.
std::string tbx::view::IconItemRenderer::sprite_name |
( |
unsigned int |
index | ) |
const |
|
virtual |
Return the sprite name for the icon.
By default uses the value provider from the constructor Override to get the value in a different way
tbx::Size tbx::view::IconItemRenderer::standard_size |
( |
unsigned int |
text_width = 160 , |
|
|
unsigned int |
sprite_height = 68 |
|
) |
| |
|
static |
Return standard size for an icon with the given text width and sprite height.
text_width width of text in os units. Defaults to 160 (approx 10 chars) sprite_height height of sprite in os units. Defaults to 68 (standard height in filer)
std::string tbx::view::IconItemRenderer::text |
( |
unsigned int |
index | ) |
const |
|
virtual |
Return the text for the icon.
By default uses the value provider from the constructor Override to get the value in a different way
virtual bool tbx::view::IconItemRenderer::use_client_sprite_area |
( |
unsigned int |
index | ) |
const |
|
inlinevirtual |
Returns true to use the client sprite area to retrieve the sprite to display, or false for the wimp sprite area.
default value is given in the constructor
Override if the location of the sprite can vary between the two
The documentation for this class was generated from the following files: