![]() |
![]() |
![]() |
Libmergeant Reference Manual | ![]() |
---|---|---|---|---|
MgCanvasMgCanvas — Base class for all the GnomeCanvas derived widgets in libmergeant. |
MgCanvas; guint mg_canvas_get_type (void); MgGraph* mg_canvas_get_graph (MgCanvas *canvas); GtkWidget* mg_canvas_set_in_scrolled_window (MgCanvas *canvas); void mg_canvas_declare_item (MgCanvas *canvas, MgCanvasItem *item); MgCanvasItem* mg_canvas_get_item_for_object (MgCanvas *canvas, MgBase *ref_obj); void mg_canvas_set_zoom_factor (MgCanvas *canvas, gdouble n); gdouble mg_canvas_get_zoom_factor (MgCanvas *canvas); gdouble mg_canvas_fit_zoom_factor (MgCanvas *canvas);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkLayout +----GnomeCanvas +----MgCanvas +----MgCanvasDbRelations
"drag-action" void user_function (MgCanvas *mgcanvas, gpointer arg1, gpointer arg2, gpointer user_data) : Run first
This abstract class adds some basic functionnalities on top of the GnomeCanvas canvas such as:
synchronisation with a MgGraph object (to be able to save the position of each canvas item) and management of the list of items drawn on the canvas.
zoom settings
The MgCanvas widget can be used with or without any associated MgGraph object.
GtkWidget* mg_canvas_set_in_scrolled_window (MgCanvas *canvas);
Creates a new GtkScrolledWindow object and put canvas
in it. canvas
can be retreived using a "canvas" user property of
the new scrolled window.
canvas : |
a MgCanvas widget |
Returns : | the new scrolled window. |
void mg_canvas_declare_item (MgCanvas *canvas, MgCanvasItem *item);
Declares item
to be listed by canvas
as one of its items.
This functions should be called after each MgCanvasItem is added to
canvas
.
If it was not called for one item, then that item won't be used
in canvas
's computations (no drag and drop, cleanup, etc).
canvas : |
a MgCanvas widget |
item : |
a MgCanvasItem object |
MgCanvasItem* mg_canvas_get_item_for_object (MgCanvas *canvas, MgBase *ref_obj);
Get the MgCanvasItem corresponding to obj
;
canvas : |
a MgCanvas widget |
ref_obj : |
|
Returns : |
void mg_canvas_set_zoom_factor (MgCanvas *canvas, gdouble n);
Sets the zooming factor of a canvas by specifying the number of pixels that correspond to one canvas unit. A zoom factor of 1.0 is the default value; greater than 1.0 makes a zoom in and lower than 1.0 makes a zoom out.
canvas : |
a MgCanvas widget |
n : |
the zoom factor |
gdouble mg_canvas_get_zoom_factor (MgCanvas *canvas);
Get the current zooming factor of a canvas.
canvas : |
a MgCanvas widget |
Returns : | the zooming factor. |