manpagez: man pages & more
html files: gcr-3
Home | html | info | man

GcrCollectionModel

GcrCollectionModel — A GtkTreeModel that represents a collection

Properties

GcrCollection * collection Read / Write
gpointer columns Read / Write / Construct Only
GcrCollectionModelMode mode Read / Write / Construct Only

Object Hierarchy

    GObject
    ╰── GcrCollectionModel

Implemented Interfaces

GcrCollectionModel implements GtkTreeModel and GtkTreeSortable.

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]

Parameters

collection

the collection to represent

 

mode

whether list or tree mode

 

...

the column names and types

 

Returns

a newly allocated model, which should be released with g_object_unref().

[transfer full]


gcr_collection_model_new_full ()

GcrCollectionModel *
gcr_collection_model_new_full (GcrCollection *collection,
                               GcrCollectionModelMode mode,
                               const GcrColumn *columns);

Create a new GcrCollectionModel.

[skip]

Parameters

collection

the collection to represent

 

mode

whether list or tree mode

 

columns

the columns the model should contain

 

Returns

a newly allocated model, which should be released with g_object_unref().

[transfer full]


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]

Parameters

self

The model

 

columns

The columns the model should contain

 

Returns

The number of columns


gcr_collection_model_get_collection ()

GcrCollection *
gcr_collection_model_get_collection (GcrCollectionModel *self);

Get the collection which this model represents

Parameters

self

a collection model

 

Returns

the collection, owned by the model.

[transfer none]


gcr_collection_model_set_collection ()

void
gcr_collection_model_set_collection (GcrCollectionModel *self,
                                     GcrCollection *collection);

Set the collection which this model represents

Parameters

self

a collection model

 

collection

the collection or NULL.

[allow-none]

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.

Parameters

self

The model

 

object

The object

 

iter

The row for the object

 

Returns

TRUE if the object was present.


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.

Parameters

self

The model

 

iter

The row

 

Returns

The object, owned by the model.

[transfer none]


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.

Parameters

self

The model

 

iter

The row

 

Returns

Whether the row has been 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.

Parameters

self

The model

 

iter

The row

 

selected

Whether the row should be 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.

Parameters

self

The model

 

iter

The row

 

gcr_collection_model_get_selected_objects ()

GList *
gcr_collection_model_get_selected_objects
                               (GcrCollectionModel *self);

Get a list of checked/selected objects.

Parameters

self

the collection model

 

Returns

a list of selected objects, which should be freed with g_list_free().

[transfer container][element-type GObject.Object]


gcr_collection_model_set_selected_objects ()

void
gcr_collection_model_set_selected_objects
                               (GcrCollectionModel *self,
                                GList *selected);

Set the checked/selected objects.

Parameters

self

the collection model

 

selected

a list of objects to select.

[element-type GObject.Object]

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.

Parameters

self

The model

 

Returns

The column identifier.

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.

Members


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.

Members

GCR_COLLECTION_MODEL_LIST

only objects in the top collection, no child objects

 

GCR_COLLECTION_MODEL_TREE

show objects in the collection, and child objects 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

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.