## GnomeDbSelector

GnomeDbSelector — Individual selection of libgnomedb objects (data types, functions, ...)

##

# Synopsis

    struct      GnomeDbSelector;
    struct      GnomeDbSelectorPriv;
    enum        GnomeDbSelectorMode;
    enum        GnomeDbSelectorColumn;
    GType       gnome_db_selector_get_type      (void);
    GtkWidget*  gnome_db_selector_new           (GnomeDbDict *dict,
                                                 GObject *ref_object,
                                                 gulong mode,
                                                 gulong columns);
    void        gnome_db_selector_set_mode_columns
                                                (GnomeDbSelector *mgsel,
                                                 GObject *ref_object,
                                                 gulong mode,
                                                 gulong columns);
    gboolean    gnome_db_selector_set_selected_object
                                                (GnomeDbSelector *mgsel,
                                                 GObject *selection);
    void        gnome_db_selector_set_headers_visible
                                                (GnomeDbSelector *mgsel,
                                                 gboolean visible);
    void        gnome_db_selector_set_column_label
                                                (GnomeDbSelector *mgsel,
                                                 guint column,
                                                 const gchar *label);
    void        gnome_db_selector_expand_all    (GnomeDbSelector *mgsel);
    void        gnome_db_selector_collapse_all  (GnomeDbSelector *mgsel);
    GObject*    gnome_db_selector_get_selected_object
                                                (GnomeDbSelector *mgsel);
    GObject*    gnome_db_selector_get_selected_object_parent
                                                (GnomeDbSelector *mgsel);

## Object Hierarchy

      GObject
       +----GtkObject
             +----GtkWidget
                   +----GtkContainer
                         +----GtkBox
                               +----GtkVBox
                                     +----GnomeDbSelector

## Implemented Interfaces

GnomeDbSelector implements AtkImplementorIface.

## Signal Prototypes

    "selection-changed"
                void        user_function      (GnomeDbSelector *dbselector,
                                                GObject *arg1,
                                                gpointer user_data);

## Description

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 `gnome_db_selector_new()` function.

## Details

### struct GnomeDbSelector

    struct GnomeDbSelector;

### struct GnomeDbSelectorPriv

    struct GnomeDbSelectorPriv {

    	GnomeDbDict       *dict;
    	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;
    };

### enum GnomeDbSelectorMode

    typedef enum {
    	GNOME_DB_SELECTOR_DATA_TYPES  = 1 << 0,
    	GNOME_DB_SELECTOR_FUNCTIONS   = 1 << 1,
    	GNOME_DB_SELECTOR_AGGREGATES  = 1 << 2,
    	/* database structure */
    	GNOME_DB_SELECTOR_TABLES      = 1 << 3,
    	GNOME_DB_SELECTOR_FIELDS      = 1 << 5,
    	/* queries */
    	GNOME_DB_SELECTOR_QUERIES     = 1 << 4,
    	GNOME_DB_SELECTOR_TARGETS     = 1 << 6,
    	GNOME_DB_SELECTOR_JOINS       = 1 << 7,
    	GNOME_DB_SELECTOR_QVIS_FIELDS = 1 << 8,
    	GNOME_DB_SELECTOR_QALL_FIELDS = 1 << 9,
    	GNOME_DB_SELECTOR_SUB_QUERIES = 1 << 10,
    	GNOME_DB_SELECTOR_TARGETS_CTS = 1 << 13,
    	/* graphs */
    	GNOME_DB_SELECTOR_GRAPHS      = 1 << 11,
    	/* layouts */
    	GNOME_DB_SELECTOR_FORMS       = 1 << 12
    } GnomeDbSelectorMode;

### enum GnomeDbSelectorColumn

    typedef enum {
    	GNOME_DB_SELECTOR_COLUMN_OWNER        = 1 << 1,
    	GNOME_DB_SELECTOR_COLUMN_COMMENTS     = 1 << 2,
    	GNOME_DB_SELECTOR_COLUMN_TYPE         = 1 << 3,
    	GNOME_DB_SELECTOR_COLUMN_FIELD_LENGTH = 1 << 4,
    	GNOME_DB_SELECTOR_COLUMN_FIELD_NNUL   = 1 << 5,
    	GNOME_DB_SELECTOR_COLUMN_FIELD_DEFAULT= 1 << 6,
    	GNOME_DB_SELECTOR_COLUMN_QFIELD_VALUE = 1 << 7,
    	GNOME_DB_SELECTOR_COLUMN_QFIELD_TYPE  = 1 << 8
    } GnomeDbSelectorColumn;

### gnome_db_selector_get_type ()

    GType       gnome_db_selector_get_type      (void);

Returns : |

### gnome_db_selector_new ()

    GtkWidget*  gnome_db_selector_new           (GnomeDbDict *dict,
                                                 GObject *ref_object,
                                                 gulong mode,
                                                 gulong columns);

Creates a new GnomeDbSelector widget.

`ref_object` must be `NULL` if `mode` implies a list where the displayed items are all fetched from within `dict` (namely GNOME_DB_SELECTOR_DATA_TYPES, GNOME_DB_SELECTOR_FUNCTIONS, GNOME_DB_SELECTOR_AGGREGATES, GNOME_DB_SELECTOR_TABLES, GNOME_DB_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 GNOME_DB_SELECTOR_FIELDS (when not used in conjunction with GNOME_DB_SELECTOR_TABLES), GNOME_DB_SELECTOR_TARGETS, GNOME_DB_SELECTOR_JOINS, GNOME_DB_SELECTOR_QVIS_FIELDS, GNOME_DB_SELECTOR_QALL_FIELDS and GNOME_DB_SELECTOR_SUB_QUERIES (when not used in conjunction with GNOME_DB_SELECTOR_QUERIES).

`dict` : | a GnomeDbDict 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

### gnome_db_selector_set_mode_columns ()

    void        gnome_db_selector_set_mode_columns
                                                (GnomeDbSelector *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 `gnome_db_selector_new()` function.

The usage of the `ref_object` parameter is the same as for `gnome_db_selector_new()`.

`mgsel` : | a GnomeDbSelector 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

### gnome_db_selector_set_selected_object ()

    gboolean    gnome_db_selector_set_selected_object
                                                (GnomeDbSelector *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

### gnome_db_selector_set_headers_visible ()

    void        gnome_db_selector_set_headers_visible
                                                (GnomeDbSelector *mgsel,
                                                 gboolean visible);

Show or hide the headers.

`mgsel` : |
`visible` : |

### gnome_db_selector_set_column_label ()

    void        gnome_db_selector_set_column_label
                                                (GnomeDbSelector *mgsel,
                                                 guint column,
                                                 const gchar *label);

Sets the label of a column's header.

`mgsel` : |
`column` : |
`label` : |

### gnome_db_selector_expand_all ()

    void        gnome_db_selector_expand_all    (GnomeDbSelector *mgsel);

Recursively expands all nodes in the `mgsel` widget.

`mgsel` : |

### gnome_db_selector_collapse_all ()

    void        gnome_db_selector_collapse_all  (GnomeDbSelector *mgsel);

Recursively collapse all nodes in the `mgsel` widget.

`mgsel` : |

### gnome_db_selector_get_selected_object ()

    GObject*    gnome_db_selector_get_selected_object
                                                (GnomeDbSelector *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).

### gnome_db_selector_get_selected_object_parent ()

    GObject*    gnome_db_selector_get_selected_object_parent
                                                (GnomeDbSelector *mgsel);

FIXME

`mgsel` : |
Returns : |

## Signals

### The "selection-changed" signal

    void        user_function                  (GnomeDbSelector *dbselector,
                                                GObject *arg1,
                                                gpointer user_data);

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