Top | ![]() |
![]() |
![]() |
![]() |
GListModel * | (*GtkTreeListModelCreateModelFunc) () |
GtkTreeListModel * | gtk_tree_list_model_new () |
GListModel * | gtk_tree_list_model_get_model () |
gboolean | gtk_tree_list_model_get_passthrough () |
void | gtk_tree_list_model_set_autoexpand () |
gboolean | gtk_tree_list_model_get_autoexpand () |
GtkTreeListRow * | gtk_tree_list_model_get_child_row () |
GtkTreeListRow * | gtk_tree_list_model_get_row () |
gpointer | gtk_tree_list_row_get_item () |
void | gtk_tree_list_row_set_expanded () |
gboolean | gtk_tree_list_row_get_expanded () |
gboolean | gtk_tree_list_row_is_expandable () |
guint | gtk_tree_list_row_get_position () |
guint | gtk_tree_list_row_get_depth () |
GListModel * | gtk_tree_list_row_get_children () |
GtkTreeListRow * | gtk_tree_list_row_get_parent () |
GtkTreeListRow * | gtk_tree_list_row_get_child_row () |
GtkTreeListModel is a GListModel implementation that can expand rows by creating new child list models on demand.
GListModel * (*GtkTreeListModelCreateModelFunc) (gpointer item
,gpointer user_data
);
Prototype of the function called to create new child models when
gtk_tree_list_row_set_expanded()
is called.
This function can return NULL
to indicate that item
is guaranteed to be
a leave node and will never have children.
If it does not have children but may get children later, it should return
an empty model that is filled once children arrive.
GtkTreeListModel * gtk_tree_list_model_new (gboolean passthrough
,GListModel *root
,gboolean autoexpand
,GtkTreeListModelCreateModelFunc create_func
,gpointer user_data
,GDestroyNotify user_destroy
);
Creates a new empty GtkTreeListModel displaying root
with all rows collapsed.
passthrough |
|
|
root |
The GListModel to use as root |
|
autoexpand |
|
|
create_func |
Function to call to create the GListModel for the children of an item |
|
user_data |
Data to pass to |
|
user_destroy |
Function to call to free |
GListModel *
gtk_tree_list_model_get_model (GtkTreeListModel *self
);
Gets the root model that self
was created with.
gboolean
gtk_tree_list_model_get_passthrough (GtkTreeListModel *self
);
If this function returns FALSE
, the GListModel functions for self
return custom GtkTreeListRow objects. You need to call
gtk_tree_list_row_get_item()
on these objects to get the original
item.
If TRUE
, the values of the child models are passed through in their
original state. You then need to call gtk_tree_list_model_get_row()
to get the custom GtkTreeListRows.
void gtk_tree_list_model_set_autoexpand (GtkTreeListModel *self
,gboolean autoexpand
);
If set to TRUE
, the model will recursively expand all rows that
get added to the model. This can be either rows added by changes
to the underlying models or via gtk_tree_list_model_set_expanded()
.
gboolean
gtk_tree_list_model_get_autoexpand (GtkTreeListModel *self
);
Gets whether the model is set to automatically expand new rows
that get added. This can be either rows added by changes to the
underlying models or via gtk_tree_list_model_set_expanded()
.
GtkTreeListRow * gtk_tree_list_model_get_child_row (GtkTreeListModel *self
,guint position
);
Gets the row item corresponding to the child at index position
for
self
's root model.
If position
is greater than the number of children in the root model,
NULL
is returned.
Do not confuse this function with gtk_tree_list_model_get_row()
.
GtkTreeListRow * gtk_tree_list_model_get_row (GtkTreeListModel *self
,guint position
);
Gets the row object for the given row. If position
is greater than
the number of items in self
, NULL
is returned.
The row object can be used to expand and collapse rows as well as to inspect its position in the tree. See its documentation for details.
This row object is persistent and will refer to the current item as
long as the row is present in self
, independent of other rows being
added or removed.
If self
is set to not be passthrough, this function is equivalent
to calling g_list_model_get_item()
.
Do not confuse this function with gtk_tree_list_model_get_child_row()
.
gpointer
gtk_tree_list_row_get_item (GtkTreeListRow *self
);
Gets the item corresponding to this row,
The value returned by this function never changes until the row is destroyed.
void gtk_tree_list_row_set_expanded (GtkTreeListRow *self
,gboolean expanded
);
Expands or collapses a row.
If a row is expanded, the model of calling the GtkTreeListModelCreateModelFunc for the row's item will be inserted after this row. If a row is collapsed, those items will be removed from the model.
If the row is not expandable, this function does nothing.
gboolean
gtk_tree_list_row_get_expanded (GtkTreeListRow *self
);
Gets if a row is currently expanded.
gboolean
gtk_tree_list_row_is_expandable (GtkTreeListRow *self
);
Checks if a row can be expanded. This does not mean that the
row is actually expanded, this can be checked with
gtk_tree_list_row_get_expanded()
If a row is expandable never changes until the row is destroyed.
guint
gtk_tree_list_row_get_position (GtkTreeListRow *self
);
Returns the position in the GtkTreeListModel that self
occupies
at the moment.
guint
gtk_tree_list_row_get_depth (GtkTreeListRow *self
);
Gets the depth of this row. Rows that correspond to items in the root model have a depth of zero, rows corresponding to items of models of direct children of the root model have a depth of 1 and so on.
The depth of a row never changes until the row is destroyed.
GListModel *
gtk_tree_list_row_get_children (GtkTreeListRow *self
);
If the row is expanded, gets the model holding the children of self
.
This model is the model created by the GtkTreeListModelCreateModelFunc and contains the original items, no matter what value “passthrough” is set to.
GtkTreeListRow *
gtk_tree_list_row_get_parent (GtkTreeListRow *self
);
Gets the row representing the parent for self
. That is the row that would
need to be collapsed to make this row disappear.
If self
is a row corresponding to the root model, NULL
is returned.
The value returned by this function never changes until the row is destroyed.
GtkTreeListRow * gtk_tree_list_row_get_child_row (GtkTreeListRow *self
,guint position
);
If self
is not expanded or position
is greater than the number of
children, NULL
is returned.