Data Model API (libmodel) | ||||
---|---|---|---|---|
Top | Description |
ModelListModelList — a mutable list of ModelObject instances |
Synopsis
ModelList; ModelListClass; gulong model_list_n_children (ModelList *list); ModelObject * model_list_get_child (ModelList *list, gulong index); void model_list_changed (ModelList *list, gulong position, gulong removed, gulong inserted, gboolean more);
Description
ModelList is a mutable list of ModelObject instances (items). Items can be inserted and removed, changing the length and composition of the list.
ModelReference is not used here. The only way to change the value of an item at a particular array index is to remove that item and insert a new one at the same position.
When the list changes, the "changed" signal is emitted. The signal is always emitted from the mainloop; never during the execution of method calls on the model.
Details
ModelList
typedef struct { ModelObject parent_instance; } ModelList;
This is an opaque structure; it may not be accessed directly.
ModelListClass
typedef struct { ModelObjectClass parent_class; gulong (*n_children) (ModelList *list); ModelObject * (*get_child) (ModelList *list, gulong index); } ModelListClass;
The class structure for ModelList. All virtual functions must be implemented by each subclass.
ModelObjectClass |
|
|
virtual function pointer for model_list_n_children()
|
|
virtual function pointer for model_list_get_child()
|
model_list_n_children ()
gulong model_list_n_children (ModelList *list);
Gets the number of items in list
.
|
a ModelList |
|
the number of items in list
|
model_list_get_child ()
ModelObject * model_list_get_child (ModelList *list, gulong index);
Gets the child value at position index
of list
. index
must be a
valid index in the array (ie: strictly less than the result of
model_list_n_children()
).
It is appropriate for the caller to call g_object_unref()
on the
return value.
|
a modelList |
|
the index of the child value to get |
|
the ModelObject for the child value, owned by the caller |