The Gnome Chemistry Utils
0.14.0
|
#include <gccv/canvas.h>
Public Member Functions | |
Canvas (Client *client) | |
virtual | ~Canvas () |
Item * | GetItemAt (double x, double y) |
GtkWidget * | GetWidget () |
void | Invalidate (double x0, double y0, double x1, double y1) |
void | SetBackgroundColor (GOColor color) |
void | SetZoom (double zoom) |
void | Render (cairo_t *cr, bool is_vector) |
double | GetZoom (void) const |
Group * | GetRoot (void) const |
void | SetGap (double val) |
double | GetGap (void) const |
double & | GetRefGap (void) |
GOColor | GetColor (void) const |
GOColor | GetBackgroundColor (void) const |
unsigned | GetLastEventState (void) const |
the Canvas class
This class is the container class for the items and is the only one interacting with the underlying Gtk+ framework. It uses a private widget derived from GtkDrawingArea.
gccv::Canvas::Canvas | ( | Client * | client | ) |
client | the gccv::Client for the canvas or NULL. |
Constructs a canvas for client which is mandatory if some interaction with the canvas is needed.
|
virtual |
The destructor. You should not delete the canvas, as it will be destroyed with the enclosing widget. Instead, if you never show the widget in a window, use:
Items are stored in an ordered tree whose top node is a gccv::Group instance which can be accessed by the GetRoot() method.
|
inline |
|
inline |
|
inline |
Item* gccv::Canvas::GetItemAt | ( | double | x, |
double | y | ||
) |
x | the x coordiante. |
y | the y coordinate. |
Used to get the top item at or near the given position.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void gccv::Canvas::Invalidate | ( | double | x0, |
double | y0, | ||
double | x1, | ||
double | y1 | ||
) |
x0 | the x coordinate for the top left of the invalidated rectangle. |
y0 | the y coordinate for the top left of the scrolling rectangle. |
x1 | the x coordinate for the bottom right of the scrolling rectangle. |
y1 | the y coordinate for the bottom right of the scrolling rectangle. |
void gccv::Canvas::Render | ( | cairo_t * | cr, |
bool | is_vector | ||
) |
cr | a cairo context. |
is_vector | whether the cairo context is vectorial or raster. |
Renders the current canvas to the cairo context.
void gccv::Canvas::SetBackgroundColor | ( | GOColor | color | ) |
color | a GOColor. |
Sets the background color for the canvas widget
|
inline |
gap | a distance at which an item might be from an event location to be selected for the event. |
Sets the maximum distance at which an item might be from an event location to be selected for the event. When an even as a mouse button click occurs, and if it occurs on an item, the appropriate method of the item client will be called; else if it occurs on the background, the nearest item will be used if its distance from the event location is less than gap. If no item can be used, the event will have no associated gccv::ItemClient instance.
void gccv::Canvas::SetZoom | ( | double | zoom | ) |
zoom | the new zoom level. |
Sets the zoom level for the canvas.