## GnomeDbCanvas

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

##

# Synopsis

    struct      GnomeDbCanvas;
    GdaGraph*   gnome_db_canvas_get_graph       (GnomeDbCanvas *canvas);
    void        gnome_db_canvas_declare_item    (GnomeDbCanvas *canvas,
                                                 GnomeDbCanvasItem *item);
    GtkWidget*  gnome_db_canvas_set_in_scrolled_window
                                                (GnomeDbCanvas *canvas);
    GnomeDbCanvasItem* gnome_db_canvas_get_item_for_object
                                                (GnomeDbCanvas *canvas,
                                                 GdaObject *ref_obj);
    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);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkLayout
                                     +----GnomeCanvas
                                           +----GnomeDbCanvas
                                                 +----GnomeDbCanvasDbRelations
                                                 +----GnomeDbCanvasQueryStruct

## Implemented Interfaces

GnomeDbCanvas implements AtkImplementorIface.

## Properties

      "graph"                gpointer             : Read / Write

## Signal Prototypes

    "drag-action"
                void        user_function      (GnomeDbCanvas *dbcanvas,
                                                gpointer arg1,
                                                gpointer arg2,
                                                gpointer user_data);

## 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

### struct GnomeDbCanvas

    struct GnomeDbCanvas;

### gnome_db_canvas_get_graph ()

    GdaGraph*   gnome_db_canvas_get_graph       (GnomeDbCanvas *canvas);

`canvas` : |
Returns : |

### 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_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 retreived using a "canvas" user property of the new scrolled window.

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

### gnome_db_canvas_get_item_for_object ()

    GnomeDbCanvasItem* gnome_db_canvas_get_item_for_object
                                                (GnomeDbCanvas *canvas,
                                                 GdaObject *ref_obj);

Get the GnomeDbCanvasItem corresponding to `obj`;

`canvas` : | a GnomeDbCanvas widget
`ref_obj` : |
Returns : |

### 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.

## Properties

"`graph`" (gpointer : Read / Write) |

## Signals

### The "drag-action" signal

    void        user_function                  (GnomeDbCanvas *dbcanvas,
                                                gpointer arg1,
                                                gpointer arg2,
                                                gpointer user_data);

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