1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
10
TITLE="GTK+ 2.0 Tutorial"
11
HREF="book1.html"><LINK
13
TITLE="Drag-and-drop (DND)"
14
HREF="c1901.html"><LINK
17
HREF="x1923.html"><LINK
20
HREF="c2025.html"></HEAD
31
SUMMARY="Header navigation table"
40
>GTK+ 2.0 Tutorial</TH
50
><<< Previous</A
56
>Drag-and-drop (DND)</TD
64
>Next >>></A
76
NAME="SEC-DRAGANDDROPFUNCTIONS"
84
NAME="SEC-DNDSOURCEWIDGETS"
85
>Setting up the source widget</A
90
>gtk_drag_source_set()</TT
92
set of target types for a drag operation on a widget.</P
100
CLASS="PROGRAMLISTING"
101
>void gtk_drag_source_set( GtkWidget *widget,
102
GdkModifierType start_button_mask,
103
const GtkTargetEntry *targets,
105
GdkDragAction actions );</PRE
110
>The parameters signify the following:</P
119
> specifies the drag source
126
>start_button_mask</TT
128
bitmask of buttons that can start the drag (e.g. GDK_BUTTON1_MASK)</P
135
> specifies a table of
136
target data types the drag will support</P
143
> specifies the number of
151
> specifies a bitmask of
152
possible actions for a drag from this window</P
159
> parameter is an array of the
160
following structure:</P
168
CLASS="PROGRAMLISTING"
169
>struct GtkTargetEntry {
178
>The fields specify a string representing the drag type, optional
179
flags and application assigned integer identifier.</P
181
>If a widget is no longer required to act as a source for
182
drag-and-drop operations, the function
185
>gtk_drag_source_unset()</TT
186
> can be used to remove a set
187
of drag-and-drop target types.</P
195
CLASS="PROGRAMLISTING"
196
>void gtk_drag_source_unset( GtkWidget *widget );</PRE
206
NAME="SEC-SIGNALSONSOURCEWIDGETS"
207
>Signals on the source widget:</A
210
>The source widget is sent the following signals during a
211
drag-and-drop operation.</P
219
>Table 1. Source widget signals</B
239
>void (*drag_begin)(GtkWidget *widget,
240
GdkDragContext *dc, gpointer data)</TT
253
>gboolean (*drag_motion)(GtkWidget *widget,
254
GdkDragContext *dc, gint x, gint y, guint t, gpointer data)</TT
267
>void (*drag_data_get)(GtkWidget *widget,
268
GdkDragContext *dc, GtkSelectionData *selection_data, guint info, guint t, gpointer data)</TT
275
>drag_data_delete</TD
281
>void (*drag_data_delete)(GtkWidget *widget,
282
GdkDragContext *dc, gpointer data)</TT
295
>gboolean (*drag_drop)(GtkWidget *widget,
296
GdkDragContext *dc, gint x, gint y, guint t, gpointer data)</TT
309
>void (*drag_end)(GtkWidget *widget,
310
GdkDragContext *dc, gpointer data)</TT
322
NAME="SEC-DNDDESTWIDGETS"
323
>Setting up a destination widget:</A
328
> gtk_drag_dest_set()</TT
330
that this widget can receive drops and specifies what types of drops it
335
> gtk_drag_dest_unset()</TT
337
that the widget can no longer receive drops.</P
345
CLASS="PROGRAMLISTING"
346
>void gtk_drag_dest_set( GtkWidget *widget,
347
GtkDestDefaults flags,
348
const GtkTargetEntry *targets,
350
GdkDragAction actions );
352
void gtk_drag_dest_unset( GtkWidget *widget );</PRE
362
NAME="SEC-SIGNALSONDESTWIDGETS"
363
>Signals on the destination widget:</A
366
>The destination widget is sent the following signals during a
367
drag-and-drop operation.</P
375
>Table 2. Destination widget signals</B
389
>drag_data_received</TD
395
>void (*drag_data_received)(GtkWidget *widget,
396
GdkDragContext *dc, gint x, gint y, GtkSelectionData *selection_data, guint info, guint t,
410
SUMMARY="Footer navigation table"
423
><<< Previous</A
441
>Next >>></A
b'\\ No newline at end of file'