MgSelector

Name

MgSelector -- Individual selection of libmergeant objects (data types, functions, ...)

Synopsis



#define     MG_SELECTOR_TYPE
#define     MG_SELECTOR                     (obj)
#define     MG_SELECTOR_CLASS               (klass)
#define     IS_MG_SELECTOR                  (obj)
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);

Object Hierarchy


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

Implemented Interfaces

MgSelector implements AtkImplementorIface.

Signal Prototypes


"selection-changed"
            void        user_function      (MgSelector *mgselector,
                                            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 mg_selector_new() function.

Details

MG_SELECTOR_TYPE

#define MG_SELECTOR_TYPE          (mg_selector_get_type())


MG_SELECTOR()

#define MG_SELECTOR(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, mg_selector_get_type(), MgSelector)

obj :


MG_SELECTOR_CLASS()

#define MG_SELECTOR_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, mg_selector_get_type (), MgSelectorClass)

klass :


IS_MG_SELECTOR()

#define IS_MG_SELECTOR(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, mg_selector_get_type ())

obj :


struct MgSelector

struct MgSelector;


struct MgSelectorPriv

struct MgSelectorPriv;


enum MgSelectorMode

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,
} 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


enum MgSelectorColumn

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


mg_selector_get_type ()

guint       mg_selector_get_type            (void);

Returns :


mg_selector_new ()

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


mg_selector_set_mode_columns ()

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


mg_selector_set_selected_object ()

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


mg_selector_set_headers_visible ()

void        mg_selector_set_headers_visible (MgSelector *mgsel,
                                             gboolean visible);

Show or hide the headers.

mgsel :

visible :


mg_selector_set_column_label ()

void        mg_selector_set_column_label    (MgSelector *mgsel,
                                             guint column,
                                             const gchar *label);

Sets the label of a column's header.

mgsel :

column :

label :


mg_selector_get_selected_object ()

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).


mg_selector_get_selected_object_parent ()

GObject*    mg_selector_get_selected_object_parent
                                            (MgSelector *mgsel);

FIXME

mgsel :

Returns :

Signals

The "selection-changed" signal

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.