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