GtkTreeSelection
Selection of a GtkTreeView.
Object Hierarchy
Description
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 get_selection() . 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 "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 the signal when nothing has happened (mostly as a result of programmers calling select_row on an already selected row).
Methods
count_selected_rows() Returns the number of selected rows. get_mode() Gets the selection mode for selection. get_selected() Get the selected row. get_selected_rows() Returns the selected rows for a multiselection. get_tree_view() Returns the treeview. iter_is_selected() Checks if an iterator is selected or not. path_is_selected() Checks if a tree path is selected or not. select_all() Selects all rows. select_iter() Selects a row. select_path() Selects a row. select_range() Selects a given range of rows. selected_foreach() Calls a function for each selected row. set_mode() Sets the selection mode. set_select_function() FIXME unselect_all() Deselects all rows. unselect_iter() Deselects an iterator. unselect_path() Deselects a path. unselect_range() Deselects a given range of rows.
Signals
"changed" One or more rows have been selected.