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
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.
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.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
21 * file for a list of people on the GTK+ Team. See the ChangeLog
22 * files for a list of changes. These files are distributed with
23 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
26 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
27 #error "Only <gtk/gtk.h> can be included directly."
34 #include <gtk/gtkwidget.h>
35 #include <gtk/gtkselection.h>
42 * @GTK_DEST_DEFAULT_MOTION: If set for a widget, GTK+, during a drag over this
43 * widget will check if the drag matches this widget's list of possible targets
45 * GTK+ will then call gdk_drag_status() as appropriate.
46 * @GTK_DEST_DEFAULT_HIGHLIGHT: If set for a widget, GTK+ will draw a highlight on
47 * this widget as long as a drag is over this widget and the widget drag format
48 * and action are acceptable.
49 * @GTK_DEST_DEFAULT_DROP: If set for a widget, when a drop occurs, GTK+ will
50 * will check if the drag matches this widget's list of possible targets and
51 * actions. If so, GTK+ will call gtk_drag_get_data() on behalf of the widget.
52 * Whether or not the drop is successful, GTK+ will call gtk_drag_finish(). If
53 * the action was a move, then if the drag was successful, then %TRUE will be
54 * passed for the @delete parameter to gtk_drag_finish().
55 * @GTK_DEST_DEFAULT_ALL: If set, specifies that all default actions should
58 * The #GtkDestDefaults enumeration specifies the various
59 * types of action that will be taken on behalf
60 * of the user for a drag destination site.
63 GTK_DEST_DEFAULT_MOTION = 1 << 0, /* respond to "drag_motion" */
64 GTK_DEST_DEFAULT_HIGHLIGHT = 1 << 1, /* auto-highlight */
65 GTK_DEST_DEFAULT_DROP = 1 << 2, /* respond to "drag_drop" */
66 GTK_DEST_DEFAULT_ALL = 0x07
71 * @GTK_TARGET_SAME_APP: If this is set, the target will only be selected
72 * for drags within a single application.
73 * @GTK_TARGET_SAME_WIDGET: If this is set, the target will only be selected
74 * for drags within a single widget.
75 * @GTK_TARGET_OTHER_APP: If this is set, the target will not be selected
76 * for drags within a single application.
77 * @GTK_TARGET_OTHER_WIDGET: If this is set, the target will not be selected
78 * for drags withing a single widget.
80 * The #GtkTargetFlags enumeration is used to specify
81 * constraints on an entry in a #GtkTargetTable.
84 GTK_TARGET_SAME_APP = 1 << 0, /*< nick=same-app >*/
85 GTK_TARGET_SAME_WIDGET = 1 << 1, /*< nick=same-widget >*/
86 GTK_TARGET_OTHER_APP = 1 << 2, /*< nick=other-app >*/
87 GTK_TARGET_OTHER_WIDGET = 1 << 3 /*< nick=other-widget >*/
90 /* Destination side */
92 void gtk_drag_get_data (GtkWidget *widget,
93 GdkDragContext *context,
96 void gtk_drag_finish (GdkDragContext *context,
101 GtkWidget *gtk_drag_get_source_widget (GdkDragContext *context);
103 void gtk_drag_highlight (GtkWidget *widget);
104 void gtk_drag_unhighlight (GtkWidget *widget);
106 void gtk_drag_dest_set (GtkWidget *widget,
107 GtkDestDefaults flags,
108 const GtkTargetEntry *targets,
110 GdkDragAction actions);
112 void gtk_drag_dest_set_proxy (GtkWidget *widget,
113 GdkWindow *proxy_window,
114 GdkDragProtocol protocol,
115 gboolean use_coordinates);
117 void gtk_drag_dest_unset (GtkWidget *widget);
119 GdkAtom gtk_drag_dest_find_target (GtkWidget *widget,
120 GdkDragContext *context,
121 GtkTargetList *target_list);
122 GtkTargetList* gtk_drag_dest_get_target_list (GtkWidget *widget);
123 void gtk_drag_dest_set_target_list (GtkWidget *widget,
124 GtkTargetList *target_list);
125 void gtk_drag_dest_add_text_targets (GtkWidget *widget);
126 void gtk_drag_dest_add_image_targets (GtkWidget *widget);
127 void gtk_drag_dest_add_uri_targets (GtkWidget *widget);
129 void gtk_drag_dest_set_track_motion (GtkWidget *widget,
130 gboolean track_motion);
131 gboolean gtk_drag_dest_get_track_motion (GtkWidget *widget);
135 void gtk_drag_source_set (GtkWidget *widget,
136 GdkModifierType start_button_mask,
137 const GtkTargetEntry *targets,
139 GdkDragAction actions);
141 void gtk_drag_source_unset (GtkWidget *widget);
143 GtkTargetList* gtk_drag_source_get_target_list (GtkWidget *widget);
144 void gtk_drag_source_set_target_list (GtkWidget *widget,
145 GtkTargetList *target_list);
146 void gtk_drag_source_add_text_targets (GtkWidget *widget);
147 void gtk_drag_source_add_image_targets (GtkWidget *widget);
148 void gtk_drag_source_add_uri_targets (GtkWidget *widget);
150 void gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
152 void gtk_drag_source_set_icon_stock (GtkWidget *widget,
153 const gchar *stock_id);
154 void gtk_drag_source_set_icon_name (GtkWidget *widget,
155 const gchar *icon_name);
157 void gtk_drag_source_set_icon_gicon (GtkWidget *widget,
160 /* There probably should be functions for setting the targets
164 GdkDragContext *gtk_drag_begin (GtkWidget *widget,
165 GtkTargetList *targets,
166 GdkDragAction actions,
170 /* Set the image being dragged around
172 void gtk_drag_set_icon_widget (GdkDragContext *context,
176 void gtk_drag_set_icon_pixbuf (GdkDragContext *context,
180 void gtk_drag_set_icon_stock (GdkDragContext *context,
181 const gchar *stock_id,
184 void gtk_drag_set_icon_surface(GdkDragContext *context,
185 cairo_surface_t *surface);
186 void gtk_drag_set_icon_name (GdkDragContext *context,
187 const gchar *icon_name,
191 void gtk_drag_set_icon_gicon (GdkDragContext *context,
196 void gtk_drag_set_icon_default (GdkDragContext *context);
198 gboolean gtk_drag_check_threshold (GtkWidget *widget,
204 /* Internal functions */
205 void _gtk_drag_source_handle_event (GtkWidget *widget,
207 void _gtk_drag_dest_handle_event (GtkWidget *toplevel,
212 #endif /* __GTK_DND_H__ */