Graphics.UI.Gtk.ModelView.TreeDrag

gtk-0.12.4: Binding to the Gtk+ graphical user interface library.

Portability | portable (depends on GHC)
Stability | provisional
Maintainer | gtk2hs-users@lists.sourceforge.net
Safe Haskell | None

Graphics.UI.Gtk.ModelView.TreeDrag

Contents

- Detail
- DND information for exchanging a model and a path.

Description

Interfaces for drag-and-drop support in `TreeView`.

Synopsis

- treeModelEqual :: (TreeModelClass tm1, TreeModelClass tm2) => tm1 -> tm2 -> Bool
- targetTreeModelRow :: TargetTag
- treeGetRowDragData :: SelectionDataM (Maybe (TreeModel, TreePath))
- treeSetRowDragData :: TreeModelClass treeModel => treeModel -> TreePath -> SelectionDataM Bool

# Detail

`TreeView`s provide special support for Drag-and-Drop such as hover-to-open-rows or autoscrolling. This module implements two utility functions that set and get a path and a model in a `Selection` structure. These functions are thus useful to implement drag-and-drop functionality in a `TreeModel`. In fact, they are used as part of the default drag-and-drop interfaces of `ListStore` and `TreeStore` that allows to permute rows and move them between hierarchy levels.

# DND information for exchanging a model and a path.

treeModelEqual :: (TreeModelClass tm1, TreeModelClass tm2) => tm1 -> tm2 -> Bool

targetTreeModelRow :: TargetTag

The `SelectionTag`, `TargetTag` and `SelectionTypeTag` of the DND mechanism of `ListStore` and `TreeStore`. This tag is used by `treeGetRowDragData` and `treeSetRowDragData` to store a store and a `TreePath` in a `SelectionDataM`. This target should be added to a `TargetList` using `TargetSameWidget` flag and an `InfoId` of `0`.

treeGetRowDragData :: SelectionDataM (Maybe (TreeModel, TreePath))

Obtains a `TreeModel` and a path from `SelectionDataM` whenever the target is `targetTreeModelRow`. Normally called from a `treeDragDestDragDataReceived` handler.

treeSetRowDragData :: TreeModelClass treeModel => treeModel -> TreePath -> SelectionDataM Bool

Sets selection data with the target `targetTreeModelRow`, consisting of a `TreeModel` and a `TreePath`. Normally used in a `treeDragSourceDragDataGet` handler.

- Returns `True` if setting the data was successful.