The selection object for
The <gtk-tree-selection>
object is a helper object to manage the
selection for a <gtk-tree-view>
widget. The <gtk-tree-selection>
object is automatically created when a new <gtk-tree-view>
widget is
created, and cannot exist independentally of this widget. The primary reason the
<gtk-tree-selection>
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>
widget instead of a separate function.
The <gtk-tree-selection>
object is gotten from a <gtk-tree-view>
by calling gtk-tree-view-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 a "changed" signal when nothing has happened (mostly as a result of programmers calling select_row on an already selected row).
Emitted whenever the selection has (possibly) changed. Please note that this signal is mostly a hint. It may only be emitted once when a range of rows are selected, and it may occasionally be emitted when nothing has happened.
<gtk-tree-selection>
) (type <gtk-selection-mode>
)Sets the selection mode of the selection. If the previous type was
<gtk-selection-multiple>
, then the anchor is kept selected, if it was previously selected.
- selection
- A
<gtk-tree-selection>
.- type
- The selection mode
<gtk-tree-selection>
) ⇒ (ret <gtk-selection-mode>
)Gets the selection mode for selection. See
gtk-tree-selection-set-mode
.
- selection
- a
<gtk-tree-selection>
- ret
- the current selection mode
<gtk-tree-selection>
) ⇒ (ret <gtk-tree-view>
)Returns the tree view associated with selection.
- selection
- A
<gtk-tree-selection>
- ret
- A
<gtk-tree-view>
<gtk-tree-selection>
) ⇒ (model <gtk-tree-model>
) (iter <gtk-tree-iter>
)Retrieve the current selection, if selection is set to
<gtk-selection-single>
or<gtk-selection-browse>
.This function will not work if you use selection is
<gtk-selection-multiple>
.
- selection
- A
<gtk-tree-selection>
.- model
- A pointer to set to the
<gtk-tree-model>
, or NULL.- iter
- The
<gtk-tree-iter>
, or NULL.
<gtk-tree-selection>
) (path <gtk-tree-path>
)Select the row at path.
- selection
- A
<gtk-tree-selection>
.- path
- The
<gtk-tree-path>
to be selected.
<gtk-tree-selection>
) (path <gtk-tree-path>
)Unselects the row at path.
- selection
- A
<gtk-tree-selection>
.- path
- The
<gtk-tree-path>
to be unselected.
<gtk-tree-selection>
) (path <gtk-tree-path>
) ⇒ (ret bool
)Returns ‘
#t
’ if the row pointed to by path is currently selected. If path does not point to a valid location, ‘#f
’ is returned
- selection
- A
<gtk-tree-selection>
.- path
- A
<gtk-tree-path>
to check selection on.- ret
- ‘
#t
’ if path is selected.
<gtk-tree-selection>
) (iter <gtk-tree-iter>
)Selects the specified iterator.
- selection
- A
<gtk-tree-selection>
.- iter
- The
<gtk-tree-iter>
to be selected.
<gtk-tree-selection>
) (iter <gtk-tree-iter>
)Unselects the specified iterator.
- selection
- A
<gtk-tree-selection>
.- iter
- The
<gtk-tree-iter>
to be unselected.
<gtk-tree-selection>
) (iter <gtk-tree-iter>
) ⇒ (ret bool
)Returns ‘
#t
’ if the row at iter is currently selected.
- selection
- A
<gtk-tree-selection>
- iter
- A valid
<gtk-tree-iter>
- ret
- ‘
#t
’, if iter is selected
<gtk-tree-selection>
)Selects all the nodes. selection must be set to
<gtk-selection-multiple>
mode.
- selection
- A
<gtk-tree-selection>
.
<gtk-tree-selection>
)Unselects all the nodes.
- selection
- A
<gtk-tree-selection>
.
<gtk-tree-selection>
) (start_path <gtk-tree-path>
) (end_path <gtk-tree-path>
)Selects a range of nodes, determined by start-path and end-path inclusive. selection must be set to
<gtk-selection-multiple>
mode.
- selection
- A
<gtk-tree-selection>
.- start-path
- The initial node of the range.
- end-path
- The final node of the range.
<gtk-tree-selection>
) (start_path <gtk-tree-path>
) (end_path <gtk-tree-path>
)Unselects a range of nodes, determined by start-path and end-path inclusive.
- selection
- A
<gtk-tree-selection>
.- start-path
- The initial node of the range.
- end-path
- The initial node of the range.
Since 2.2