]> Pileus Git - ~andy/gtk/blob - gtk/gtktreednd.h
Small cleanups.
[~andy/gtk] / gtk / gtktreednd.h
1 /* gtktreednd.h
2  * Copyright (C) 2001  Red Hat, Inc.
3  *
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.
8  *
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.
13  *
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., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __GTK_TREE_DND_H__
21 #define __GTK_TREE_DND_H__
22
23 #include <gtk/gtktreemodel.h>
24 #include <gtk/gtkdnd.h>
25
26 G_BEGIN_DECLS
27
28 #define GTK_TYPE_TREE_DRAG_SOURCE            (gtk_tree_drag_source_get_type ())
29 #define GTK_TREE_DRAG_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_DRAG_SOURCE, GtkTreeDragSource))
30 #define GTK_IS_TREE_DRAG_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_DRAG_SOURCE))
31 #define GTK_TREE_DRAG_SOURCE_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_DRAG_SOURCE, GtkTreeDragSourceIface))
32
33 typedef struct _GtkTreeDragSource      GtkTreeDragSource; /* Dummy typedef */
34 typedef struct _GtkTreeDragSourceIface GtkTreeDragSourceIface;
35
36 struct _GtkTreeDragSourceIface
37 {
38   GTypeInterface g_iface;
39
40   /* VTable - not signals */
41
42   gboolean     (* row_draggable)        (GtkTreeDragSource   *drag_source,
43                                          GtkTreePath         *path);
44
45   gboolean     (* drag_data_get)        (GtkTreeDragSource   *drag_source,
46                                          GtkTreePath         *path,
47                                          GtkSelectionData    *selection_data);
48
49   gboolean     (* drag_data_delete)     (GtkTreeDragSource *drag_source,
50                                          GtkTreePath       *path);
51 };
52
53 GType           gtk_tree_drag_source_get_type   (void) G_GNUC_CONST;
54
55 /* Returns whether the given row can be dragged */
56 gboolean gtk_tree_drag_source_row_draggable    (GtkTreeDragSource *drag_source,
57                                                 GtkTreePath       *path);
58
59 /* Deletes the given row, or returns FALSE if it can't */
60 gboolean gtk_tree_drag_source_drag_data_delete (GtkTreeDragSource *drag_source,
61                                                 GtkTreePath       *path);
62
63 /* Fills in selection_data with type selection_data->target based on
64  * the row denoted by path, returns TRUE if it does anything
65  */
66 gboolean gtk_tree_drag_source_drag_data_get    (GtkTreeDragSource *drag_source,
67                                                 GtkTreePath       *path,
68                                                 GtkSelectionData  *selection_data);
69
70 #define GTK_TYPE_TREE_DRAG_DEST            (gtk_tree_drag_dest_get_type ())
71 #define GTK_TREE_DRAG_DEST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_DRAG_DEST, GtkTreeDragDest))
72 #define GTK_IS_TREE_DRAG_DEST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_DRAG_DEST))
73 #define GTK_TREE_DRAG_DEST_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_DRAG_DEST, GtkTreeDragDestIface))
74
75 typedef struct _GtkTreeDragDest      GtkTreeDragDest; /* Dummy typedef */
76 typedef struct _GtkTreeDragDestIface GtkTreeDragDestIface;
77
78 struct _GtkTreeDragDestIface
79 {
80   GTypeInterface g_iface;
81
82   /* VTable - not signals */
83
84   gboolean     (* drag_data_received) (GtkTreeDragDest   *drag_dest,
85                                        GtkTreePath       *dest,
86                                        GtkSelectionData  *selection_data);
87
88   gboolean     (* row_drop_possible)  (GtkTreeDragDest   *drag_dest,
89                                        GtkTreePath       *dest_path,
90                                        GtkSelectionData  *selection_data);
91 };
92
93 GType           gtk_tree_drag_dest_get_type   (void) G_GNUC_CONST;
94
95 /* Inserts a row before dest which contains data in selection_data,
96  * or returns FALSE if it can't
97  */
98 gboolean gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest   *drag_dest,
99                                                 GtkTreePath       *dest,
100                                                 GtkSelectionData  *selection_data);
101
102
103 /* Returns TRUE if we can drop before path; path may not exist. */
104 gboolean gtk_tree_drag_dest_row_drop_possible  (GtkTreeDragDest   *drag_dest,
105                                                 GtkTreePath       *dest_path,
106                                                 GtkSelectionData  *selection_data);
107
108
109 /* The selection data would normally have target type GTK_TREE_MODEL_ROW in this
110  * case. If the target is wrong these functions return FALSE.
111  */
112 gboolean gtk_tree_set_row_drag_data            (GtkSelectionData  *selection_data,
113                                                 GtkTreeModel      *tree_model,
114                                                 GtkTreePath       *path);
115 gboolean gtk_tree_get_row_drag_data            (GtkSelectionData  *selection_data,
116                                                 GtkTreeModel     **tree_model,
117                                                 GtkTreePath      **path);
118
119 G_END_DECLS
120
121 #endif /* __GTK_TREE_DND_H__ */