## rb-tree-dnd

rb-tree-dnd

## Synopsis

    #define             RB_TYPE_TREE_DRAG_DEST
    #define             RB_TREE_DRAG_DEST                   (obj)
    #define             RB_IS_TREE_DRAG_DEST                (obj)
    #define             RB_TREE_DRAG_DEST_GET_IFACE         (obj)
                        RbTreeDragSource;
                        RbTreeDragSourceIface;
                        RbTreeDragDest;
                        RbTreeDragDestIface;
    enum                RbTreeDestFlag;
    gboolean            rb_tree_drag_source_row_draggable   (RbTreeDragSource *drag_source,
                                                             GList *path_list);
    gboolean            rb_tree_drag_source_drag_data_delete
                                                            (RbTreeDragSource *drag_source,
                                                             GList *path_list);
    gboolean            rb_tree_drag_source_drag_data_get   (RbTreeDragSource *drag_source,
                                                             GList *path_list,
                                                             GtkSelectionData *selection_data);
    GType               rb_tree_drag_dest_get_type          (void);
    gboolean            rb_tree_drag_dest_drag_data_received
                                                            (RbTreeDragDest *drag_dest,
                                                             GtkTreePath *dest,
                                                             GtkTreeViewDropPosition pos,
                                                             GtkSelectionData *selection_data);
    gboolean            rb_tree_drag_dest_row_drop_possible (RbTreeDragDest *drag_dest,
                                                             GtkTreePath *dest_path,
                                                             GtkTreeViewDropPosition pos,
                                                             GtkSelectionData *selection_data);
    gboolean            rb_tree_drag_dest_row_drop_position (RbTreeDragDest *drag_dest,
                                                             GtkTreePath *dest_path,
                                                             GList *targets,
                                                             GtkTreeViewDropPosition *pos);
    void                rb_tree_dnd_add_drag_dest_support   (GtkTreeView *tree_view,
                                                             RbTreeDestFlag flags,
                                                             const GtkTargetEntry *targets,
                                                             gint n_targets,
                                                             GdkDragAction actions);
    void                rb_tree_dnd_add_drag_source_support (GtkTreeView *tree_view,
                                                             GdkModifierType start_button_mask,
                                                             const GtkTargetEntry *targets,
                                                             gint n_targets,
                                                             GdkDragAction actions);

## Object Hierarchy

      GInterface
       +----RbTreeDragSource

      GInterface
       +----RbTreeDragDest

## Description

## Details

### RB_TYPE_TREE_DRAG_DEST

    #define             RB_TYPE_TREE_DRAG_DEST

### RB_TREE_DRAG_DEST()

    #define             RB_TREE_DRAG_DEST(obj)

`obj` : |

### RB_IS_TREE_DRAG_DEST()

    #define             RB_IS_TREE_DRAG_DEST(obj)

`obj` : |

### RB_TREE_DRAG_DEST_GET_IFACE()

    #define             RB_TREE_DRAG_DEST_GET_IFACE(obj)

`obj` : |

### RbTreeDragSource

    typedef struct _RbTreeDragSource RbTreeDragSource;

### RbTreeDragSourceIface

    typedef struct {
    	GTypeInterface g_iface;

    	/* VTable - not signals */
    	gboolean     (* rb_row_draggable)        (RbTreeDragSource   *drag_source,
    	                              GList              *path_list);

    	gboolean     (* rb_drag_data_get)        (RbTreeDragSource   *drag_source,
                                             GList              *path_list,
                                             GtkSelectionData   *selection_data);

    	gboolean     (* rb_drag_data_delete)     (RbTreeDragSource *drag_source,
                                             GList            *path_list);
    } RbTreeDragSourceIface;

### RbTreeDragDest

    typedef struct _RbTreeDragDest RbTreeDragDest;

### RbTreeDragDestIface

    typedef struct {
    	GTypeInterface g_iface;

    	/* VTable - not signals */

    	gboolean (* rb_drag_data_received) (RbTreeDragDest   *drag_dest,
    					 GtkTreePath       *dest,
    					 GtkTreeViewDropPosition pos,
    					 GtkSelectionData  *selection_data);

    	gboolean (* rb_row_drop_possible)  (RbTreeDragDest   *drag_dest,
    					 GtkTreePath       *dest_path,
    					 GtkTreeViewDropPosition pos,
    					 GtkSelectionData  *selection_data);

    	gboolean (* rb_row_drop_position) (RbTreeDragDest   *drag_dest,
    					GtkTreePath       *dest_path,
    					GList *targets,
    					GtkTreeViewDropPosition *pos);

    	/* optional */
    	GdkAtom  (* rb_get_drag_target)    (RbTreeDragDest   *drag_dest,
    					 GtkWidget        *widget,
    					 GdkDragContext   *context,
    					 GtkTreePath      *dest_path,
    					 GtkTargetList    *target_list);
    } RbTreeDragDestIface;

### enum RbTreeDestFlag

    typedef enum {
    	RB_TREE_DEST_EMPTY_VIEW_DROP = 1 << 0,
    	RB_TREE_DEST_CAN_DROP_INTO = 1 << 1,
    	RB_TREE_DEST_CAN_DROP_BETWEEN = 1 << 2,
    	RB_TREE_DEST_SELECT_ON_DRAG_TIMEOUT = 1 << 3
    } RbTreeDestFlag;

### rb_tree_drag_source_row_draggable ()

    gboolean            rb_tree_drag_source_row_draggable   (RbTreeDragSource *drag_source,
                                                             GList *path_list);

Asks the EggTreeMultiDragSource 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.

`drag_source` : | a EggTreeMultiDragSource
`path_list` : |
Returns : | `TRUE` if the row can be dragged

### rb_tree_drag_source_drag_data_delete ()

    gboolean            rb_tree_drag_source_drag_data_delete
                                                            (RbTreeDragSource *drag_source,
                                                             GList *path_list);

Asks the EggTreeMultiDragSource 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` : | a EggTreeMultiDragSource
`path_list` : |
Returns : | `TRUE` if the row was successfully deleted

### rb_tree_drag_source_drag_data_get ()

    gboolean            rb_tree_drag_source_drag_data_get   (RbTreeDragSource *drag_source,
                                                             GList *path_list,
                                                             GtkSelectionData *selection_data);

Asks the EggTreeMultiDragSource to fill in `selection_data` with a representation of the row at `path`. `selection_data->target` gives the required type of the data. Should robustly handle a `path` no longer found in the model!

`drag_source` : | a EggTreeMultiDragSource
`path_list` : |
`selection_data` : | a EggSelectionData to fill with data from the dragged row
Returns : | `TRUE` if data of the required type was provided

### rb_tree_drag_dest_get_type ()

    GType               rb_tree_drag_dest_get_type          (void);

Returns : |

### rb_tree_drag_dest_drag_data_received ()

    gboolean            rb_tree_drag_dest_drag_data_received
                                                            (RbTreeDragDest *drag_dest,
                                                             GtkTreePath *dest,
                                                             GtkTreeViewDropPosition pos,
                                                             GtkSelectionData *selection_data);

`drag_dest` : |
`dest` : |
`pos` : |
`selection_data` : |
Returns : |

### rb_tree_drag_dest_row_drop_possible ()

    gboolean            rb_tree_drag_dest_row_drop_possible (RbTreeDragDest *drag_dest,
                                                             GtkTreePath *dest_path,
                                                             GtkTreeViewDropPosition pos,
                                                             GtkSelectionData *selection_data);

`drag_dest` : |
`dest_path` : |
`pos` : |
`selection_data` : |
Returns : |

### rb_tree_drag_dest_row_drop_position ()

    gboolean            rb_tree_drag_dest_row_drop_position (RbTreeDragDest *drag_dest,
                                                             GtkTreePath *dest_path,
                                                             GList *targets,
                                                             GtkTreeViewDropPosition *pos);

`drag_dest` : |
`dest_path` : |
`targets` : |
`pos` : |
Returns : |

### rb_tree_dnd_add_drag_dest_support ()

    void                rb_tree_dnd_add_drag_dest_support   (GtkTreeView *tree_view,
                                                             RbTreeDestFlag flags,
                                                             const GtkTargetEntry *targets,
                                                             gint n_targets,
                                                             GdkDragAction actions);

`tree_view` : |
`flags` : |
`targets` : |
`n_targets` : |
`actions` : |

### rb_tree_dnd_add_drag_source_support ()

    void                rb_tree_dnd_add_drag_source_support (GtkTreeView *tree_view,
                                                             GdkModifierType start_button_mask,
                                                             const GtkTargetEntry *targets,
                                                             gint n_targets,
                                                             GdkDragAction actions);

`tree_view` : |
`start_button_mask` : |
`targets` : |
`n_targets` : |
`actions` : |