## GnomeDbGraph

GnomeDbGraph — Data model to keep graphs' layout

##

# Synopsis

    struct      GnomeDbGraph;
    GType       gnome_db_graph_get_type         (void);
    GObject*    gnome_db_graph_new              (GnomeDbDict *dict,
                                                 GnomeDbGraphType type);
    GnomeDbGraphType gnome_db_graph_get_graph_type
                                                (GnomeDbGraph *graph);
    void        gnome_db_graph_add_item         (GnomeDbGraph *graph,
                                                 GnomeDbGraphItem *item);
    void        gnome_db_graph_del_item         (GnomeDbGraph *graph,
                                                 GnomeDbGraphItem *item);
    GnomeDbGraphItem* gnome_db_graph_get_item_from_obj
                                                (GnomeDbGraph *graph,
                                                 GnomeDbBase *ref_obj,
                                                 gboolean create_if_needed);
    GSList*     gnome_db_graph_get_items        (GnomeDbGraph *graph);

## Object Hierarchy

      GObject
       +----GnomeDbBase
             +----GnomeDbGraph
                   +----GnomeDbGraphQuery

## Implemented Interfaces

GnomeDbGraph implements GnomeDbXmlStorage.

## Properties

      "graph-type"           gint                 : Read / Write
      "ref-object"           gpointer             : Read / Write

## Signal Prototypes

    "item-added"
                void        user_function      (GnomeDbGraph *dbgraph,
                                                gpointer arg1,
                                                gpointer user_data);
    "item-dropped"
                void        user_function      (GnomeDbGraph *dbgraph,
                                                gpointer arg1,
                                                gpointer user_data);
    "item-moved"
                void        user_function      (GnomeDbGraph *dbgraph,
                                                gpointer arg1,
                                                gpointer user_data);

## Description

An instance of this object is required for each unique graph that is to be created. It is the "model" part of the graph. The "view" and "controler" parts are brought by the GnomeDbCanvas and associated widgets.

The graph can be "attached" to a specific GnomeDbBase object using the "ref_object" property. If the referenced object is destroyed, then the graph object will also automaticallu be destroyed.

## Details

### struct GnomeDbGraph

    struct GnomeDbGraph;

### gnome_db_graph_get_type ()

    GType       gnome_db_graph_get_type         (void);

Returns : |

### gnome_db_graph_new ()

    GObject*    gnome_db_graph_new              (GnomeDbDict *dict,
                                                 GnomeDbGraphType type);

Creates a new GnomeDbGraph object. The graph type is used only to be able to sort out the different types of graphs. It brings no special functionnality.

`dict` : | a GnomeDbDict object
`type` : | the graph type (one of GnomeDbGraphType)
Returns : | the newly created object

### gnome_db_graph_get_graph_type ()

    GnomeDbGraphType gnome_db_graph_get_graph_type
                                                (GnomeDbGraph *graph);

Get the graph type of `graph`.

`graph` : | a GnomeDbGraph object
Returns : | the type

### gnome_db_graph_add_item ()

    void        gnome_db_graph_add_item         (GnomeDbGraph *graph,
                                                 GnomeDbGraphItem *item);

Adds `item` to `graph`.

`graph` : | a GnomeDbGraph object
`item` : | a GnomeDbGraphItem object

### gnome_db_graph_del_item ()

    void        gnome_db_graph_del_item         (GnomeDbGraph *graph,
                                                 GnomeDbGraphItem *item);

Removes `item` from `graph`

`graph` : | a GnomeDbGraph object
`item` : | a GnomeDbGraphItem object

### gnome_db_graph_get_item_from_obj ()

    GnomeDbGraphItem* gnome_db_graph_get_item_from_obj
                                                (GnomeDbGraph *graph,
                                                 GnomeDbBase *ref_obj,
                                                 gboolean create_if_needed);

Get a pointer to a GnomeDbGraphItem item from the object is represents. If the searched GnomeDbGraphItem is not found and `create_if_needed` is TRUE, then a new GnomeDbGraphItem is created.

`graph` : | a GnomeDbGraph object
`ref_obj` : | the GnomeDbBase the returned item references
`create_if_needed` : |
Returns : | the GnomeDbGraphItem object, or `NULL` if not found

### gnome_db_graph_get_items ()

    GSList*     gnome_db_graph_get_items        (GnomeDbGraph *graph);

Get a list of GnomeDbGraphItem objects which are items of `graph`

`graph` : | a GnomeDbGraph object
Returns : | a new list of GnomeDbGraphItem objects

## Properties

"`graph-type`" (gint : Read / Write) |
"`ref-object`" (gpointer : Read / Write) |

## Signals

### The "item-added" signal

    void        user_function                  (GnomeDbGraph *dbgraph,
                                                gpointer arg1,
                                                gpointer user_data);

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

### The "item-dropped" signal

    void        user_function                  (GnomeDbGraph *dbgraph,
                                                gpointer arg1,
                                                gpointer user_data);

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

### The "item-moved" signal

    void        user_function                  (GnomeDbGraph *dbgraph,
                                                gpointer arg1,
                                                gpointer user_data);

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