GdaGraph

## GdaGraph GdaGraph — Data model to keep graphs' layout |

## Synopsis

                GdaGraph;
    GObject*    gda_graph_new                   (GdaDict *dict,
                                                 GdaGraphType type);
    GdaGraphType gda_graph_get_graph_type       (GdaGraph *graph);
    GSList*     gda_graph_get_items             (GdaGraph *graph);
    GdaGraphItem* gda_graph_get_item_from_obj   (GdaGraph *graph,
                                                 GdaObject *ref_obj,
                                                 gboolean create_if_needed);
    void        gda_graph_add_item              (GdaGraph *graph,
                                                 GdaGraphItem *item);
    void        gda_graph_del_item              (GdaGraph *graph,
                                                 GdaGraphItem *item);

## 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 GdaObject object using the "ref_object" property. If the referenced object is destroyed, then the graph object will also automaticallu be destroyed.

## Details

### GdaGraph

    typedef struct {
    	GdaObject         object;
    	GdaGraphPrivate  *priv;
    } GdaGraph;

### gda_graph_new ()

    GObject*    gda_graph_new                   (GdaDict *dict,
                                                 GdaGraphType type);

Creates a new GdaGraph 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 GdaDict object
`type` : | the graph type (one of GdaGraphType)
Returns : | the newly created object

### gda_graph_get_graph_type ()

    GdaGraphType gda_graph_get_graph_type       (GdaGraph *graph);

Get the graph type of `graph`.

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

### gda_graph_get_items ()

    GSList*     gda_graph_get_items             (GdaGraph *graph);

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

`graph` : | a GdaGraph object
Returns : | a new list of GdaGraphItem objects

### gda_graph_get_item_from_obj ()

    GdaGraphItem* gda_graph_get_item_from_obj   (GdaGraph *graph,
                                                 GdaObject *ref_obj,
                                                 gboolean create_if_needed);

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

`graph` : | a GdaGraph object
`ref_obj` : | the GdaObject the returned item references
`create_if_needed` : |
Returns : | the GdaGraphItem object, or `NULL` if not found

### gda_graph_add_item ()

    void        gda_graph_add_item              (GdaGraph *graph,
                                                 GdaGraphItem *item);

Adds `item` to `graph`.

`graph` : | a GdaGraph object
`item` : | a GdaGraphItem object

### gda_graph_del_item ()

    void        gda_graph_del_item              (GdaGraph *graph,
                                                 GdaGraphItem *item);

Removes `item` from `graph`

`graph` : | a GdaGraph object
`item` : | a GdaGraphItem object