Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::TreeDragSource Class Reference

A GtkTreeDragSource C++ wrapper class. More...

`#include <xfc/gtk/treednd.hh>`

Inheritance diagram for Xfc::Gtk::TreeDragSource:

List of all members.

## Public Member Functions

Accessors

- GtkTreeDragSource * gtk_tree_drag_source () const
    Get a pointer to the GtkTreeDragSource structure.
- operator GtkTreeDragSource * () const
    Conversion operator; safely converts a TreeDragSource to a GtkTreeDragSource pointer.
- bool row_draggable (const TreePath &path) const
    Determines whether a particular row can be used as the source of a DND operation.

Methods

- bool drag_data_delete (TreePath &path)
    Asks the TreeDragSource to delete the row at path, because it was moved somewhere else via drag-and-drop.
- bool drag_data_get (const TreePath &path, SelectionData &selection_data)
    Asks the TreeDragSource to fill in selection_data with a representation of the row at path.

## Protected Member Functions

Constructors

- TreeDragSource ()
    Constructs a new TreeDragSource object.
- virtual ~TreeDragSource ()=0
    Destructor.

## Detailed Description

A GtkTreeDragSource C++ wrapper class.

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::TreeView::set_drag_dest_row(), Gtk::TreeView::get_drag_dest_row(), Gtk::TreeView::get_dest_row_at_pos() and Gtk::TreeView::create_row_drag_icon(). 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 TreeDragSource and TreeDragDest API, then all the bookkeeping of rows is done for you, as well as things like hover-to-open and auto-scroll. The TreeDragSource interface is implemented by Gtk::TreeModelSort, Gtk::TreeStore, Gtk::ListStore and Gtk::TreeModelFilter. The TreeDragDest interface is implemented by Gtk::TreeStore and Gtk::ListStore.

## Member Function Documentation

bool Xfc::Gtk::TreeDragSource::drag_data_delete | ( | TreePath & | path | ) |

Asks the TreeDragSource to delete the row at path, because it was moved somewhere else via drag-and-drop.

Parameters:

  | path | The row that was being dragged.

Returns:
  true if the row was successfully deleted.

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!

bool Xfc::Gtk::TreeDragSource::drag_data_get | ( | const TreePath & | path,
|  | SelectionData & | selection_data
| ) |

Asks the TreeDragSource to fill in selection_data with a representation of the row at path.

Parameters:

  | path | The row that was dragged.
  | selection_data | A Gtk::SelectionData to fill with data from the dragged row

Returns:
  true if data of the required type was provided.

Note, selection_data->get_target() gives the required type of the data. Should robustly handle a path no longer found in the model!

bool Xfc::Gtk::TreeDragSource::row_draggable | ( | const TreePath & | path | ) | const

Determines whether a particular row can be used as the source of a DND operation.

Parameters:

  | path | The row on which user is initiating a drag.

Returns:
  true if the row can be dragged.

If the source doesn't implement this interface, the row is assumed draggable.

The documentation for this class was generated from the following file:

- treednd.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3