Top |
Functions
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 () |
Properties
gboolean | autoexpand | Read / Write |
GListModel * | model | Read |
gboolean | passthrough | Read / Write / Construct Only |
GListModel * | children | Read |
guint | depth | Read |
gboolean | expandable | Read |
gboolean | expanded | Read / Write |
GObject * | item | Read |
Description
GtkTreeListModel is a GListModel implementation that can expand rows by creating new child list models on demand.
Functions
GtkTreeListModelCreateModelFunc ()
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 leaf 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.
gtk_tree_list_model_new ()
GtkTreeListModel * gtk_tree_list_model_new (GListModel *root
,gboolean passthrough
,gboolean autoexpand
,GtkTreeListModelCreateModelFunc create_func
,gpointer user_data
,GDestroyNotify user_destroy
);
Creates a new empty GtkTreeListModel displaying root
with all rows collapsed.
Parameters
root |
The GListModel to use as root. |
[transfer full] |
passthrough |
|
|
autoexpand |
|
|
create_func |
Function to call to create the GListModel for the children of an item |
|
user_data |
Data to pass to |
[closure] |
user_destroy |
Function to call to free |
gtk_tree_list_model_get_model ()
GListModel *
gtk_tree_list_model_get_model (GtkTreeListModel *self
);
Gets the root model that self
was created with.
gtk_tree_list_model_get_passthrough ()
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.
gtk_tree_list_model_set_autoexpand ()
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_row_set_expanded()
.
gtk_tree_list_model_get_autoexpand ()
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_row_set_expanded()
.
gtk_tree_list_model_get_child_row ()
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()
.
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()
.
Property Details
The “autoexpand”
property
“autoexpand” gboolean
If all rows should be expanded by default
Owner: GtkTreeListModel
Flags: Read / Write
Default value: FALSE
The “model”
property
“model” GListModel *
The root model displayed
Owner: GtkTreeListModel
Flags: Read
The “passthrough”
property
“passthrough” gboolean
If FALSE
, the GListModel functions for this object return custom
GtkTreeListRow objects.
If TRUE
, the values of the child models are pass through unmodified.
Owner: GtkTreeListModel
Flags: Read / Write / Construct Only
Default value: FALSE
The “children”
property
“children” GListModel *
The model holding the row's children.
Owner: GtkTreeListRow
Flags: Read
The “depth”
property
“depth” guint
The depth in the tree of this row
Owner: GtkTreeListRow
Flags: Read
Default value: 0
The “expandable”
property
“expandable” gboolean
If this row can ever be expanded
Owner: GtkTreeListRow
Flags: Read
Default value: FALSE
The “expanded”
property
“expanded” gboolean
If this row is currently expanded
Owner: GtkTreeListRow
Flags: Read / Write
Default value: FALSE