gtk.tree_selection

Module for [TreeSelection] class

Types 3

The selection object for GtkTreeView

The gtk.tree_selection.TreeSelection object is a helper object to manage the selection for a gtk.tree_view.TreeView widget. The gtk.tree_selection.TreeSelection object is automatically created when a new gtk.tree_view.TreeView widget is created, and cannot exist independently of this widget. The primary reason the gtk.tree_selection.TreeSelection 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 gtk.tree_view.TreeView widget instead of a separate function.

The gtk.tree_selection.TreeSelection object is gotten from a gtk.tree_view.TreeView 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 gtk.tree_selection.TreeSelection::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 gtk.tree_selection.TreeSelection::changed signal when nothing has happened (mostly as a result of programmers calling select_row on an already selected row).

Deprecated

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
TreeSelection self() nothrowReturns `this`, for use in `with` statements.
TreeSelectionGidBuilder builder() static nothrowGet builder for [gtk.tree_selection.TreeSelection] Returns: New builder object
gtk.types.SelectionMode mode() @property nothrowGet `mode` property. Returns: Selection mode. See [gtk.tree_selection.TreeSelection.setMode] for more information on this property.
void mode(gtk.types.SelectionMode propval) @property nothrowSet `mode` property. Params: propval = Selection mode. See [gtk.tree_selection.TreeSelection.setMode] for more information on this property.
int countSelectedRows() nothrowReturns the number of rows that have been selected in tree. Returns: The number of rows selected.
gtk.types.SelectionMode getMode() nothrowGets 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) nothrowSets iter to the currently selected node if selection is set to [gtk.types.SelectionMode.Single] or [gtk.types.SelectionMode.Browse]. iter may be NULL if you just want to test if selection has any...
gtk.tree_path.TreePath[] getSelectedRows(out gtk.tree_model.TreeModel model) nothrowCreates a list of path of all selected rows. Additionally, if you are planning on modifying the model after calling this function, you may want to convert the returned list into a list of [gtk.tree...
gtk.tree_view.TreeView getTreeView() nothrowReturns the tree view associated with selection. Returns: A [gtk.tree_view.TreeView]
bool iterIsSelected(gtk.tree_iter.TreeIter iter) nothrowReturns true if the row at iter is currently selected.
bool pathIsSelected(gtk.tree_path.TreePath path) nothrowReturns 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() nothrowSelects all the nodes. selection must be set to [gtk.types.SelectionMode.Multiple] mode.
void selectIter(gtk.tree_iter.TreeIter iter) nothrowSelects the specified iterator.
void selectPath(gtk.tree_path.TreePath path) nothrowSelect the row at path.
void selectRange(gtk.tree_path.TreePath startPath, gtk.tree_path.TreePath endPath) nothrowSelects a range of nodes, determined by start_path and end_path inclusive. selection must be set to [gtk.types.SelectionMode.Multiple] mode.
void selectedForeach(gtk.types.TreeSelectionForeachFunc func) nothrowCalls 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) nothrowSets the selection mode of the selection. If the previous type was [gtk.types.SelectionMode.Multiple], then the anchor is kept selected, if it was previously selected.
void setSelectFunction(gtk.types.TreeSelectionFunc func = null) nothrowSets the selection function.
void unselectAll() nothrowUnselects all the nodes.
void unselectIter(gtk.tree_iter.TreeIter iter) nothrowUnselects the specified iterator.
void unselectPath(gtk.tree_path.TreePath path) nothrowUnselects the row at path.
void unselectRange(gtk.tree_path.TreePath startPath, gtk.tree_path.TreePath endPath) nothrowUnselects a range of nodes, determined by start_path and end_path 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) nothrowConnect to `Changed` signal.
Constructors
this(void * ptr, Flag!"Take" take)

Fluent builder implementation template for gtk.tree_selection.TreeSelection

Methods
T mode(gtk.types.SelectionMode propval) nothrowSet `mode` property. Params: propval = Selection mode. See [gtk.tree_selection.TreeSelection.setMode] for more information on this property. Returns: Builder instance for fluent chaining
Methods
TreeSelection build() nothrowCreate object from builder. Returns: New object