2 * Copyright (C) 2001 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301 USA.
20 #ifndef __RB_TREE_DND_H__
21 #define __RB_TREE_DND_H__
23 #include <gtk/gtktreemodel.h>
24 #include <gtk/gtktreeview.h>
25 #include <gtk/gtkdnd.h>
29 #define RB_TYPE_TREE_DRAG_SOURCE (rb_tree_drag_source_get_type ())
30 #define RB_TREE_DRAG_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RB_TYPE_TREE_DRAG_SOURCE, RbTreeDragSource))
31 #define RB_IS_TREE_DRAG_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RB_TYPE_TREE_DRAG_SOURCE))
32 #define RB_TREE_DRAG_SOURCE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RB_TYPE_TREE_DRAG_SOURCE, RbTreeDragSourceIface))
34 #define RB_TYPE_TREE_DRAG_DEST (rb_tree_drag_dest_get_type ())
35 #define RB_TREE_DRAG_DEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RB_TYPE_TREE_DRAG_DEST, RbTreeDragDest))
36 #define RB_IS_TREE_DRAG_DEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RB_TYPE_TREE_DRAG_DEST))
37 #define RB_TREE_DRAG_DEST_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RB_TYPE_TREE_DRAG_DEST, RbTreeDragDestIface))
40 typedef struct _RbTreeDragSource RbTreeDragSource
; /* Dummy typedef */
41 typedef struct _RbTreeDragSourceIface RbTreeDragSourceIface
;
44 typedef struct _RbTreeDragDest RbTreeDragDest
; /* Dummy typedef */
45 typedef struct _RbTreeDragDestIface RbTreeDragDestIface
;
48 RB_TREE_DEST_EMPTY_VIEW_DROP
= 1 << 0,
49 RB_TREE_DEST_CAN_DROP_INTO
= 1 << 1,
50 RB_TREE_DEST_CAN_DROP_BETWEEN
= 1 << 2,
51 RB_TREE_DEST_SELECT_ON_DRAG_TIMEOUT
= 1 << 3
55 struct _RbTreeDragSourceIface
57 GTypeInterface g_iface
;
59 /* VTable - not signals */
60 gboolean (* row_draggable
) (RbTreeDragSource
*drag_source
,
63 gboolean (* drag_data_get
) (RbTreeDragSource
*drag_source
,
65 GtkSelectionData
*selection_data
);
67 gboolean (* drag_data_delete
) (RbTreeDragSource
*drag_source
,
72 struct _RbTreeDragDestIface
{
74 GTypeInterface g_iface
;
76 /* VTable - not signals */
78 gboolean (* drag_data_received
) (RbTreeDragDest
*drag_dest
,
80 GtkTreeViewDropPosition pos
,
81 GtkSelectionData
*selection_data
);
83 gboolean (* row_drop_possible
) (RbTreeDragDest
*drag_dest
,
84 GtkTreePath
*dest_path
,
85 GtkTreeViewDropPosition pos
,
86 GtkSelectionData
*selection_data
);
88 gboolean (* row_drop_position
) (RbTreeDragDest
*drag_dest
,
89 GtkTreePath
*dest_path
,
91 GtkTreeViewDropPosition
*pos
);
94 GdkAtom (* get_drag_target
) (RbTreeDragDest
*drag_dest
,
96 GdkDragContext
*context
,
97 GtkTreePath
*dest_path
,
98 GtkTargetList
*target_list
);
102 GType
rb_tree_drag_source_get_type (void) G_GNUC_CONST
;
105 /* Returns whether the given row can be dragged */
106 gboolean
rb_tree_drag_source_row_draggable (RbTreeDragSource
*drag_source
,
109 /* Deletes the given row, or returns FALSE if it can't */
110 gboolean
rb_tree_drag_source_drag_data_delete (RbTreeDragSource
*drag_source
,
113 /* Fills in selection_data with type selection_data->target based on the row
114 * denoted by path, returns TRUE if it does anything
116 gboolean
rb_tree_drag_source_drag_data_get (RbTreeDragSource
*drag_source
,
118 GtkSelectionData
*selection_data
);
121 GType
rb_tree_drag_dest_get_type (void) G_GNUC_CONST
;
124 gboolean
rb_tree_drag_dest_drag_data_received (RbTreeDragDest
*drag_dest
,
126 GtkTreeViewDropPosition pos
,
127 GtkSelectionData
*selection_data
);
129 gboolean
rb_tree_drag_dest_row_drop_possible (RbTreeDragDest
*drag_dest
,
130 GtkTreePath
*dest_path
,
131 GtkTreeViewDropPosition pos
,
132 GtkSelectionData
*selection_data
);
134 gboolean
rb_tree_drag_dest_row_drop_position (RbTreeDragDest
*drag_dest
,
135 GtkTreePath
*dest_path
,
137 GtkTreeViewDropPosition
*pos
);
141 void rb_tree_dnd_add_drag_dest_support (GtkTreeView
*tree_view
,
142 RbTreeDestFlag flags
,
143 const GtkTargetEntry
*targets
,
145 GdkDragAction actions
);
147 void rb_tree_dnd_add_drag_source_support (GtkTreeView
*tree_view
,
148 GdkModifierType start_button_mask
,
149 const GtkTargetEntry
*targets
,
151 GdkDragAction actions
);
156 #endif /* __RB_TREE_DND_H__ */