GdauiDataSelector

## GdauiDataSelector GdauiDataSelector — Selecting data in a GdaDataModel |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        GdauiDataSelector;
    GdaDataModel *      gdaui_data_selector_get_model       (GdauiDataSelector *iface);
    void                gdaui_data_selector_set_model       (GdauiDataSelector *iface,
                                                             GdaDataModel *model);
    GArray *            gdaui_data_selector_get_selected_rows
                                                            (GdauiDataSelector *iface);
    GdaDataModelIter *  gdaui_data_selector_get_data_set    (GdauiDataSelector *iface);
    gboolean            gdaui_data_selector_select_row      (GdauiDataSelector *iface,
                                                             gint row);
    void                gdaui_data_selector_unselect_row    (GdauiDataSelector *iface,
                                                             gint row);
    void                gdaui_data_selector_set_column_visible
                                                            (GdauiDataSelector *iface,
                                                             gint column,
                                                             gboolean visible);

## Object Hierarchy

      GInterface
       +----GdauiDataSelector

## Prerequisites

GdauiDataSelector requires GObject.

## Known Implementations

GdauiDataSelector is implemented by GdauiCloud, GdauiCombo, GdauiForm, GdauiGrid, GdauiProviderSelector, GdauiRawForm and GdauiRawGrid.

## Signals

      "selection-changed"                              : Run First

## Description

The GdauiDataSelector interface is implemented by widgets which allow the user to select some data from a GdaDataModel. Depending on the actual widget, the selection can be a single row or more than one row.

This interface allows one to set and get the GdaDataModel from which data is to be selected and offers a few other common behaviours.

Please note that any row number in this interface is in reference to the GdaDataModel returned by the `gdaui_data_selector_get_model()` method.

## Details

### GdauiDataSelector

    typedef struct _GdauiDataSelector GdauiDataSelector;

### gdaui_data_selector_get_model ()

    GdaDataModel *      gdaui_data_selector_get_model       (GdauiDataSelector *iface);

Queries the GdaDataModel from which the data displayed by the widget implementing `iface` are. Beware that the returned data model may be different than the one used when the widget was created in case it internally uses a GdaDataProxy.

`iface` : | an object which implements the GdauiDataSelector interface
Returns : | the GdaDataModel. [transfer none]

Since 4.2

### gdaui_data_selector_set_model ()

    void                gdaui_data_selector_set_model       (GdauiDataSelector *iface,
                                                             GdaDataModel *model);

Sets the data model from which the data being displayed are. Also see `gdaui_data_selector_get_model()`

`iface` : | an object which implements the GdauiDataSelector interface
`model` : | a GdaDataModel to use

Since 4.2

### gdaui_data_selector_get_selected_rows ()

    GArray *            gdaui_data_selector_get_selected_rows
                                                            (GdauiDataSelector *iface);

Gat an array of selected rows. If no row is selected, the the returned value is `NULL`.

Please note that rows refers to the "visible" rows at the time it's being called, which may change if the widget implementing this interface uses a GdaDataProxy (as is the case for example for the GdauiRawForm, GdauiForm, GdauiRawGrid and GdauiGrid).

`iface` : | an object which implements the GdauiDataSelector interface
Returns : | an array of gint values, one for each selected row. Use `g_array_free()` when finished (passing `TRUE` as the last argument). [transfer full]

Since 4.2

### gdaui_data_selector_get_data_set ()

    GdaDataModelIter *  gdaui_data_selector_get_data_set    (GdauiDataSelector *iface);

Get the GdaDataModelIter object represented the current selected row in `iface`. This function may return either `NULL` or an invalid iterator (see `gda_data_model_iter_is_valid()`) if the selection cannot be represented by a single selected row.

Note that the returned GdaDataModelIter is actually an iterator iterating on the GdaDataModel returned by the `gdaui_data_selector_get_model()` method.

`iface` : | an object which implements the GdauiDataSelector interface
Returns : | a pointer to a GdaDataModelIter object, or `NULL`. [transfer none]

Since 4.2

### gdaui_data_selector_select_row ()

    gboolean            gdaui_data_selector_select_row      (GdauiDataSelector *iface,
                                                             gint row);

Force the selection of a specific row.

Please note that `row` refers to the "visible" row at the time it's being called, which may change if the widget implementing this interface uses a GdaDataProxy (as is the case for example for the GdauiRawForm, GdauiForm, GdauiRawGrid and GdauiGrid).

`iface` : | an object which implements the GdauiDataSelector interface
`row` : | the row to select
Returns : | `TRUE` if the row has been selected

Since 4.2

### gdaui_data_selector_unselect_row ()

    void                gdaui_data_selector_unselect_row    (GdauiDataSelector *iface,
                                                             gint row);

Please note that `row` refers to the "visible" row at the time it's being called, which may change if the widget implementing this interface uses a GdaDataProxy (as is the case for example for the GdauiRawForm, GdauiForm, GdauiRawGrid and GdauiGrid).

`iface` : | an object which implements the GdauiDataSelector interface
`row` : | the row to unselect

Since 4.2

### gdaui_data_selector_set_column_visible ()

    void                gdaui_data_selector_set_column_visible
                                                            (GdauiDataSelector *iface,
                                                             gint column,
                                                             gboolean visible);

Shows or hides the data at column `column`

`iface` : | an object which implements the GdauiDataSelector interface
`column` : | a column number, starting at `0`, or -1 tp apply to all the columns
`visible` : | required visibility of the data in the `column` column

Since 4.2

## Signal Details

### The `"selection-changed"` signal

    void                user_function                      (GdauiDataSelector *gdauidataselector,
                                                            gpointer           user_data)              : Run First