## GdaGraph

GdaGraph — Data model to keep graphs' layout

## Synopsis

                        GdaGraph;
    enum                GdaGraphType;
    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);

## Object Hierarchy

      GObject
       +----GdaObject
             +----GdaGraph
                   +----GdaGraphQuery

## Implemented Interfaces

GdaGraph implements GdaXmlStorage.

## Properties

      "graph-type"               gint                  : Read / Write
      "ref-object"               GdaObject*            : Read / Write

## Signals

      "item-added"                                     : Run First
      "item-dropped"                                   : Run First
      "item-moved"                                     : Run First

## 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 _GdaGraph GdaGraph;

### enum GdaGraphType

    typedef enum {
            GDA_GRAPH_DB_RELATIONS,
    	GDA_GRAPH_QUERY_JOINS,
            GDA_GRAPH_MODELLING /* for future extensions */
    } GdaGraphType;

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

## Property Details

### The `"graph-type"` property

      "graph-type"               gint                  : Read / Write

Allowed values: >= 1

Default value: 1

### The `"ref-object"` property

      "ref-object"               GdaObject*            : Read / Write

## Signal Details

### The `"item-added"` signal

    void                user_function                      (GdaGraph     *gdagraph,
                                                            GdaGraphItem *arg1,
                                                            gpointer      user_data)      : Run First

`gdagraph` : | 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                      (GdaGraph     *gdagraph,
                                                            GdaGraphItem *arg1,
                                                            gpointer      user_data)      : Run First

`gdagraph` : | 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                      (GdaGraph     *gdagraph,
                                                            GdaGraphItem *arg1,
                                                            gpointer      user_data)      : Run First

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