---
name: "Gtk2::TreeSelection"
section: "3pm"
platform: "linux"
package: "libgtk2-perl-doc"
version: "2:1.24992-1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/Gtk2::TreeSelection"
---

# Gtk2::TreeSelection(3pm)

wrapper for GtkTreeSelection

## NAME

Gtk2::TreeSelection - wrapper for GtkTreeSelection

## HIERARCHY

```
  Glib::Object
  +----Gtk2::TreeSelection
```

## METHODS

### integer = $selection-\>count\_selected\_rows

### boolean = $selection-\>iter\_is\_selected ($iter)

- •

  `$iter` (Gtk2::TreeIter)

### selectionmode = $selection-\>get\_mode

### $selection-\>set\_mode ($type)

- •

  `$type` (Gtk2::SelectionMode)

### boolean = $selection-\>path\_is\_selected ($path)

- •

  `$path` (Gtk2::TreePath)

### $selection-\>select\_all

### $selection-\>set\_select\_function ($func, $data=undef)

- •

  `$func` (scalar)

- •

  `$data` (scalar)

### $selection-\>select\_iter ($iter)

- •

  `$iter` (Gtk2::TreeIter)

### $selection-\>select\_path ($path)

- •

  `$path` (Gtk2::TreePath)

### $selection-\>select\_range ($start\_path, $end\_path)

- •

  `$start_path` (Gtk2::TreePath)

- •

  `$end_path` (Gtk2::TreePath)

### $selection-\>selected\_foreach ($func, $data=undef)

- •

  `$func` (subroutine)

- •

  `$data` (scalar)

Call *$func* on every selected row in *$selection*'s view.

### iter = $tree\_selection-\>get\_selected

### (model, iter) = $tree\_selection-\>get\_selected

Since most of the time you are only interested in the iter, `"get_selected"` returns only the iter in scalar context.

### @paths = $selection-\>get\_selected\_rows

Returns the Gtk2::TreePath of each selected row, or an empty list if no rows are selected.  The model is *not* returned, as documented in the C API reference.  To get the model, try `"$selection->get_tree_view->get_model"`.

### treeview = $selection-\>get\_tree\_view

### $selection-\>unselect\_all

### $selection-\>unselect\_iter ($iter)

- •

  `$iter` (Gtk2::TreeIter)

### $selection-\>unselect\_path ($path)

- •

  `$path` (Gtk2::TreePath)

### $selection-\>unselect\_range ($start\_path, $end\_path)

- •

  `$start_path` (Gtk2::TreePath)

- •

  `$end_path` (Gtk2::TreePath)

Since: gtk+ 2.2

### scalar = $selection-\>get\_user\_data

## SIGNALS

- **changed** (Gtk2::TreeSelection)

  ## ENUMS AND FLAGS

### enum Gtk2::SelectionMode

- •

  'none' / 'GTK\_SELECTION\_NONE'

- •

  'single' / 'GTK\_SELECTION\_SINGLE'

- •

  'browse' / 'GTK\_SELECTION\_BROWSE'

- •

  'multiple' / 'GTK\_SELECTION\_MULTIPLE'

- •

  'extended' / 'GTK\_SELECTION\_EXTENDED'

## SEE ALSO

Gtk2, Glib::Object

## COPYRIGHT

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL.  See Gtk2 for a full notice.
