## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

## Index

Package: Tree_Dnd

- Goto spec source

# Description

    package Gtk.Tree_Dnd is

GTK+ supports Drag-and-Drop in tree views with a high-level and a low-level API.

The low-level API consists of the GTK+ DND API, augmented by some treeview utility functions: Gtk.Tree_View.Set_Drag_Dest_Row, Gtk.Tree_View.Get_Drag_Dest_Row, Gtk.Tree_View.Get_Dest_Row_At_Pos, Gtk.Tree_View.Create_Row_Drag_Icon, Set_Row_Drag_Data and Get_Row_Drag_Data. This API leaves a lot of flexibility, but nothing is done automatically, and implementing advanced features like hover-to-open-rows or autoscrolling on top of this API is a lot of work.

On the other hand, if you write to the high-level API, then all the bookkeeping of rows is done for you, as well as things like hover-to-open and auto-scroll, but your models have to implement the Gtk_Tree_Drag_Source and Gtk_Tree_Drag_Dest interfaces.

Binding from C File version 2.8.17

# Types

### Gtk_Tree_Drag_Source

- Goto declaration in source

    type Gtk_Tree_Drag_Source is new Glib.Types.GType_Interface;

### Gtk_Tree_Drag_Dest

- Goto declaration in source

    type Gtk_Tree_Drag_Dest   is new Glib.Types.GType_Interface;

# Subprograms & Entries

### Drag_Dest_Get_Type

- Goto spec in source
- Goto body in source

    function Drag_Dest_Get_Type   return GType;

### Drag_Source_Get_Type

- Goto spec in source
- Goto body in source

    function Drag_Source_Get_Type return GType;

Return the low-level types associated with the interfaces

### Drag_Dest_Drag_Data_Received

- Goto spec in source

    function Drag_Dest_Drag_Data_Received (Drag_Dest: Gtk_Tree_Drag_Dest;Dest: Gtk.Tree_Model.Gtk_Tree_Path;Selection_Data: Gtk.Selection.Selection_Data) return Boolean;

Asks the Drag_Dest to insert a row before the path Dest, deriving the contents of the row from Selection_Data. If Dest is outside the tree so that inserting before it is impossible, False will be returned. Also, False may be returned if the new row is not created for some model-specific reason. Should robustly handle a Dest no longer found in the model!

### Drag_Dest_Row_Drop_Possible

- Goto spec in source

    function Drag_Dest_Row_Drop_Possible (Drag_Dest: Gtk_Tree_Drag_Dest;Dest_Path: Gtk.Tree_Model.Gtk_Tree_Path;Selection_Data: Gtk.Selection.Selection_Data) return Boolean;

Determines whether a drop is possible before the given Dest_Path, at the same depth as Dest_Path. i.e., can we drop the data in Selection_Data at that location. Dest_Path does not have to exist; the return value will almost certainly be False if the parent of Dest_Path doesn't exist, though.

### Drag_Source_Drag_Data_Delete

- Goto spec in source

    function Drag_Source_Drag_Data_Delete (Drag_Source: Gtk_Tree_Drag_Source;Path: Gtk.Tree_Model.Gtk_Tree_Path) return Boolean;

Asks the Drag_Source to delete the row at Path, because it was moved somewhere else via drag-and-drop. Returns False if the deletion fails because Path no longer exists, or for some model-specific reason. Should robustly handle a Path no longer found in the model!

### Drag_Source_Drag_Data_Get

- Goto spec in source

    function Drag_Source_Drag_Data_Get (Drag_Source: Gtk_Tree_Drag_Source;Path: Gtk.Tree_Model.Gtk_Tree_Path;Selection_Data: Gtk.Selection.Selection_Data) return Boolean;

Asks the Drag_Source to fill in Selection_Data with a representation of the row at Path. Get_Target (Selection_Data) gives the required type of the data. Should robustly handle a Path no longer found in the model!

### Drag_Source_Row_Draggable

- Goto spec in source

    function Drag_Source_Row_Draggable (Drag_Source: Gtk_Tree_Drag_Source;Path: Gtk.Tree_Model.Gtk_Tree_Path) return Boolean;

Asks the Drag_Source whether a particular row can be used as the source of a DND operation. If the source doesn't implement this interface, the row is assumed draggable.

### Get_Row_Drag_Data

- Goto spec in source

    procedure Get_Row_Drag_Data (Selection_Data: Gtk.Selection.Selection_Data;Tree_Model: out Gtk.Tree_Model.Gtk_Tree_Model;Path: out Gtk.Tree_Model.Gtk_Tree_Path;Success: out Boolean);

Obtains a Tree_Model and Path from selection data of target type GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. This function can only be used if Selection_Data originates from the same process that's calling this function, because a pointer to the tree model is being passed around. If you aren't in the same process, then you'll get memory corruption. In the Gtk_Tree_Drag_Dest drag_data_received handler, you can assume that selection data of type GTK_TREE_MODEL_ROW is in from the current process. The returned path must be freed with

### Set_Row_Drag_Data

- Goto spec in source

    function Set_Row_Drag_Data (Selection_Data: Gtk.Selection.Selection_Data;Tree_Model: access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class;Path: Gtk.Tree_Model.Gtk_Tree_Path) return Boolean;

Sets selection data of target type GTK_TREE_MODEL_ROW. Normally used in a drag_data_get handler.