gtk.tree_selection

Module for [TreeSelection] class

Types 3

The #GtkTreeSelection object is a helper object to manage the selection for a #GtkTreeView widget. The #GtkTreeSelection object is automatically created when a new #GtkTreeView widget is created, and cannot exist independently of this widget. The primary reason the #GtkTreeSelection objects exists is for cleanliness of code and API. That is, there is no conceptual reason all these functions could not be methods on the #GtkTreeView widget instead of a separate function.

The #GtkTreeSelection object is gotten from a #GtkTreeView by calling [gtk.tree_view.TreeView.getSelection]. It can be manipulated to check the selection status of the tree, as well as select and deselect individual rows. Selection is done completely view side. As a result, multiple views of the same model can have completely different selections. Additionally, you cannot change the selection of a row on the model that is not currently displayed by the view without expanding its parents first.

One of the important things to remember when monitoring the selection of a view is that the #GtkTreeSelection::changed signal is mostly a hint. That is, it may only emit one signal when a range of rows is selected. Additionally, it may on occasion emit a #GtkTreeSelection::changed signal when nothing has happened (mostly as a result of programmers calling select_row on an already selected row).

Methods
GType _gType() @property
TreeSelection self()Returns `this`, for use in `with` statements.
TreeSelectionGidBuilder builder()Get builder for [gtk.tree_selection.TreeSelection] Returns: New builder object
gtk.types.SelectionMode mode() @propertyGet `mode` property. Returns: Selection mode. See [gtk.tree_selection.TreeSelection.setMode] for more information on this property.
void mode(gtk.types.SelectionMode propval) @propertySet `mode` property. Params: propval = Selection mode. See [gtk.tree_selection.TreeSelection.setMode] for more information on this property.
int countSelectedRows()Returns the number of rows that have been selected in tree. Returns: The number of rows selected.
gtk.types.SelectionMode getMode()Gets the selection mode for selection. See [gtk.tree_selection.TreeSelection.setMode]. Returns: the current selection mode
bool getSelected(out gtk.tree_model.TreeModel model, out gtk.tree_iter.TreeIter iter)Sets iter to the currently selected node, if selection is set to [gtk.types.SelectionMode.Single] or [gtk.types.SelectionMode.Browse].
gtk.tree_path.TreePath[] getSelectedRows(out gtk.tree_model.TreeModel model)Creates a list of path of all selected rows.
gtk.tree_view.TreeView getTreeView()Returns the tree view associated with selection. Returns: A #GtkTreeView
bool iterIsSelected(gtk.tree_iter.TreeIter iter)Returns true if the row at iter is currently selected.
bool pathIsSelected(gtk.tree_path.TreePath path)Returns true if the row pointed to by path is currently selected. If path does not point to a valid location, false is returned
void selectAll()Selects all the nodes. selection must be set to #GTKSELECTIONMULTIPLE mode.
void selectIter(gtk.tree_iter.TreeIter iter)Selects the specified iterator.
void selectPath(gtk.tree_path.TreePath path)Select the row at path.
void selectRange(gtk.tree_path.TreePath startPath, gtk.tree_path.TreePath endPath)Selects a range of nodes, determined by startpath and endpath inclusive. selection must be set to #GTKSELECTIONMULTIPLE mode.
void selectedForeach(gtk.types.TreeSelectionForeachFunc func)Calls a function for each selected node. Note that you cannot modify the tree or selection from within this function. As a result, [gtk.tree_selection.TreeSelection.getSelectedRows] might be more u...
void setMode(gtk.types.SelectionMode type)Sets the selection mode of the selection. If the previous type was #GTKSELECTIONMULTIPLE, then the anchor is kept selected, if it was previously selected.
void setSelectFunction(gtk.types.TreeSelectionFunc func = null)Sets the selection function.
void unselectAll()Unselects all the nodes.
void unselectIter(gtk.tree_iter.TreeIter iter)Unselects the specified iterator.
void unselectPath(gtk.tree_path.TreePath path)Unselects the row at path.
void unselectRange(gtk.tree_path.TreePath startPath, gtk.tree_path.TreePath endPath)Unselects a range of nodes, determined by startpath and endpath inclusive.
gulong connectChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.tree_selection.TreeSelection))) && Parameters!T.length < 2)Connect to `Changed` signal.
Constructors
this(void * ptr, Flag!"Take" take)
Methods
T mode(gtk.types.SelectionMode propval)Set `mode` property. Params: propval = Selection mode. See [gtk.tree_selection.TreeSelection.setMode] for more information on this property. Returns: Builder instance for fluent chaining

Fluent builder for [gtk.tree_selection.TreeSelection]