]> Pileus Git - ~andy/gtk/blob - gtk/gtkdnd.h
399a0390de488bb30ee6205e1d073809f8daff36
[~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 #pragma }
30 #endif /* __cplusplus */
31
32 typedef enum {
33   GTK_DEST_DEFAULT_MOTION     = 1 << 0, /* respond to "drag_motion" */
34   GTK_DEST_DEFAULT_HIGHLIGHT  = 1 << 1, /* auto-highlight */
35   GTK_DEST_DEFAULT_DROP       = 1 << 2, /* respond to "drag_drop" */
36   GTK_DEST_DEFAULT_ALL        = 0x07
37 } GtkDestDefaults;
38
39 /* Destination side */
40
41 void gtk_drag_get_data (GtkWidget      *widget,
42                         GdkDragContext *context,
43                         GdkAtom         target,
44                         guint32         time);
45 void gtk_drag_finish   (GdkDragContext *context,
46                         gboolean        success,
47                         gboolean        del,
48                         guint32         time);
49
50 void gtk_drag_highlight   (GtkWidget  *widget);
51 void gtk_drag_unhighlight (GtkWidget  *widget);
52
53 void gtk_drag_dest_set   (GtkWidget          *widget,
54                           GtkDestDefaults     flags,
55                           GtkTargetEntry     *targets,
56                           gint                n_targets,
57                           GdkDragAction       actions);
58
59 void gtk_drag_dest_set_proxy (GtkWidget      *widget,
60                               GdkWindow      *proxy_window,
61                               GdkDragProtocol protocol,
62                               gboolean        use_coordinates);
63
64 /* There probably should be functions for setting the targets
65  * as a GtkTargetList
66  */
67
68 void gtk_drag_dest_unset (GtkWidget          *widget);
69
70 /* Source side */
71
72 void gtk_drag_source_set  (GtkWidget         *widget,
73                            GdkModifierType    start_button_mask,
74                            GtkTargetEntry    *targets,
75                            gint               n_targets,
76                            GdkDragAction      actions);
77
78 void gtk_drag_source_set_icon (GtkWidget     *widget,
79                                GdkColormap   *colormap,
80                                GdkPixmap     *pixmap,
81                                GdkBitmap     *mask);
82
83 /* There probably should be functions for setting the targets
84  * as a GtkTargetList
85  */
86
87 GdkDragContext *gtk_drag_begin (GtkWidget         *widget,
88                                 GtkTargetList     *targets,
89                                 GdkDragAction      actions,
90                                 gint               button,
91                                 GdkEvent          *event);
92
93 /* Set the image being dragged around
94  */
95 void gtk_drag_set_icon_widget  (GdkDragContext    *context,
96                                 GtkWidget         *widget,
97                                 gint               hot_x,
98                                 gint               hot_y);
99
100 void gtk_drag_set_icon_pixmap  (GdkDragContext    *context,
101                                 GdkColormap       *colormap,
102                                 GdkPixmap         *pixmap,
103                                 GdkBitmap         *mask,
104                                 gint               hot_x,
105                                 gint               hot_y);
106
107 void gtk_drag_set_icon_default (GdkDragContext    *context);
108
109 void gtk_drag_set_default_icon (GdkColormap   *colormap,
110                                 GdkPixmap     *pixmap,
111                                 GdkBitmap     *mask,
112                                 gint           hot_x,
113                                 gint           hot_y);
114
115
116 /* Internal functions */
117 void gtk_drag_source_handle_event (GtkWidget *widget,
118                                    GdkEvent  *event);
119 void gtk_drag_dest_handle_event (GtkWidget *toplevel,
120                                  GdkEvent  *event);
121
122 #ifdef __cplusplus
123 }
124 #endif /* __cplusplus */
125
126 #endif /* __GTK_DND_H__ */
127
128
129