GtkTreeSelection {RGtk2} | R Documentation

## GtkTreeSelection

### Description

The selection object for GtkTreeView

### Methods and Functions

`gtkTreeSelectionSetMode(object, type)`
`gtkTreeSelectionGetMode(object)`
`gtkTreeSelectionSetSelectFunction(object, func, data = NULL)`
`gtkTreeSelectionGetSelectFunction(object)`
`gtkTreeSelectionGetUserData(object)`
`gtkTreeSelectionGetTreeView(object)`
`gtkTreeSelectionGetSelected(object)`
`gtkTreeSelectionSelectedForeach(object, func, data = NULL)`
`gtkTreeSelectionGetSelectedRows(object)`
`gtkTreeSelectionCountSelectedRows(object)`
`gtkTreeSelectionSelectPath(object, path)`
`gtkTreeSelectionUnselectPath(object, path)`
`gtkTreeSelectionPathIsSelected(object, path)`
`gtkTreeSelectionSelectIter(object, iter)`
`gtkTreeSelectionUnselectIter(object, iter)`
`gtkTreeSelectionIterIsSelected(object, iter)`
`gtkTreeSelectionSelectAll(object)`
`gtkTreeSelectionUnselectAll(object)`
`gtkTreeSelectionSelectRange(object, start.path, end.path)`
`gtkTreeSelectionUnselectRange(object, start.path, end.path)`

### Hierarchy

    GObject
       +----GtkTreeSelection

### Detailed 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 independentally 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 `gtkTreeViewGetSelection`. 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).

### Structures

`GtkTreeSelection`

  undocumented

### User Functions

`GtkTreeSelectionFunc(selection, model, path, path.currently.selected, data)`

  A function used by `gtkTreeSelectionSetSelectFunction` to filter whether or not a row may be selected. It is called whenever a row's state might change. A return value of `TRUE` indicates to `selection` that it is okay to change the selection.

  `selection`

    A `GtkTreeSelection`

  `model`

    A `GtkTreeModel` being viewed

  `path`

    The `GtkTreePath` of the row in question

  `path.currently.selected`

    `TRUE`, if the path is currently selected

  `data`

    user data

  Returns: [logical] `TRUE`, if the selection state of the row can be toggled

`GtkTreeSelectionForeachFunc(model, path, iter, data)`

  A function used by `gtkTreeSelectionSelectedForeach` to map all selected rows. It will be called on every selected row in the view.

  `model`

    The `GtkTreeModel` being viewed

  `path`

    The `GtkTreePath` of a selected row

  `iter`

    A `GtkTreeIter` pointing to a selected row

  `data`

    user data

### Signals

`changed(treeselection, user.data)`

  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.

  `treeselection`

    the object which received the signal.

  `user.data`

    user data set when the signal handler was connected.

### Author(s)

Derived by RGtkGen from GTK+ documentation

### References

https://developer.gnome.org/gtk2/stable/GtkTreeSelection.html

### See Also

`GtkTreeView` `GtkTreeViewColumn` `GtkTreeSortable` `GtkTreeModelSort` `GtkListStore` `GtkTreeStore` `GtkCellRenderer` `GtkCellEditable` `GtkCellRendererPixbuf` `GtkCellRendererText` `GtkCellRendererToggle`

[Package RGtk2 version 2.20.36.3 Index]