![]() | ![]() | ![]() | Libmergeant Reference Manual | ![]() |
---|
MgGraphMgGraph — Data model to keep graphs' layout |
MgGraph; enum MgGraphType; guint mg_graph_get_type (void); GObject* mg_graph_new (MgConf *conf, MgGraphType type); MgGraphType mg_graph_get_graph_type (MgGraph *graph); void mg_graph_add_item (MgGraph *graph, MgGraphItem *item); void mg_graph_del_item (MgGraph *graph, MgGraphItem *item); MgGraphItem* mg_graph_get_item_from_obj (MgGraph *graph, MgBase *ref_obj, gboolean create_if_needed); GSList* mg_graph_get_items (MgGraph *graph);
"item-added" void user_function (MgGraph *mggraph, gpointer arg1, gpointer user_data); "item-dropped" void user_function (MgGraph *mggraph, gpointer arg1, gpointer user_data); "item-moved" void user_function (MgGraph *mggraph, gpointer arg1, gpointer user_data);
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 MgCanvas and associated widgets.
typedef enum { MG_GRAPH_DB_RELATIONS, MG_GRAPH_QUERY_JOINS, MG_GRAPH_MODELLING /* for future extensions */ } MgGraphType;
MG_GRAPH_DB_RELATIONS | The graph represents a part (or all) of the database's relations between tables |
MG_GRAPH_QUERY_JOINS | The graph represents the joins between several targets in a query |
MG_GRAPH_MODELLING | The graph is a ERD modelling graph (not yet implemented...) |
GObject* mg_graph_new (MgConf *conf, MgGraphType type);
Creates a new MgGraph object. The graph type is used only to be able to sort out the different types of graphs. It brings no special functionnality.
conf : | a MgConf object |
type : | the graph type (one of MgGraphType) |
Returns : | the newly created object |
MgGraphType mg_graph_get_graph_type (MgGraph *graph);
Get the graph type of graph.
graph : | a MgGraph object |
Returns : | the type |
void mg_graph_add_item (MgGraph *graph, MgGraphItem *item);
Adds item to graph.
graph : | a MgGraph object |
item : | a MgGraphItem object |
void mg_graph_del_item (MgGraph *graph, MgGraphItem *item);
Removes item from graph
graph : | a MgGraph object |
item : | a MgGraphItem object |
MgGraphItem* mg_graph_get_item_from_obj (MgGraph *graph, MgBase *ref_obj, gboolean create_if_needed);
Get a pointer to a MgGraphItem item from the object is represents. If the searched MgGraphItem is not found and create_if_needed is TRUE, then a new MgGraphItem is created.
graph : | a MgGraph object |
ref_obj : | the MgBase the returned item references |
create_if_needed : | |
Returns : | the MgGraphItem object, or NULL if not found |
GSList* mg_graph_get_items (MgGraph *graph);
Get a list of MgGraphItem objects which are items of graph
graph : | a MgGraph object |
Returns : | a new list of MgGraphItem objects |
void user_function (MgGraph *mggraph, gpointer arg1, gpointer user_data);
mggraph : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
void user_function (MgGraph *mggraph, gpointer arg1, gpointer user_data);
mggraph : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
void user_function (MgGraph *mggraph, gpointer arg1, gpointer user_data);
mggraph : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
<< Graphing objects and widgets | MgGraphItem >> |