## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

## Index

Package: Tree_Selection

- Goto spec source

# Description

    package Gtk.Tree_Selection is

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 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).

Binding from C File version 2.8.17

# Packages

### Selection_Foreach (generic)

Full description

# Classes

### Gtk_Tree_Selection_Record

- Goto declaration in source
- Goto full declaration in source

    type Gtk_Tree_Selection_Record is
         new Glib.Object.GObject_Record with private;

#### Ancestors:

Glib.Object.GObject_Record

#### Primitive operations:

Count_Selected_Rows

- To API doc
- To spec

Get_Selected_Rows

- To API doc
- To spec

Glib.Object.Deallocate

- To API doc
- To spec

(Inherited)
Glib.Object.Get_Type

- To API doc
- To spec

(Inherited)
Glib.Object.Notify

- To API doc
- To spec

(Inherited)
Glib.Object.Ref

- To API doc
- To spec

(Inherited)
Glib.Object.Ref_Sink

- To API doc
- To spec

(Inherited)
Glib.Object.Unref

- To API doc
- To spec

(Inherited)
Unselect_Range

- To API doc
- To spec

# Types

### Gtk_Tree_Selection

- Goto declaration in source

    type Gtk_Tree_Selection is access all Gtk_Tree_Selection_Record'Class;

# Constants & Global variables

### Signal_Changed

- Goto declaration in source

(Glib.Signal_Name)

    Signal_Changed : constant Glib.Signal_Name := "changed";

# Subprograms & Entries

### Get_Type

- Goto spec in source
- Goto body in source

    function Get_Type return Glib.GType;

Return the internal type associated with Gtk_Tree_Selection.

### Set_Mode

- Goto spec in source

    procedure Set_Mode (Selection: access Gtk_Tree_Selection_Record'Class;The_Type: Gtk_Selection_Mode);

### Get_Mode

- Goto spec in source

    function Get_Mode (Selection: access Gtk_Tree_Selection_Record'Class) return Gtk_Selection_Mode;

Set 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.

### Get_Tree_View

- Goto spec in source

    function Get_Tree_View (Selection: access Gtk_Tree_Selection_Record'Class) return Gtk.Widget.Gtk_Widget;

Return the tree view associated with Selection.

### Count_Selected_Rows

- Goto spec in source

    function Count_Selected_Rows (Selection: access Gtk_Tree_Selection_Record) return Gint;

Returns the number of rows that have been selected.

### Get_Selected

- Goto spec in source

    procedure Get_Selected (Selection: access Gtk_Tree_Selection_Record'Class;Model: out Gtk.Tree_Model.Gtk_Tree_Model;Iter: out Gtk.Tree_Model.Gtk_Tree_Iter);

Set Iter to the currently selected node if Selection is set to Gtk_Selection_Single or Gtk_Selection_Browse. Iter is set to Null_Iter if no node is currently selected. Model is filled with the current model as a convenience. This function will not work if Selection is set to Gtk_Selection_Multiple.

### Get_Selected_Rows

- Goto spec in source

    procedure Get_Selected_Rows (Selection: access Gtk_Tree_Selection_Record;Model: out Gtk.Tree_Model.Gtk_Tree_Model;Path_List: out Gtk.Tree_Model.Gtk_Tree_Path_List.Glist);

Creates 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_Row_Reference. You must free the resulting list by calling Path_Free on each item, and then freeing the list itself.

### Select_Path

- Goto spec in source

    procedure Select_Path (Selection: access Gtk_Tree_Selection_Record'Class;Path: Gtk.Tree_Model.Gtk_Tree_Path);

### Unselect_Path

- Goto spec in source

    procedure Unselect_Path (Selection: access Gtk_Tree_Selection_Record'Class;Path: Gtk.Tree_Model.Gtk_Tree_Path);

Selects or unselects the row at path.

### Path_Is_Selected

- Goto spec in source

    function Path_Is_Selected (Selection: access Gtk_Tree_Selection_Record'Class;Path: Gtk.Tree_Model.Gtk_Tree_Path) return Boolean;

Return True if the row pointed to by path is currently selected. If path does not point to a valid location, False is returned

### Select_Iter

- Goto spec in source

    procedure Select_Iter (Selection: access Gtk_Tree_Selection_Record'Class;Iter: Gtk.Tree_Model.Gtk_Tree_Iter);

### Unselect_Iter

- Goto spec in source

    procedure Unselect_Iter (Selection: access Gtk_Tree_Selection_Record'Class;Iter: Gtk.Tree_Model.Gtk_Tree_Iter);

Selects or unselects the row pointed to by the specified iterator.

### Iter_Is_Selected

- Goto spec in source

    function Iter_Is_Selected (Selection: access Gtk_Tree_Selection_Record'Class;Iter: Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean;

Return True if the row pointed to by path is currently selected.

### Select_All

- Goto spec in source

    procedure Select_All (Selection: access Gtk_Tree_Selection_Record'Class);

### Unselect_All

- Goto spec in source

    procedure Unselect_All (Selection: access Gtk_Tree_Selection_Record'Class);

Selects or unselects all the nodes. Selection must be set to Gtk_Selection_Multiple mode.

### Select_Range

- Goto spec in source

    procedure Select_Range (Selection: access Gtk_Tree_Selection_Record'Class;Start_Path: Gtk.Tree_Model.Gtk_Tree_Path;End_Path: Gtk.Tree_Model.Gtk_Tree_Path);

### Unselect_Range

- Goto spec in source

    procedure Unselect_Range (Selection: access Gtk_Tree_Selection_Record;Start_Path: Gtk.Tree_Model.Gtk_Tree_Path;End_Path: Gtk.Tree_Model.Gtk_Tree_Path);

Selects or unselects a range of nodes, determined by Start_Path and End_Path inclusive