gccv::Canvas Class Reference

the Canvas class More...

#include <gccv/canvas.h>

List of all members.

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)

Detailed Description

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.

Definition at line 53 of file canvas.h.


Constructor & Destructor Documentation

gccv::Canvas::Canvas ( Client *  client  ) 
Parameters:
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 gccv::Canvas::~Canvas (  )  [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:

        gtk_widget_destroy (canvas->GetWidget ());

Items are stored in an ordered tree whose top node is a gccv::Group instance which can be accessed by the GetRoot() method.


Member Function Documentation

Item* gccv::Canvas::GetItemAt ( double  x,
double  y 
)
Parameters:
x the x coordiante.
y the y coordinate.

Used to get the top item at or near the given position.

Returns:
the found item or NULL if no item is nearer than the current gap from the given position.
GtkWidget* gccv::Canvas::GetWidget (  )  [inline]
Returns:
the widget used by the canvas.

Definition at line 89 of file canvas.h.

void gccv::Canvas::Invalidate ( double  x0,
double  y0,
double  x1,
double  y1 
)
Parameters:
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 
)
Parameters:
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  ) 
Parameters:
color a GOColor.

Sets the background color for the canvas widget

void gccv::Canvas::SetZoom ( double  zoom  ) 
Parameters:
zoom the new zoom level.

Sets the zoom level for the canvas.


The documentation for this class was generated from the following file:
Generated on Tue Apr 13 14:55:02 2010 for The Gnome Chemistry Utils by  doxygen 1.6.3