1/* -*- Mode: C; c-file-style: "gnu"; tab-width: 8 -*- */
2/* GTK - The GIMP Toolkit
3 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
20
21/*
22 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
23 * file for a list of people on the GTK+ Team. See the ChangeLog
24 * files for a list of changes. These files are distributed with
25 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
26 */
27
28#ifndef __GTK_DND_H__
29#define __GTK_DND_H__
30
31
32#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
33#error "Only <gtk/gtk.h> can be included directly."
34#endif
35
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkselection.h>
38
39
40G_BEGIN_DECLS
41
42typedef enum {
43 GTK_DEST_DEFAULT_MOTION = 1 << 0, /* respond to "drag_motion" */
44 GTK_DEST_DEFAULT_HIGHLIGHT = 1 << 1, /* auto-highlight */
45 GTK_DEST_DEFAULT_DROP = 1 << 2, /* respond to "drag_drop" */
46 GTK_DEST_DEFAULT_ALL = 0x07
47} GtkDestDefaults;
48
49/* Flags for the GtkTargetEntry on the destination side
50 */
51typedef enum {
52 GTK_TARGET_SAME_APP = 1 << 0, /*< nick=same-app >*/
53 GTK_TARGET_SAME_WIDGET = 1 << 1, /*< nick=same-widget >*/
54 GTK_TARGET_OTHER_APP = 1 << 2, /*< nick=other-app >*/
55 GTK_TARGET_OTHER_WIDGET = 1 << 3 /*< nick=other-widget >*/
56} GtkTargetFlags;
57
58/* Destination side */
59
60void gtk_drag_get_data (GtkWidget *widget,
61 GdkDragContext *context,
62 GdkAtom target,
63 guint32 time_);
64void gtk_drag_finish (GdkDragContext *context,
65 gboolean success,
66 gboolean del,
67 guint32 time_);
68
69GtkWidget *gtk_drag_get_source_widget (GdkDragContext *context);
70
71void gtk_drag_highlight (GtkWidget *widget);
72void gtk_drag_unhighlight (GtkWidget *widget);
73
74void gtk_drag_dest_set (GtkWidget *widget,
75 GtkDestDefaults flags,
76 const GtkTargetEntry *targets,
77 gint n_targets,
78 GdkDragAction actions);
79
80void gtk_drag_dest_set_proxy (GtkWidget *widget,
81 GdkWindow *proxy_window,
82 GdkDragProtocol protocol,
83 gboolean use_coordinates);
84
85void gtk_drag_dest_unset (GtkWidget *widget);
86
87GdkAtom gtk_drag_dest_find_target (GtkWidget *widget,
88 GdkDragContext *context,
89 GtkTargetList *target_list);
90GtkTargetList* gtk_drag_dest_get_target_list (GtkWidget *widget);
91void gtk_drag_dest_set_target_list (GtkWidget *widget,
92 GtkTargetList *target_list);
93void gtk_drag_dest_add_text_targets (GtkWidget *widget);
94void gtk_drag_dest_add_image_targets (GtkWidget *widget);
95void gtk_drag_dest_add_uri_targets (GtkWidget *widget);
96
97void gtk_drag_dest_set_track_motion (GtkWidget *widget,
98 gboolean track_motion);
99gboolean gtk_drag_dest_get_track_motion (GtkWidget *widget);
100
101/* Source side */
102
103void gtk_drag_source_set (GtkWidget *widget,
104 GdkModifierType start_button_mask,
105 const GtkTargetEntry *targets,
106 gint n_targets,
107 GdkDragAction actions);
108
109void gtk_drag_source_unset (GtkWidget *widget);
110
111GtkTargetList* gtk_drag_source_get_target_list (GtkWidget *widget);
112void gtk_drag_source_set_target_list (GtkWidget *widget,
113 GtkTargetList *target_list);
114void gtk_drag_source_add_text_targets (GtkWidget *widget);
115void gtk_drag_source_add_image_targets (GtkWidget *widget);
116void gtk_drag_source_add_uri_targets (GtkWidget *widget);
117
118void gtk_drag_source_set_icon (GtkWidget *widget,
119 GdkColormap *colormap,
120 GdkPixmap *pixmap,
121 GdkBitmap *mask);
122void gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
123 GdkPixbuf *pixbuf);
124void gtk_drag_source_set_icon_stock (GtkWidget *widget,
125 const gchar *stock_id);
126void gtk_drag_source_set_icon_name (GtkWidget *widget,
127 const gchar *icon_name);
128
129/* There probably should be functions for setting the targets
130 * as a GtkTargetList
131 */
132
133GdkDragContext *gtk_drag_begin (GtkWidget *widget,
134 GtkTargetList *targets,
135 GdkDragAction actions,
136 gint button,
137 GdkEvent *event);
138
139/* Set the image being dragged around
140 */
141void gtk_drag_set_icon_widget (GdkDragContext *context,
142 GtkWidget *widget,
143 gint hot_x,
144 gint hot_y);
145void gtk_drag_set_icon_pixmap (GdkDragContext *context,
146 GdkColormap *colormap,
147 GdkPixmap *pixmap,
148 GdkBitmap *mask,
149 gint hot_x,
150 gint hot_y);
151void gtk_drag_set_icon_pixbuf (GdkDragContext *context,
152 GdkPixbuf *pixbuf,
153 gint hot_x,
154 gint hot_y);
155void gtk_drag_set_icon_stock (GdkDragContext *context,
156 const gchar *stock_id,
157 gint hot_x,
158 gint hot_y);
159void gtk_drag_set_icon_name (GdkDragContext *context,
160 const gchar *icon_name,
161 gint hot_x,
162 gint hot_y);
163
164void gtk_drag_set_icon_default (GdkDragContext *context);
165
166gboolean gtk_drag_check_threshold (GtkWidget *widget,
167 gint start_x,
168 gint start_y,
169 gint current_x,
170 gint current_y);
171
172/* Internal functions */
173void _gtk_drag_source_handle_event (GtkWidget *widget,
174 GdkEvent *event);
175void _gtk_drag_dest_handle_event (GtkWidget *toplevel,
176 GdkEvent *event);
177
178#ifndef GTK_DISABLE_DEPRECATED
179void gtk_drag_set_default_icon (GdkColormap *colormap,
180 GdkPixmap *pixmap,
181 GdkBitmap *mask,
182 gint hot_x,
183 gint hot_y);
184#endif /* !GTK_DISABLE_DEPRECATED */
185
186G_END_DECLS
187
188#endif /* __GTK_DND_H__ */
189