The Gnome Chemistry Utils
0.14.0
|
The base class for the canvas contents. More...
#include <item.h>
Public Member Functions | |
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 double | Distance (double x, double y, Item **item) const |
virtual void | BuildPath (cairo_t *cr) const |
virtual void | Draw (cairo_t *cr, bool is_vector) const |
virtual bool | Draw (cairo_t *cr, double x0, double y0, double x1, double y1, bool is_vector) const |
virtual void | Move (double x, double y) |
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 |
Protected Member Functions | |
void | BoundsChanged () |
virtual void | UpdateBounds () |
Canvas const * | GetCanvas () const |
Protected Attributes | |
double | m_x0 |
double | m_y0 |
double | m_x1 |
double | m_y1 |
The base class for the canvas contents.
The Item class is the base class for everything that might be included inside the Canvas associated widget. If the item represents an object, it can be linked to it if the object derives from the ItemClient class. In that case, the client object is notified when an event occurs for the item.
gccv::Item::Item | ( | Canvas * | canvas | ) |
gccv::Item::Item | ( | Group * | parent, |
ItemClient * | client = NULL |
||
) |
parent | the Group to which the new Item will be added. |
client | the ItemClient for the new Item if any. |
Creates a new Item inside parent and sets client as its associated ItemClient.
|
virtual |
The destructor.
|
protected |
Must be called when the bounds have changed.
|
virtual |
cr | a cairo_t. |
Builds the cairo path corresponding to the Item bounds. Doesn't draw anything.
Reimplemented in gccv::Polygon.
|
virtual |
x | horizontal position |
y | vertical position |
item | where to store the Item. |
Evaluates an approximative distance between the point defined by (x,y) and the Item. A complex Item like a Group should set the nearest Item in item. Simple item just set themselves. return 0. when the point is inside the item, a reasonable small value when the point is near the Item, and a large value when far. Defult implementation returns G_MAXDOUBLE.
Reimplemented in gccv::Group, gccv::Rectangle, gccv::Leaf, gccv::Circle, gccv::Wedge, gccv::Polygon, gccv::Squiggle, gccv::Line, gccv::Arrow, gccv::PolyLine, and gccv::BezierArrow.
|
virtual |
cr | a cairo_t. |
is_vector | whether the cairo_t is a vectorial context. |
Draws Item to cr. is_vector might be used to enhance rendering in the case of a raster target. Derived classes should override at least one of the Draw() methods
Reimplemented in gccv::Text, gccv::Rectangle, gccv::Leaf, gccv::Circle, gccv::Wedge, gccv::Polygon, gccv::Squiggle, gccv::Line, gccv::Arrow, gccv::PolyLine, gccv::Hash, and gccv::BezierArrow.
|
virtual |
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 Item to cr, limiting the operations to the given rectangular region. is_vector might be used to enhance rendering in the case of a raster target. Derived classes should override at least one of the Draw() methods
Reimplemented in gccv::Group.
void gccv::Item::GetBounds | ( | double & | x0, |
double & | y0, | ||
double & | x1, | ||
double & | y1 | ||
) | const |
x0 | where to store the top left horizontal bound. |
y0 | where to store the top left vertical bound. |
x1 | where to store the bottom right horizontal bound. |
y1 | where to store the bottom right vertical bound. |
Retrieves the current bounds coordinate for the Item.
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inline |
void gccv::Item::Invalidate | ( | ) | const |
Invalidates the Item and force a redraw of the rectangular region defined by its bounds.
bool gccv::Item::IsTopLevel | ( | ) | const |
|
virtual |
x | the horizontal deplacement |
y | the vertical deplacement |
Moves the Item.
Reimplemented in gccv::Text, gccv::Group, gccv::Rectangle, gccv::Leaf, gccv::Polygon, gccv::Circle, gccv::Wedge, gccv::Squiggle, gccv::Line, gccv::PolyLine, and gccv::BezierArrow.
|
inline |
|
inline |
void gccv::Item::SetVisible | ( | bool | visible | ) |
|
protectedvirtual |
Updates Item::m_x0, Item::m_y0, Item::m_x1 and Item::m_y1. All derived classes should implement this method to set the bounds and call Item::UpdateBounds() when done.
Reimplemented in gccv::Group, gccv::Rectangle, gccv::Leaf, gccv::Polygon, gccv::Circle, gccv::Wedge, gccv::Squiggle, gccv::Line, gccv::PolyLine, gccv::Arrow, and gccv::BezierArrow.
|
protected |
|
protected |
|
protected |
|
protected |