The Gnome Chemistry Utils  0.14.0
Macros | Typedefs | Functions
grid.h File Reference

Grid widget. More...

#include <gtk/gtk.h>

Go to the source code of this file.

Macros

#define GCR_TYPE_GRID   (gcr_grid_get_type ())
#define GCR_GRID(obj)   (G_TYPE_CHECK_INSTANCE_CAST((obj), GCR_TYPE_GRID, GcrGrid))
#define GCR_IS_GRID(obj)   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GCR_TYPE_GRID))

Typedefs

typedef void(* GridCb )(unsigned i, void *user_data)

Functions

GtkWidget * gcr_grid_new (char const *col_title, GType col_type,...)
int gcr_grid_get_int (GcrGrid *grid, unsigned row, unsigned column)
unsigned gcr_grid_get_uint (GcrGrid *grid, unsigned row, unsigned column)
double gcr_grid_get_double (GcrGrid *grid, unsigned row, unsigned column)
char const * gcr_grid_get_string (GcrGrid *grid, unsigned row, unsigned column)
bool gcr_grid_get_boolean (GcrGrid *grid, unsigned row, unsigned column)
void gcr_grid_set_int (GcrGrid *grid, unsigned row, unsigned column, int value)
void gcr_grid_set_uint (GcrGrid *grid, unsigned row, unsigned column, unsigned value)
void gcr_grid_set_double (GcrGrid *grid, unsigned row, unsigned column, double value)
void gcr_grid_set_string (GcrGrid *grid, unsigned row, unsigned column, char const *value)
void gcr_grid_set_boolean (GcrGrid *grid, unsigned row, unsigned column, bool value)
unsigned gcr_grid_append_row (GcrGrid *grid,...)
void gcr_grid_delete_row (GcrGrid *grid, unsigned row)
void gcr_grid_delete_selected_rows (GcrGrid *grid)
void gcr_grid_delete_all (GcrGrid *grid)
void gcr_grid_select_all (GcrGrid *grid)
void gcr_grid_customize_column (GcrGrid *grid, unsigned column, unsigned chars, bool editable)
void gcr_grid_set_allow_multiple_selection (GcrGrid *grid, bool allow)
void gcr_grid_add_row_to_selection (GcrGrid *grid, unsigned row)
void gcr_grid_unselect_row (GcrGrid *grid, unsigned row)
void gcr_grid_for_each_selected (GcrGrid *grid, GridCb cb, void *user_data)

Detailed Description

Grid widget.

The grid widget used in GCrystal dialogs to display lists of atoms, cleavages, or lines.

Definition in file grid.h.

Macro Definition Documentation

#define GCR_GRID (   obj)    (G_TYPE_CHECK_INSTANCE_CAST((obj), GCR_TYPE_GRID, GcrGrid))

Casts obj to a GcrGrid * pointer.

Returns
a pointer to the GcrGrid * or NULL if obj does not point to a GcrGrid widget.

Definition at line 44 of file grid.h.

#define GCR_IS_GRID (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE((obj), GCR_TYPE_GRID))
Returns
TRUE if obj points to a GcrGrid widget, FALSE otherwise.

Definition at line 48 of file grid.h.

#define GCR_TYPE_GRID   (gcr_grid_get_type ())
Returns
the GType associated to GcrGrid

Definition at line 38 of file grid.h.

Typedef Documentation

typedef void(* GridCb)(unsigned i, void *user_data)
Parameters
ia row index.
user_datauser data.

Callback for gcr_grid_for_each_selected().

Definition at line 264 of file grid.h.

Function Documentation

void gcr_grid_add_row_to_selection ( GcrGrid grid,
unsigned  row 
)
Parameters
grida GcrGrid.
rowthe row to select.

Adds the row to the selection if multiple selection is allowed or just select the row and replace the previous selection.

unsigned gcr_grid_append_row ( GcrGrid grid,
  ... 
)
Parameters
grida GcrGrid.

Adds a new row to the grid. The grid argument must be followed by the values to fill inside the cells.

Returns
the new row index.
void gcr_grid_customize_column ( GcrGrid grid,
unsigned  column,
unsigned  chars,
bool  editable 
)
Parameters
grida GcrGrid.
columnthe column.
charsthe maximum number of characters to display.
editablewhether data in the column can be edited.

Changes the properties for the column.

void gcr_grid_delete_all ( GcrGrid grid)
Parameters
grida GcrGrid.

Deletes all rows from the grid.

void gcr_grid_delete_row ( GcrGrid grid,
unsigned  row 
)
Parameters
grida GcrGrid.
rowthe row.

Deletes a row from the grid.

void gcr_grid_delete_selected_rows ( GcrGrid grid)
Parameters
grida GcrGrid.

Deletes all selected rows from the grid.

void gcr_grid_for_each_selected ( GcrGrid grid,
GridCb  cb,
void *  user_data 
)
Parameters
grida GcrGrid.
cbcallback.
user_datauser data.

Executes cb for each selected row.

bool gcr_grid_get_boolean ( GcrGrid grid,
unsigned  row,
unsigned  column 
)
Parameters
grida GcrGrid.
rowthe row.
columnthe column.

Retrieves the boolean value stored in the cell. If the column type is not G_TYPE_BOOLEAN, a critical will be emitted and the function will return false.

Returns
the boolean value stored in the cell defined by row and column.
double gcr_grid_get_double ( GcrGrid grid,
unsigned  row,
unsigned  column 
)
Parameters
grida GcrGrid.
rowthe row.
columnthe column.

Retrieves the floating point value stored in the cell. If the column type is not G_TYPE_DOUBLE, a critical will be emitted and the function will return NAN.

Returns
the double value stored in the cell defined by row and column.
int gcr_grid_get_int ( GcrGrid grid,
unsigned  row,
unsigned  column 
)
Parameters
grida GcrGrid.
rowthe row.
columnthe column.

Retrieves the integer value stored in the cell. If the column type is not G_TYPE_INT, a critical will be emitted and the function will return 0.

Returns
the integer value stored in the cell defined by row and column.
char const* gcr_grid_get_string ( GcrGrid grid,
unsigned  row,
unsigned  column 
)
Parameters
grida GcrGrid.
rowthe row.
columnthe column.

Retrieves the string stored in the cell. If the column type is not G_TYPE_DOUBLE, a critical will be emitted and the function will return NULL.

Returns
the string stored in the cell defined by row and column.
unsigned gcr_grid_get_uint ( GcrGrid grid,
unsigned  row,
unsigned  column 
)
Parameters
grida GcrGrid.
rowthe row.
columnthe column.

Retrieves the unsigned integer value stored in the cell. If the column type is not G_TYPE_UINT, a critical will be emitted and the function will return 0.

Returns
the unsigned integer value stored in the cell defined by row and column.
GtkWidget* gcr_grid_new ( char const *  col_title,
GType  col_type,
  ... 
)
Parameters
col_titlethe first column title.
col_typethe first column data type.

Builds a new GcrGrid widget. The arguments must include titles and types for each column in the grid. Supported types are G_TYPE_INT, G_TYPE_UINT, G_TYPE_DOUBLE, G_TYPE_STRING, and G_TYPE_BOOLEAN. Strings can't be edited in this version.

Returns
a pointer to the new widget.
void gcr_grid_select_all ( GcrGrid grid)
Parameters
grida GcrGrid.

Selects all rows in the grid.

void gcr_grid_set_allow_multiple_selection ( GcrGrid grid,
bool  allow 
)
Parameters
grida GcrGrid.
allowboolean.

Sets whether multiple rows selection is allowed for the grid.

void gcr_grid_set_boolean ( GcrGrid grid,
unsigned  row,
unsigned  column,
bool  value 
)
Parameters
grida GcrGrid.
rowthe row.
columnthe column.
valuethe new value.

Sets the boolean value stored in the cell. If the column type is not G_TYPE_BOOLEAN, a critical will be emitted and the cell content will be unchanged.

void gcr_grid_set_double ( GcrGrid grid,
unsigned  row,
unsigned  column,
double  value 
)
Parameters
grida GcrGrid.
rowthe row.
columnthe column.
valuethe new value.

Sets the floating point value stored in the cell. If the column type is not G_TYPE_DOUBLE, a critical will be emitted and the cell content will be unchanged.

void gcr_grid_set_int ( GcrGrid grid,
unsigned  row,
unsigned  column,
int  value 
)
Parameters
grida GcrGrid.
rowthe row.
columnthe column.
valuethe new value.

Sets the integer value stored in the cell. If the column type is not G_TYPE_INT, a critical will be emitted and the cell content will be unchanged.

void gcr_grid_set_string ( GcrGrid grid,
unsigned  row,
unsigned  column,
char const *  value 
)
Parameters
grida GcrGrid.
rowthe row.
columnthe column.
valuethe new value.

Sets the string stored in the cell. If the column type is not G_TYPE_STRING, a critical will be emitted and the cell content will be unchanged.

void gcr_grid_set_uint ( GcrGrid grid,
unsigned  row,
unsigned  column,
unsigned  value 
)
Parameters
grida GcrGrid.
rowthe row.
columnthe column.
valuethe new value.

Sets the unsigned integer value stored in the cell. If the column type is not G_TYPE_UINT, a critical will be emitted and the cell content will be unchanged.

void gcr_grid_unselect_row ( GcrGrid grid,
unsigned  row 
)
Parameters
grida GcrGrid.
rowa row index.

Unselects a row.