]> Pileus Git - ~andy/gtk/blob - gtk/gtkdnd.h
90513d51a9c783901238be8ba96b683fb44c12af
[~andy/gtk] / gtk / gtkdnd.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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 #ifndef __GTK_DND_H__
20 #define __GTK_DND_H__
21
22 #include <gdk/gdk.h>
23 #include <gtk/gtkenums.h>
24 #include <gtk/gtkwidget.h>
25 #include <gtk/gtkselection.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31 typedef enum {
32   GTK_DEST_DEFAULT_MOTION     = 1 << 0, /* respond to "drag_motion" */
33   GTK_DEST_DEFAULT_HIGHLIGHT  = 1 << 1, /* auto-highlight */
34   GTK_DEST_DEFAULT_DROP       = 1 << 2, /* respond to "drag_drop" */
35   GTK_DEST_DEFAULT_ALL        = 0x07
36 } GtkDestDefaults;
37
38 /* Flags for the GtkTargetEntry on the destination side 
39  */
40 typedef enum {
41   GTK_TARGET_SAME_APP = 1 << 0,    /*< nick=same-app >*/
42   GTK_TARGET_SAME_WIDGET = 1 << 1  /*< nick=same-widget >*/
43 } GtkTargetFlags;
44
45 /* Destination side */
46
47 void gtk_drag_get_data (GtkWidget      *widget,
48                         GdkDragContext *context,
49                         GdkAtom         target,
50                         guint32         time);
51 void gtk_drag_finish   (GdkDragContext *context,
52                         gboolean        success,
53                         gboolean        del,
54                         guint32         time);
55
56 GtkWidget *gtk_drag_get_source_widget (GdkDragContext *context);
57
58 void gtk_drag_highlight   (GtkWidget  *widget);
59 void gtk_drag_unhighlight (GtkWidget  *widget);
60
61 void gtk_drag_dest_set   (GtkWidget            *widget,
62                           GtkDestDefaults       flags,
63                           const GtkTargetEntry *targets,
64                           gint                  n_targets,
65                           GdkDragAction         actions);
66
67 void gtk_drag_dest_set_proxy (GtkWidget      *widget,
68                               GdkWindow      *proxy_window,
69                               GdkDragProtocol protocol,
70                               gboolean        use_coordinates);
71
72 /* There probably should be functions for setting the targets
73  * as a GtkTargetList
74  */
75
76 void gtk_drag_dest_unset (GtkWidget          *widget);
77
78 /* Source side */
79
80 void gtk_drag_source_set  (GtkWidget            *widget,
81                            GdkModifierType       start_button_mask,
82                            const GtkTargetEntry *targets,
83                            gint                  n_targets,
84                            GdkDragAction         actions);
85
86 void gtk_drag_source_unset (GtkWidget        *widget);
87
88 void gtk_drag_source_set_icon (GtkWidget     *widget,
89                                GdkColormap   *colormap,
90                                GdkPixmap     *pixmap,
91                                GdkBitmap     *mask);
92
93 /* There probably should be functions for setting the targets
94  * as a GtkTargetList
95  */
96
97 GdkDragContext *gtk_drag_begin (GtkWidget         *widget,
98                                 GtkTargetList     *targets,
99                                 GdkDragAction      actions,
100                                 gint               button,
101                                 GdkEvent          *event);
102
103 /* Set the image being dragged around
104  */
105 void gtk_drag_set_icon_widget  (GdkDragContext    *context,
106                                 GtkWidget         *widget,
107                                 gint               hot_x,
108                                 gint               hot_y);
109
110 void gtk_drag_set_icon_pixmap  (GdkDragContext    *context,
111                                 GdkColormap       *colormap,
112                                 GdkPixmap         *pixmap,
113                                 GdkBitmap         *mask,
114                                 gint               hot_x,
115                                 gint               hot_y);
116
117 void gtk_drag_set_icon_default (GdkDragContext    *context);
118
119 void gtk_drag_set_default_icon (GdkColormap   *colormap,
120                                 GdkPixmap     *pixmap,
121                                 GdkBitmap     *mask,
122                                 gint           hot_x,
123                                 gint           hot_y);
124
125
126 /* Internal functions */
127 void gtk_drag_source_handle_event (GtkWidget *widget,
128                                    GdkEvent  *event);
129 void gtk_drag_dest_handle_event (GtkWidget *toplevel,
130                                  GdkEvent  *event);
131
132 #ifdef __cplusplus
133 }
134 #endif /* __cplusplus */
135
136 #endif /* __GTK_DND_H__ */
137
138
139