Top |
Functions
GcrCollectionModel * | gcr_collection_model_new () |
GcrCollectionModel * | gcr_collection_model_new_full () |
guint | gcr_collection_model_set_columns () |
GcrCollection * | gcr_collection_model_get_collection () |
void | gcr_collection_model_set_collection () |
gboolean | gcr_collection_model_iter_for_object () |
GObject * | gcr_collection_model_object_for_iter () |
gboolean | gcr_collection_model_is_selected () |
void | gcr_collection_model_change_selected () |
void | gcr_collection_model_toggle_selected () |
GList * | gcr_collection_model_get_selected_objects () |
void | gcr_collection_model_set_selected_objects () |
gint | gcr_collection_model_column_for_selected () |
Properties
GcrCollection * | collection | Read / Write |
gpointer | columns | Read / Write / Construct Only |
GcrCollectionModelMode | mode | Read / Write / Construct Only |
Types and Values
struct | GcrCollectionModel |
struct | GcrCollectionModelClass |
enum | GcrCollectionModelMode |
Description
This is an implementation of GtkTreeModel which represents the objects in the a GcrCollection. As objects are added or removed from the collection, rows are added and removed from this model.
The row values come from the properties of the objects in the collection. Use
gcr_collection_model_new()
to create a new collection model. To have more
control over the values use a set of GcrColumn structures to define the
columns. This can be done with gcr_collection_model_new_full()
or
gcr_collection_model_set_columns()
.
Each row can have a selected state, which is represented by a boolean column.
The selected state can be toggled with gcr_collection_model_toggle_selected()
or set with gcr_collection_model_set_selected_objects()
and retrieved with
gcr_collection_model_get_selected_objects()
.
To determine which object a row represents and vice versa, use the
gcr_collection_model_iter_for_object()
or gcr_collection_model_object_for_iter()
functions.
Functions
gcr_collection_model_new ()
GcrCollectionModel * gcr_collection_model_new (GcrCollection *collection
,GcrCollectionModelMode mode
,...
);
Create a new GcrCollectionModel. The variable argument list should contain
pairs of property names, and GType values. The variable argument list should
be terminated with NULL
.
[skip]
gcr_collection_model_new_full ()
GcrCollectionModel * gcr_collection_model_new_full (GcrCollection *collection
,GcrCollectionModelMode mode
,const GcrColumn *columns
);
Create a new GcrCollectionModel.
[skip]
gcr_collection_model_set_columns ()
guint gcr_collection_model_set_columns (GcrCollectionModel *self
,const GcrColumn *columns
);
Set the columns that the model should contain. columns
is an array of
GcrColumn structures, with the last one containing NULL
for all values.
This function can only be called once, and only if the model was not created without a set of columns. This function cannot be called after the model has been added to a view.
The columns are accessed as static data. They should continue to remain in memory for longer than the GcrCollectionModel object.
[skip]
gcr_collection_model_get_collection ()
GcrCollection *
gcr_collection_model_get_collection (GcrCollectionModel *self
);
Get the collection which this model represents
gcr_collection_model_set_collection ()
void gcr_collection_model_set_collection (GcrCollectionModel *self
,GcrCollection *collection
);
Set the collection which this model represents
gcr_collection_model_iter_for_object ()
gboolean gcr_collection_model_iter_for_object (GcrCollectionModel *self
,GObject *object
,GtkTreeIter *iter
);
Set iter
to the row for the given object. If the object is not in this
model, then FALSE
will be returned.
gcr_collection_model_object_for_iter ()
GObject * gcr_collection_model_object_for_iter (GcrCollectionModel *self
,const GtkTreeIter *iter
);
Get the object that is represented by the given row in the model.
gcr_collection_model_is_selected ()
gboolean gcr_collection_model_is_selected (GcrCollectionModel *self
,GtkTreeIter *iter
);
Check whether a given row has been toggled as selected.
gcr_collection_model_change_selected ()
void gcr_collection_model_change_selected (GcrCollectionModel *self
,GtkTreeIter *iter
,gboolean selected
);
Set whether a given row is toggled selected or not.
gcr_collection_model_toggle_selected ()
void gcr_collection_model_toggle_selected (GcrCollectionModel *self
,GtkTreeIter *iter
);
Toggle the selected state of a given row.
gcr_collection_model_get_selected_objects ()
GList *
gcr_collection_model_get_selected_objects
(GcrCollectionModel *self
);
Get a list of checked/selected objects.
gcr_collection_model_set_selected_objects ()
void gcr_collection_model_set_selected_objects (GcrCollectionModel *self
,GList *selected
);
Set the checked/selected objects.
gcr_collection_model_column_for_selected ()
gint
gcr_collection_model_column_for_selected
(GcrCollectionModel *self
);
Get the column identifier for the column that contains the values of the selected state.
Types and Values
struct GcrCollectionModel
struct GcrCollectionModel;
A GtkTreeModel which contains a row for each object in a GcrCollection.
struct GcrCollectionModelClass
struct GcrCollectionModelClass { GObjectClass parent_class; };
The class for GcrCollectionModel.
enum GcrCollectionModelMode
If set GcrCollectionModel is created with a mode of GCR_COLLECTION_MODEL_TREE
,
then any included objects that are themselves a GcrCollection, will have all child
objects include as child rows in a tree form.
Property Details
The “collection”
property
“collection” GcrCollection *
Collection to get objects from.
Flags: Read / Write
The “columns”
property
“columns” gpointer
Columns for the model.
Flags: Read / Write / Construct Only
The “mode”
property
“mode” GcrCollectionModelMode
Tree or list mode.
Flags: Read / Write / Construct Only
Default value: GCR_COLLECTION_MODEL_TREE