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, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
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/.
28 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29 #error "Only <gtk/gtk.h> can be included directly."
36 #include <gtk/gtkwidget.h>
37 #include <gtk/gtkselection.h>
44 * @GTK_DEST_DEFAULT_MOTION: If set for a widget, GTK+, during a drag over this
45 * widget will check if the drag matches this widget's list of possible targets
47 * GTK+ will then call gdk_drag_status() as appropriate.
48 * @GTK_DEST_DEFAULT_HIGHLIGHT: If set for a widget, GTK+ will draw a highlight on
49 * this widget as long as a drag is over this widget and the widget drag format
50 * and action are acceptable.
51 * @GTK_DEST_DEFAULT_DROP: If set for a widget, when a drop occurs, GTK+ will
52 * will check if the drag matches this widget's list of possible targets and
53 * actions. If so, GTK+ will call gtk_drag_get_data() on behalf of the widget.
54 * Whether or not the drop is successful, GTK+ will call gtk_drag_finish(). If
55 * the action was a move, then if the drag was successful, then %TRUE will be
56 * passed for the @delete parameter to gtk_drag_finish().
57 * @GTK_DEST_DEFAULT_ALL: If set, specifies that all default actions should
60 * The #GtkDestDefaults enumeration specifies the various
61 * types of action that will be taken on behalf
62 * of the user for a drag destination site.
65 GTK_DEST_DEFAULT_MOTION = 1 << 0, /* respond to "drag_motion" */
66 GTK_DEST_DEFAULT_HIGHLIGHT = 1 << 1, /* auto-highlight */
67 GTK_DEST_DEFAULT_DROP = 1 << 2, /* respond to "drag_drop" */
68 GTK_DEST_DEFAULT_ALL = 0x07
73 * @GTK_TARGET_SAME_APP: If this is set, the target will only be selected
74 * for drags within a single application.
75 * @GTK_TARGET_SAME_WIDGET: If this is set, the target will only be selected
76 * for drags within a single widget.
77 * @GTK_TARGET_OTHER_APP: If this is set, the target will not be selected
78 * for drags within a single application.
79 * @GTK_TARGET_OTHER_WIDGET: If this is set, the target will not be selected
80 * for drags withing a single widget.
82 * The #GtkTargetFlags enumeration is used to specify
83 * constraints on an entry in a #GtkTargetTable.
86 GTK_TARGET_SAME_APP = 1 << 0, /*< nick=same-app >*/
87 GTK_TARGET_SAME_WIDGET = 1 << 1, /*< nick=same-widget >*/
88 GTK_TARGET_OTHER_APP = 1 << 2, /*< nick=other-app >*/
89 GTK_TARGET_OTHER_WIDGET = 1 << 3 /*< nick=other-widget >*/
92 /* Destination side */
94 void gtk_drag_get_data (GtkWidget *widget,
95 GdkDragContext *context,
98 void gtk_drag_finish (GdkDragContext *context,
103 GtkWidget *gtk_drag_get_source_widget (GdkDragContext *context);
105 void gtk_drag_highlight (GtkWidget *widget);
106 void gtk_drag_unhighlight (GtkWidget *widget);
108 void gtk_drag_dest_set (GtkWidget *widget,
109 GtkDestDefaults flags,
110 const GtkTargetEntry *targets,
112 GdkDragAction actions);
114 void gtk_drag_dest_set_proxy (GtkWidget *widget,
115 GdkWindow *proxy_window,
116 GdkDragProtocol protocol,
117 gboolean use_coordinates);
119 void gtk_drag_dest_unset (GtkWidget *widget);
121 GdkAtom gtk_drag_dest_find_target (GtkWidget *widget,
122 GdkDragContext *context,
123 GtkTargetList *target_list);
124 GtkTargetList* gtk_drag_dest_get_target_list (GtkWidget *widget);
125 void gtk_drag_dest_set_target_list (GtkWidget *widget,
126 GtkTargetList *target_list);
127 void gtk_drag_dest_add_text_targets (GtkWidget *widget);
128 void gtk_drag_dest_add_image_targets (GtkWidget *widget);
129 void gtk_drag_dest_add_uri_targets (GtkWidget *widget);
131 void gtk_drag_dest_set_track_motion (GtkWidget *widget,
132 gboolean track_motion);
133 gboolean gtk_drag_dest_get_track_motion (GtkWidget *widget);
137 void gtk_drag_source_set (GtkWidget *widget,
138 GdkModifierType start_button_mask,
139 const GtkTargetEntry *targets,
141 GdkDragAction actions);
143 void gtk_drag_source_unset (GtkWidget *widget);
145 GtkTargetList* gtk_drag_source_get_target_list (GtkWidget *widget);
146 void gtk_drag_source_set_target_list (GtkWidget *widget,
147 GtkTargetList *target_list);
148 void gtk_drag_source_add_text_targets (GtkWidget *widget);
149 void gtk_drag_source_add_image_targets (GtkWidget *widget);
150 void gtk_drag_source_add_uri_targets (GtkWidget *widget);
152 void gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
154 void gtk_drag_source_set_icon_stock (GtkWidget *widget,
155 const gchar *stock_id);
156 void gtk_drag_source_set_icon_name (GtkWidget *widget,
157 const gchar *icon_name);
158 void gtk_drag_source_set_icon_gicon (GtkWidget *widget,
161 /* There probably should be functions for setting the targets
165 GdkDragContext *gtk_drag_begin (GtkWidget *widget,
166 GtkTargetList *targets,
167 GdkDragAction actions,
171 /* Set the image being dragged around
173 void gtk_drag_set_icon_widget (GdkDragContext *context,
177 void gtk_drag_set_icon_pixbuf (GdkDragContext *context,
181 void gtk_drag_set_icon_stock (GdkDragContext *context,
182 const gchar *stock_id,
185 void gtk_drag_set_icon_surface(GdkDragContext *context,
186 cairo_surface_t *surface);
187 void gtk_drag_set_icon_name (GdkDragContext *context,
188 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__ */