## GnomeDbCanvas GnomeDbCanvas — Base class for all the GnomeCanvas derived widgets in libgnomedb. |

## Synopsis

                        GnomeDbCanvas;
                        GnomeDbCanvasClass;
    GnomeDbGraph *      gnome_db_canvas_get_graph           (GnomeDbCanvas *canvas);
    GtkWidget *         gnome_db_canvas_set_in_scrolled_window
                                                            (GnomeDbCanvas *canvas);
    void                gnome_db_canvas_declare_item        (GnomeDbCanvas *canvas,
                                                             GnomeDbCanvasItem *item);
    void                gnome_db_canvas_set_zoom_factor     (GnomeDbCanvas *canvas,
                                                             gdouble n);
    gdouble             gnome_db_canvas_get_zoom_factor     (GnomeDbCanvas *canvas);
    gdouble             gnome_db_canvas_fit_zoom_factor     (GnomeDbCanvas *canvas);
    gboolean            gnome_db_canvas_auto_layout_enabled (GnomeDbCanvas *canvas);
    void                gnome_db_canvas_perform_auto_layout (GnomeDbCanvas *canvas,
                                                             gboolean animate,
                                                             GnomeDbCanvasLayoutAlgorithm algorithm);
    void                gnome_db_canvas_center              (GnomeDbCanvas *canvas);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GooCanvas
                                     +----GnomeDbCanvas

## Implemented Interfaces

GnomeDbCanvas implements GtkBuildable and AtkImplementorIface.

## Properties

      "graph"                    GnomeDbGraph*         : Read / Write

## Signals

      "drag-action"                                    : Run First

## Description

This abstract class adds some basic functionnalities on top of the GnomeCanvas canvas such as:

- synchronisation with a GdaGraph 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 GnomeDbCanvas widget can be used with or without any associated GdaGraph object.

## Details

### GnomeDbCanvas

    typedef struct _GnomeDbCanvas GnomeDbCanvas;

### GnomeDbCanvasClass

    typedef struct {
    	GooCanvasClass      parent_class;

    	/* virtual functions */
    	void           (*create_canvas_items) (GnomeDbCanvas *canvas); /* create individual GnomeDbCanvasItem objects */
    	void           (*clean_canvas_items)  (GnomeDbCanvas *canvas); /* clean any extra structure, not the individual items */

    	void           (*graph_item_added)    (GnomeDbCanvas *canvas, GnomeDbGraphItem *item);
    	void           (*graph_item_dropped)  (GnomeDbCanvas *canvas, GnomeDbGraphItem *item);

    	GtkWidget     *(*build_context_menu)  (GnomeDbCanvas *canvas);

    	/* signals */
    	void           (*drag_action)        (GnomeDbCanvas *canvas, GnomeDbCanvasItem *from_item, GnomeDbCanvasItem *to_item);
    } GnomeDbCanvasClass;

### gnome_db_canvas_get_graph ()

    GnomeDbGraph *      gnome_db_canvas_get_graph           (GnomeDbCanvas *canvas);

`canvas` : |
Returns : |

### gnome_db_canvas_set_in_scrolled_window ()

    GtkWidget *         gnome_db_canvas_set_in_scrolled_window
                                                            (GnomeDbCanvas *canvas);

Creates a new GtkScrolledWindow object and put `canvas` in it. `canvas` can be retrieved using a "canvas" user property of the new scrolled window.

`canvas` : | a GnomeDbCanvas widget
Returns : | the new scrolled window.

### gnome_db_canvas_declare_item ()

    void                gnome_db_canvas_declare_item        (GnomeDbCanvas *canvas,
                                                             GnomeDbCanvasItem *item);

Declares `item` to be listed by `canvas` as one of its items. This functions should be called after each GnomeDbCanvasItem 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 GnomeDbCanvas widget
`item` : | a GnomeDbCanvasItem object

### gnome_db_canvas_set_zoom_factor ()

    void                gnome_db_canvas_set_zoom_factor     (GnomeDbCanvas *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 GnomeDbCanvas widget
`n` : | the zoom factor

### gnome_db_canvas_get_zoom_factor ()

    gdouble             gnome_db_canvas_get_zoom_factor     (GnomeDbCanvas *canvas);

Get the current zooming factor of a canvas.

`canvas` : | a GnomeDbCanvas widget
Returns : | the zooming factor.

### gnome_db_canvas_fit_zoom_factor ()

    gdouble             gnome_db_canvas_fit_zoom_factor     (GnomeDbCanvas *canvas);

Compute and set the correct zoom factor so that all the items on `canvas` can be displayed at once.

`canvas` : | a GnomeDbCanvas widget
Returns : | the new zooming factor.

### gnome_db_canvas_auto_layout_enabled ()

    gboolean            gnome_db_canvas_auto_layout_enabled (GnomeDbCanvas *canvas);

Tells if `canvas` has the possibility to automatically adjust its layout using the GraphViz library.

`canvas` : | a GnomeDbCanvas widget
Returns : | TRUE if `canvas` can automatically adjust its layout

### gnome_db_canvas_perform_auto_layout ()

    void                gnome_db_canvas_perform_auto_layout (GnomeDbCanvas *canvas,
                                                             gboolean animate,
                                                             GnomeDbCanvasLayoutAlgorithm algorithm);

`canvas` : |
`animate` : |
`algorithm` : |

### gnome_db_canvas_center ()

    void                gnome_db_canvas_center              (GnomeDbCanvas *canvas);

Centers the display on the layout

`canvas` : | a GnomeDbCanvas widget

## Property Details

### The `"graph"` property

      "graph"                    GnomeDbGraph*         : Read / Write

## Signal Details

### The `"drag-action"` signal

    void                user_function                      (GnomeDbCanvas *dbcanvas,
                                                            gpointer       arg1,
                                                            gpointer       arg2,
                                                            gpointer       user_data)      : Run First

`dbcanvas` : | the object which received the signal.
`arg1` : |
`arg2` : |
`user_data` : | user data set when the signal handler was connected.