Item with Item children.
More...
#include <group.h>
Public Member Functions |
| Group (Canvas *canvas) |
| Group (Canvas *canvas, double x, double y) |
| Group (Group *parent, ItemClient *client=NULL) |
| Group (Group *parent, double x, double y, ItemClient *client=NULL) |
virtual | ~Group () |
void | AddChild (Item *item) |
void | RemoveChild (Item *item) |
void | MoveToFront (Item *item) |
void | MoveToBack (Item *item) |
Item * | GetFirstChild (std::list< Item * >::iterator &it) |
Item * | GetNextChild (std::list< Item * >::iterator &it) |
void | AdjustBounds (double &x0, double &y0, double &x1, double &y1) const |
void | SetPosition (double x, double y) |
double | Distance (double x, double y, Item **item) const |
bool | Draw (cairo_t *cr, double x0, double y0, double x1, double y1, bool is_vector) const |
void | Move (double x, double y) |
| Item (Canvas *canvas) |
| Item (Group *parent, ItemClient *client=NULL) |
virtual | ~Item () |
void | GetBounds (double &x0, double &y0, double &x1, double &y1) const |
void | Invalidate () const |
void | SetVisible (bool visible) |
virtual void | BuildPath (cairo_t *cr) const |
virtual void | Draw (cairo_t *cr, bool is_vector) const |
bool | IsTopLevel () const |
void | SetClient (ItemClient *val) |
ItemClient * | GetClient (void) |
Group const * | GetParent (void) const |
bool | GetVisible (void) const |
void | SetOperator (cairo_operator_t val) |
cairo_operator_t | GetOperator (void) const |
Detailed Description
Item with Item children.
A Group is an Item grouping several children Item instances in a std::list. Children might also be Group items themselves so that it allows for a hierarchical tree if Item instances. The Canvas class owns a top level Group (see Canvas::GetRoot()) and all Item instances in the canvas are descendants of this root Group. The Group class owns a pair of coordinates, x and y, which are used to shift all the children.
Definition at line 46 of file group.h.
Constructor & Destructor Documentation
gccv::Group::Group |
( |
Canvas * |
canvas | ) |
|
- Parameters
-
Creates a new Group and sets it as a child of the root Group of canvas.
gccv::Group::Group |
( |
Canvas * |
canvas, |
|
|
double |
x, |
|
|
double |
y |
|
) |
| |
- Parameters
-
canvas | a Canvas. |
x | the horizontal group shift. |
y | the vertical group shift. |
Creates a new Group at (x, y) and sets it as a child of the root Group of canvas.
- Parameters
-
Creates a new Group inside parent and sets client as its associated ItemClient.
gccv::Group::Group |
( |
Group * |
parent, |
|
|
double |
x, |
|
|
double |
y, |
|
|
ItemClient * |
client = NULL |
|
) |
| |
- Parameters
-
parent | the Group to which the new Group will be added. |
x | the horizontal group shift. |
y | the vertical group shift. |
client | the ItemClient for the new Group if any. |
Creates a new Group at (x, y) inside parent and sets client as its associated ItemClient.
virtual gccv::Group::~Group |
( |
| ) |
|
|
virtual |
The destructor. When a Group is destroyed, all its children are destroyed too.
Member Function Documentation
void gccv::Group::AddChild |
( |
Item * |
item | ) |
|
- Parameters
-
Adds item to the children list so that it will be displayed first, and so will appear under other overlapping children. To add an Item on top all other children, use thius method and then Group::MoveToFront().
void gccv::Group::AdjustBounds |
( |
double & |
x0, |
|
|
double & |
y0, |
|
|
double & |
x1, |
|
|
double & |
y1 |
|
) |
| const |
- Parameters
-
x0 | the top left horizontal bound to adjust. |
y0 | the top left vertical bound to adjust. |
x1 | the bottom right horizontal bound to adjust. |
y1 | the bottom right top left vertical to adjustw. |
Adjusts the parameters according to the shift values. This allows to evaluate the absolute position of an Item inside the Canvas.
double gccv::Group::Distance |
( |
double |
x, |
|
|
double |
y, |
|
|
Item ** |
item |
|
) |
| const |
|
virtual |
- Parameters
-
x | horizontal position |
y | vertical position |
item | where to store the nearest Item. |
Implementation of Item::Distance() for the Group class. Sets item to the descendant Item nearest to the given position.
Reimplemented from gccv::Item.
bool gccv::Group::Draw |
( |
cairo_t * |
cr, |
|
|
double |
x0, |
|
|
double |
y0, |
|
|
double |
x1, |
|
|
double |
y1, |
|
|
bool |
is_vector |
|
) |
| const |
|
virtual |
- Parameters
-
cr | a cairo_t. |
x0 | the top left horizontal bound of the region to draw. |
y0 | the top left vertical bound of the region to draw. |
x1 | the bottom right horizontal bound of the region to draw. |
y1 | the bottom right top left vertical bound of the region to draw. |
is_vector | whether the cairo_t is a vectorial context. |
Draws Group children to cr, limiting things to the given region.
Reimplemented from gccv::Item.
Item* gccv::Group::GetFirstChild |
( |
std::list< Item * >::iterator & |
it | ) |
|
- Parameters
-
- Returns
- the first child Item. Actually, the one displayed first.
Item* gccv::Group::GetNextChild |
( |
std::list< Item * >::iterator & |
it | ) |
|
- Parameters
-
- Returns
- the next child Item if any.
void gccv::Group::Move |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
|
virtual |
- Parameters
-
x | the horizontal deplacement |
y | the vertical deplacement |
Moves the Group and hence all its descendants by changing the Group shift values.
Reimplemented from gccv::Item.
void gccv::Group::MoveToBack |
( |
Item * |
item | ) |
|
- Parameters
-
Changes the Item position in the children list so that it is displayed first below other overlapping children.
void gccv::Group::MoveToFront |
( |
Item * |
item | ) |
|
- Parameters
-
Changes the Item position in the children list so that it is displayed last on top of other overlapping children.
void gccv::Group::RemoveChild |
( |
Item * |
item | ) |
|
- Parameters
-
Removes item to the children list but does not destroys it. item will not be displayed anymore unless it is added to a new Group.
void gccv::Group::SetPosition |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
- Parameters
-
x | the horizontal position |
y | the vertical position |
Sets the Group shift values.
void gccv::Group::UpdateBounds |
( |
| ) |
|
|
protectedvirtual |
The documentation for this class was generated from the following file: