## GnomeDbGrid

GnomeDbGrid — Database grid widget

##

# Synopsis

    struct      GnomeDbGridPrivate;
    void        (*GnomeDbGridForeachFunc)       (GnomeDbGrid *grid,
                                                 gint row,
                                                 gpointer user_data);
    GtkWidget*  gnome_db_grid_new               (void);
    GtkWidget*  gnome_db_grid_new_with_model    (GdaDataModel *model);
    const gchar* gnome_db_grid_get_title        (GnomeDbGrid *grid);
    void        gnome_db_grid_set_title         (GnomeDbGrid *grid,
                                                 const gchar *title);
    void        gnome_db_grid_set_column_title  (GnomeDbGrid *grid,
                                                 gint col,
                                                 const gchar *title);
    const gchar* gnome_db_grid_get_column_title (GnomeDbGrid *grid,
                                                 gint col);
    gboolean    gnome_db_grid_get_show_title    (GnomeDbGrid *grid);
    void        gnome_db_grid_set_show_title    (GnomeDbGrid *grid,
                                                 gboolean show);
    void        gnome_db_grid_set_title_icon_from_file
                                                (GnomeDbGrid *grid,
                                                 const gchar *file);
    void        gnome_db_grid_set_title_icon_from_stock
                                                (GnomeDbGrid *grid,
                                                 const gchar *stock_id,
                                                 GtkIconSize size);
    void        gnome_db_grid_set_show_title_icon
                                                (GnomeDbGrid *grid,
                                                 gboolean show);
    gboolean    gnome_db_grid_get_show_title_icon
                                                (GnomeDbGrid *grid);
    GdaDataModel* gnome_db_grid_get_model       (GnomeDbGrid *grid);
    void        gnome_db_grid_set_model         (GnomeDbGrid *grid,
                                                 GdaDataModel *model);
    GList*      gnome_db_grid_get_selection     (GnomeDbGrid *grid);
    void        gnome_db_grid_foreach_selected  (GnomeDbGrid *grid,
                                                 GnomeDbGridForeachFunc foreach_func,
                                                 gpointer user_data);
    void        gnome_db_grid_select_row        (GnomeDbGrid *grid,
                                                 gint row);
    void        gnome_db_grid_select_all        (GnomeDbGrid *grid);
    void        gnome_db_grid_unselect_all      (GnomeDbGrid *grid);
    GtkSelectionMode gnome_db_grid_get_selection_mode
                                                (GnomeDbGrid *grid);
    void        gnome_db_grid_set_selection_mode
                                                (GnomeDbGrid *grid,
                                                 GtkSelectionMode mode);
    void        gnome_db_grid_set_column_titles_visible
                                                (GnomeDbGrid *grid,
                                                 gboolean visible);
    gboolean    gnome_db_grid_get_column_titles_visible
                                                (GnomeDbGrid *grid);
    #define     gnome_db_grid_show_column_titles(grid)
    #define     gnome_db_grid_hide_column_titles(grid)
    void        gnome_db_grid_set_column_visible
                                                (GnomeDbGrid *grid,
                                                 gint col,
                                                 gboolean visible);
    gboolean    gnome_db_grid_get_column_visible
                                                (GnomeDbGrid *grid,
                                                 gint col);
    gpointer    gnome_db_grid_get_row_data      (GnomeDbGrid *grid,
                                                 gint row);
    void        gnome_db_grid_set_row_data      (GnomeDbGrid *grid,
                                                 gint row,
                                                 gpointer data);
    gint        gnome_db_grid_find_row_from_data
                                                (GnomeDbGrid *grid,
                                                 gpointer data);

## Description

## Details

### struct GnomeDbGridPrivate

    struct GnomeDbGridPrivate;

### GnomeDbGridForeachFunc ()

    void        (*GnomeDbGridForeachFunc)       (GnomeDbGrid *grid,
                                                 gint row,
                                                 gpointer user_data);

`grid` : |
`row` : |
`user_data` : |

### gnome_db_grid_new ()

    GtkWidget*  gnome_db_grid_new               (void);

Create a GnomeDbGrid.

Returns : | a GtkWidget widget.

### gnome_db_grid_new_with_model ()

    GtkWidget*  gnome_db_grid_new_with_model    (GdaDataModel *model);

Create a GnomeDbGrid with a GdaDataModel.

`model` : | a GdaDataModel variable.
Returns : | a GtkWidget widget.

### gnome_db_grid_get_title ()

    const gchar* gnome_db_grid_get_title        (GnomeDbGrid *grid);

Get the title for the given grid.

`grid` : | a GnomeDbGrid widget.
Returns : | the title associated with the grid.

### gnome_db_grid_set_title ()

    void        gnome_db_grid_set_title         (GnomeDbGrid *grid,
                                                 const gchar *title);

Set the title for the given grid.

`grid` : | a GnomeDbGrid widget.
`title` : | new title.

### gnome_db_grid_set_column_title ()

    void        gnome_db_grid_set_column_title  (GnomeDbGrid *grid,
                                                 gint col,
                                                 const gchar *title);

Sets the title for a column

`grid` : | a GnomeDbGrid widget
`col` : | the number of the column to change the title
`title` : | the new title for this column

### gnome_db_grid_get_column_title ()

    const gchar* gnome_db_grid_get_column_title (GnomeDbGrid *grid,
                                                 gint col);

Get the title of a column

`grid` : | a GnomeDbGrid widget
`col` : | the number of the column to get the title
Returns : | the title of a column.

### gnome_db_grid_get_show_title ()

    gboolean    gnome_db_grid_get_show_title    (GnomeDbGrid *grid);

Get whether the title is being shown for the given grid.

`grid` : | a GnomeDbGrid widget.
Returns : | TRUE if the title is shown, FALSE if not.

### gnome_db_grid_set_show_title ()

    void        gnome_db_grid_set_show_title    (GnomeDbGrid *grid,
                                                 gboolean show);

Set the title displaying mode for the given grid.

`grid` : | a GnomeDbGrid widget.
`show` : | whether to show the title or not.

### gnome_db_grid_set_title_icon_from_file ()

    void        gnome_db_grid_set_title_icon_from_file
                                                (GnomeDbGrid *grid,
                                                 const gchar *file);

Set the icon for the given grid.

`grid` : | a GnomeDbGrid widget.
`file` : | image filename.

### gnome_db_grid_set_title_icon_from_stock ()

    void        gnome_db_grid_set_title_icon_from_stock
                                                (GnomeDbGrid *grid,
                                                 const gchar *stock_id,
                                                 GtkIconSize size);

Set the icon using a stock icon for the given grid.

`grid` : | a GnomeDbGrid widget.
`stock_id` : | a stock icon name.
`size` : | a stock icon size.

### gnome_db_grid_set_show_title_icon ()

    void        gnome_db_grid_set_show_title_icon
                                                (GnomeDbGrid *grid,
                                                 gboolean show);

Set the icon displaying mode for the given grid.

`grid` : | a GnomeDbGrid widget.
`show` : | whether to show the icon or not.

### gnome_db_grid_get_show_title_icon ()

    gboolean    gnome_db_grid_get_show_title_icon
                                                (GnomeDbGrid *grid);

Get whether the icon is being shown for the given grid.

`grid` : | a GnomeDbGrid widget.
Returns : | TRUE if the icon is shown, FALSE if not.

### gnome_db_grid_get_model ()

    GdaDataModel* gnome_db_grid_get_model       (GnomeDbGrid *grid);

Retrieve the GdaDataModel associated with this GnomeDbGrid.

`grid` : | a GnomeDbGrid widget.
Returns : | a GdaDataModel widget.

### gnome_db_grid_set_model ()

    void        gnome_db_grid_set_model         (GnomeDbGrid *grid,
                                                 GdaDataModel *model);

Set the new model for the given grid.

`grid` : | a GnomeDbGrid widget.
`model` : | a GdaDataModel widget.

### gnome_db_grid_get_selection ()

    GList*      gnome_db_grid_get_selection     (GnomeDbGrid *grid);

Returns the list of the currently selected rows in a GnomeDbGrid widget. The returned value is a list of integers, which represent each of the selected rows.

`grid` : | a GnomeDbGrid widget.
Returns : | a GList of integers. This list should be freed (by calling g_list_free) when no longer needed.

### gnome_db_grid_foreach_selected ()

    void        gnome_db_grid_foreach_selected  (GnomeDbGrid *grid,
                                                 GnomeDbGridForeachFunc foreach_func,
                                                 gpointer user_data);

Call the given function for each selected row in the GnomeDbGrid widget.

`grid` : | a GnomeDbGrid widget.
`foreach_func` : | function to be called for each selected row.
`user_data` : | data to pass over to `foreach_func`.

### gnome_db_grid_select_row ()

    void        gnome_db_grid_select_row        (GnomeDbGrid *grid,
                                                 gint row);

Select the given row in the GnomeDbGrid widget.

`grid` : | a GnomeDbGrid widget.
`row` : | the number of the row to be selected.

### gnome_db_grid_select_all ()

    void        gnome_db_grid_select_all        (GnomeDbGrid *grid);

Select all rows in the GnomeDbGrid widget.

`grid` : | a GnomeDbGrid widget.

### gnome_db_grid_unselect_all ()

    void        gnome_db_grid_unselect_all      (GnomeDbGrid *grid);

Unselect all rows of the GnomeDbGrid widget.

`grid` : | a GnomeDbGrid widget.

### gnome_db_grid_get_selection_mode ()

    GtkSelectionMode gnome_db_grid_get_selection_mode
                                                (GnomeDbGrid *grid);

Retrieve the selection mode of a GnomeDbGrid widget.

`grid` : | a GnomeDbGrid widget.
Returns : | a GtkSelectionMode widget.

### gnome_db_grid_set_selection_mode ()

    void        gnome_db_grid_set_selection_mode
                                                (GnomeDbGrid *grid,
                                                 GtkSelectionMode mode);

`grid` : |
`mode` : |

### gnome_db_grid_set_column_titles_visible ()

    void        gnome_db_grid_set_column_titles_visible
                                                (GnomeDbGrid *grid,
                                                 gboolean visible);

Hide or Show the titles of the GnomeDbGrid widget.

`grid` : | a GnomeDbGrid widget.
`visible` : | a gboolean.

### gnome_db_grid_get_column_titles_visible ()

    gboolean    gnome_db_grid_get_column_titles_visible
                                                (GnomeDbGrid *grid);

Retrieve a gboolean ( TRUE or FALSE ).

`grid` : | a GnomeDbGrid widget.
Returns : |

### gnome_db_grid_show_column_titles()

    #define     gnome_db_grid_show_column_titles(grid)

`grid` : |

### gnome_db_grid_hide_column_titles()

    #define     gnome_db_grid_hide_column_titles(grid)

`grid` : |

### gnome_db_grid_set_column_visible ()

    void        gnome_db_grid_set_column_visible
                                                (GnomeDbGrid *grid,
                                                 gint col,
                                                 gboolean visible);

Hide or Show the column "col" of the GnomeDbGrid widget.

`grid` : | a GnomeDbGrid widget.
`col` : | column number.
`visible` : | a gboolean.

### gnome_db_grid_get_column_visible ()

    gboolean    gnome_db_grid_get_column_visible
                                                (GnomeDbGrid *grid,
                                                 gint col);

Retrieve a gboolean ( TRUE or FALSE ).

`grid` : | a GnomeDbGrid widget.
`col` : | column number.
Returns : |

### gnome_db_grid_get_row_data ()

    gpointer    gnome_db_grid_get_row_data      (GnomeDbGrid *grid,
                                                 gint row);

Get the data associated (see gnome_db_grid_set_row_data) with the given row.

`grid` : | a GnomeDbGrid widget.
`row` : | the row to retrieve data for.
Returns : | the data associated with the given row.

### gnome_db_grid_set_row_data ()

    void        gnome_db_grid_set_row_data      (GnomeDbGrid *grid,
                                                 gint row,
                                                 gpointer data);

Associate a given data pointer with the given row in the grid widget. This allows you to store context-specific data for each row on the grid.

`grid` : | a GnomeDbGrid widget.
`row` : | the row to set the data for.
`data` : | the data.

### gnome_db_grid_find_row_from_data ()

    gint        gnome_db_grid_find_row_from_data
                                                (GnomeDbGrid *grid,
                                                 gpointer data);

Find the row number for the row to which the given data is associated.

`grid` : | a GnomeDbGrid widget.
`data` : | data to search for.
Returns : | the row number if found, or -1 if not.