| Libmergeant Reference Manual |
|---|
MgSelector — Individual selection of libmergeant objects (data types, functions, ...)
struct MgSelector; struct MgSelectorPriv; enum MgSelectorMode; enum MgSelectorColumn; guint mg_selector_get_type (void); GtkWidget* mg_selector_new (MgConf *conf, GObject *ref_object, gulong mode, gulong columns); void mg_selector_set_mode_columns (MgSelector *mgsel, GObject *ref_object, gulong mode, gulong columns); gboolean mg_selector_set_selected_object (MgSelector *mgsel, GObject *selection); void mg_selector_set_headers_visible (MgSelector *mgsel, gboolean visible); void mg_selector_set_column_label (MgSelector *mgsel, guint column, const gchar *label); GObject* mg_selector_get_selected_object (MgSelector *mgsel); GObject* mg_selector_get_selected_object_parent (MgSelector *mgsel);
GObject
+----GtkObject
+----GtkWidget
+----GtkContainer
+----GtkBox
+----GtkVBox
+----MgSelector
"selection-changed" void user_function (MgSelector *mgselector, GObject *arg1, gpointer user_data);
This widget presents the user with a (configurable) list of objects to choose from: Data types, functions, aggregates, ...
What really gets displayed in the widget (columns and rows) depends on the parameters passed to the mg_selector_new() function.
struct MgSelectorPriv {
MgConf *conf;
gulong mode;
gulong columns;
GObject *ref_object;
GtkTreeView *treeview;
gboolean headers_visible;
GtkTreeModel *model; /* we pocess a reference on the object */
GSList *modules; /* list of Module structures */
GObject *selection;
};
typedef enum {
MG_SELECTOR_DATA_TYPES = 1 << 0,
MG_SELECTOR_FUNCTIONS = 1 << 1,
MG_SELECTOR_AGGREGATES = 1 << 2,
/* database structure */
MG_SELECTOR_TABLES = 1 << 3,
MG_SELECTOR_FIELDS = 1 << 5,
/* queries */
MG_SELECTOR_QUERIES = 1 << 4,
MG_SELECTOR_TARGETS = 1 << 6,
MG_SELECTOR_JOINS = 1 << 7,
MG_SELECTOR_QVIS_FIELDS = 1 << 8,
MG_SELECTOR_QALL_FIELDS = 1 << 9,
MG_SELECTOR_SUB_QUERIES = 1 << 10,
MG_SELECTOR_TARGETS_CTS = 1 << 13,
/* graphs */
MG_SELECTOR_GRAPHS = 1 << 11,
/* layouts */
MG_SELECTOR_FORMS = 1 << 12
} MgSelectorMode;
Describes what objects the MgSelector widget will display
| MG_SELECTOR_DATA_TYPES | Displays the known data types. |
| MG_SELECTOR_FUNCTIONS | Displays all the functions, groupped by name for polymorphic functions. |
| MG_SELECTOR_AGGREGATES | Displays all the aggregates, groupped by name for polymorphic functions. |
| MG_SELECTOR_TABLES | Displays all the tables of the database. |
| MG_SELECTOR_FIELDS | Displays all the fields within each table (does nothing if not associated with MG_SELECTOR_TABLES). |
| MG_SELECTOR_QUERIES | |
| MG_SELECTOR_TARGETS | |
| MG_SELECTOR_JOINS | |
| MG_SELECTOR_QVIS_FIELDS | |
| MG_SELECTOR_QALL_FIELDS | |
| MG_SELECTOR_SUB_QUERIES | |
| MG_SELECTOR_TARGETS_CTS | |
| MG_SELECTOR_GRAPHS | |
| MG_SELECTOR_FORMS |
typedef enum {
MG_SELECTOR_COLUMN_OWNER = 1 << 1,
MG_SELECTOR_COLUMN_COMMENTS = 1 << 2,
MG_SELECTOR_COLUMN_TYPE = 1 << 3,
MG_SELECTOR_COLUMN_FIELD_LENGTH = 1 << 4,
MG_SELECTOR_COLUMN_FIELD_NNUL = 1 << 5,
MG_SELECTOR_COLUMN_FIELD_DEFAULT= 1 << 6,
MG_SELECTOR_COLUMN_QFIELD_VALUE = 1 << 7,
MG_SELECTOR_COLUMN_QFIELD_TYPE = 1 << 8
} MgSelectorColumn;
Used to specify which columns will be present in the MgSelector widget. The column for each object name is of course always present (1st column).
| MG_SELECTOR_COLUMN_OWNER | Column for the object's owner. |
| MG_SELECTOR_COLUMN_COMMENTS | Column for the description associated to the object. |
| MG_SELECTOR_COLUMN_TYPE | Column to show the object's type (only usefull for tables and table's fields). |
| MG_SELECTOR_COLUMN_FIELD_LENGTH | Column to show a table's field's length. |
| MG_SELECTOR_COLUMN_FIELD_NNUL | Column to show if a table's field has a NOT NULL constraint. |
| MG_SELECTOR_COLUMN_FIELD_DEFAULT | Column to show a table's field's default value. |
| MG_SELECTOR_COLUMN_QFIELD_VALUE | |
| MG_SELECTOR_COLUMN_QFIELD_TYPE |
GtkWidget* mg_selector_new (MgConf *conf, GObject *ref_object, gulong mode, gulong columns);
Creates a new MgSelector widget.
ref_object must be NULL if mode implies a list where the displayed items are all fetched from within conf (namely MG_SELECTOR_DATA_TYPES, MG_SELECTOR_FUNCTIONS, MG_SELECTOR_AGGREGATES, MG_SELECTOR_TABLES, MG_SELECTOR_QUERIES). In this case ref_object will simply be ignored.
ref_object cannot be NULL if mode implies a list where the displayed items depend on a specific object, namely MG_SELECTOR_FIELDS (when not used in conjunction with MG_SELECTOR_TABLES), MG_SELECTOR_TARGETS, MG_SELECTOR_JOINS, MG_SELECTOR_QVIS_FIELDS, MG_SELECTOR_QALL_FIELDS and MG_SELECTOR_SUB_QUERIES (when not used in conjunction with MG_SELECTOR_QUERIES).
| conf : | a MgConf object |
| ref_object : | a GObject object, or NULL if none is required |
| mode : | an OR'ed value of the possible items to display in the widget |
| columns : | an OR'ed value describing which columns will be displayed |
| Returns : | the new widget |
void mg_selector_set_mode_columns (MgSelector *mgsel, GObject *ref_object, gulong mode, gulong columns);
Changes what data gets displayed in mgsel and which columns are displayed. The mode and columns have the same meaning as for the mg_selector_new() function.
The usage of the ref_object parameter is the same as for mg_selector_new().
| mgsel : | a MgSelector widget |
| ref_object : | a GObject, or NULL |
| mode : | an OR'ed value of the possible items to display in the widget |
| columns : | an OR'ed value describing which columns will be displayed |
gboolean mg_selector_set_selected_object (MgSelector *mgsel, GObject *selection);
Force the widget to select a given object, and to display it in its visible area (unfolding nodes on the way if necessary)
| mgsel : | |
| selection : | |
| Returns : | TRUE if the specified object was found, and FALSE otherwise |
void mg_selector_set_headers_visible (MgSelector *mgsel, gboolean visible);
Show or hide the headers.
| mgsel : | |
| visible : |
void mg_selector_set_column_label (MgSelector *mgsel, guint column, const gchar *label);
Sets the label of a column's header.
| mgsel : | |
| column : | |
| label : |
GObject* mg_selector_get_selected_object (MgSelector *mgsel);
Get the currently selected object.
| mgsel : | |
| Returns : | the selected object or NULL if nothing is selected or the current selection is on a "category" of objects (such as the "Functions" category for example). |
GObject* mg_selector_get_selected_object_parent
(MgSelector *mgsel);FIXME
| mgsel : | |
| Returns : |
void user_function (MgSelector *mgselector, GObject *arg1, gpointer user_data);
| mgselector : | the object which received the signal. |
| arg1 : | |
| user_data : | user data set when the signal handler was connected. |
| << Widgets | MgWorkForm >> |