📄 gdk-drag-and-drop.html
字号:
<tr><td><p><span class="term"><em class="parameter"><code>protocol</code></em> :</span></p></td><td> location where the supported DND protocol is returned.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the X id of the window where the drop should happen. This may be <em class="parameter"><code>xid</code></em> or the X id of a proxy window, or None if <em class="parameter"><code>xid</code></em> doesn't support Drag and Drop.</td></tr></tbody></table></div><p class="since">Since 2.2</p></div><hr><div class="refsect2" lang="en"><a name="id3267510"></a><h3><a name="GdkDragProtocol"></a>enum GdkDragProtocol</h3><a class="indexterm" name="id3267523"></a><pre class="programlisting">typedef enum{ GDK_DRAG_PROTO_MOTIF, GDK_DRAG_PROTO_XDND, GDK_DRAG_PROTO_ROOTWIN, /* A root window with nobody claiming * drags */ GDK_DRAG_PROTO_NONE, /* Not a valid drag window */ GDK_DRAG_PROTO_WIN32_DROPFILES, /* The simple WM_DROPFILES dnd */ GDK_DRAG_PROTO_OLE2, /* The complex OLE2 dnd (not implemented) */ GDK_DRAG_PROTO_LOCAL /* Intra-app */} GdkDragProtocol;</pre><p>Used in <a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a> to indicate the protocol according towhich DND is done.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="GDK-DRAG-PROTO-MOTIF:CAPS"></a><code class="literal">GDK_DRAG_PROTO_MOTIF</code></span></p></td><td>The Motif DND protocol.</td></tr><tr><td><p><span class="term"><a name="GDK-DRAG-PROTO-XDND:CAPS"></a><code class="literal">GDK_DRAG_PROTO_XDND</code></span></p></td><td>The Xdnd protocol.</td></tr><tr><td><p><span class="term"><a name="GDK-DRAG-PROTO-ROOTWIN:CAPS"></a><code class="literal">GDK_DRAG_PROTO_ROOTWIN</code></span></p></td><td>An extension to the Xdnd protocol for unclaimed root window drops.</td></tr><tr><td><p><span class="term"><a name="GDK-DRAG-PROTO-NONE:CAPS"></a><code class="literal">GDK_DRAG_PROTO_NONE</code></span></p></td><td>no protocol.</td></tr><tr><td><p><span class="term"><a name="GDK-DRAG-PROTO-WIN32-DROPFILES:CAPS"></a><code class="literal">GDK_DRAG_PROTO_WIN32_DROPFILES</code></span></p></td><td>The simple WM_DROPFILES protocol.</td></tr><tr><td><p><span class="term"><a name="GDK-DRAG-PROTO-OLE2:CAPS"></a><code class="literal">GDK_DRAG_PROTO_OLE2</code></span></p></td><td>The complex OLE2 DND protocol (not implemented).</td></tr><tr><td><p><span class="term"><a name="GDK-DRAG-PROTO-LOCAL:CAPS"></a><code class="literal">GDK_DRAG_PROTO_LOCAL</code></span></p></td><td>Intra-application DND.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3267720"></a><h3><a name="gdk-drag-context-unref"></a>gdk_drag_context_unref ()</h3><a class="indexterm" name="id3267735"></a><pre class="programlisting">void gdk_drag_context_unref (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">gdk_drag_context_unref</code> is deprecated and should not be used in newly-written code.</p></div><p>Deprecated function; use <ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a> instead.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3267817"></a><h3><a name="GdkDragContext"></a>GdkDragContext</h3><a class="indexterm" name="id3267830"></a><pre class="programlisting">typedef struct { GObject parent_instance; GdkDragProtocol protocol; gboolean is_source; GdkWindow *source_window; GdkWindow *dest_window; GList *targets; GdkDragAction actions; GdkDragAction suggested_action; GdkDragAction action; guint32 start_time;} GdkDragContext;</pre><p>A <span class="structname">GdkDragContext</span> holds information about a drag in progress. It is used on both source and destination sides.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a> <em class="structfield"><code>parent_instance</code></em>;</span></p></td><td>the parent instance</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> <em class="structfield"><code>protocol</code></em>;</span></p></td><td>the DND protocol which governs this drag.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <em class="structfield"><code>is_source</code></em>;</span></p></td><td><ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the context is used on the source side.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *<em class="structfield"><code>source_window</code></em>;</span></p></td><td>the source of this drag.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *<em class="structfield"><code>dest_window</code></em>;</span></p></td><td>the destination window of this drag.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList">GList</a> *<em class="structfield"><code>targets</code></em>;</span></p></td><td>a list of targets offered by the source.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> <em class="structfield"><code>actions</code></em>;</span></p></td><td>a bitmask of actions proposed by the source when <em class="parameter"><code>suggested_action</code></em> is <a class="link" href="gdk-Drag-and-Drop.html#GDK-ACTION-ASK:CAPS"><code class="literal">GDK_ACTION_ASK</code></a>.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> <em class="structfield"><code>suggested_action</code></em>;</span></p></td><td>the action suggested by the source.</td></tr><tr><td><p><span class="term"><a class="link" href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> <em class="structfield"><code>action</code></em>;</span></p></td><td>the action chosen by the destination.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> <em class="structfield"><code>start_time</code></em>;</span></p></td><td>a timestamp recording the start time of this drag.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3268097"></a><h3><a name="GdkDragAction"></a>enum GdkDragAction</h3><a class="indexterm" name="id3268110"></a><pre class="programlisting">typedef enum{ GDK_ACTION_DEFAULT = 1 << 0, GDK_ACTION_COPY = 1 << 1, GDK_ACTION_MOVE = 1 << 2, GDK_ACTION_LINK = 1 << 3, GDK_ACTION_PRIVATE = 1 << 4, GDK_ACTION_ASK = 1 << 5} GdkDragAction;</pre><p>Used in <a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a> to indicate what the destinationshould do with the dropped data.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="GDK-ACTION-DEFAULT:CAPS"></a><code class="literal">GDK_ACTION_DEFAULT</code></span></p></td><td>Means nothing, and should not be used.</td></tr><tr><td><p><span class="term"><a name="GDK-ACTION-COPY:CAPS"></a><code class="literal">GDK_ACTION_COPY</code></span></p></td><td>Copy the data.</td></tr><tr><td><p><span class="term"><a name="GDK-ACTION-MOVE:CAPS"></a><code class="literal">GDK_ACTION_MOVE</code></span></p></td><td>Move the data, i.e. first copy it, then delete it from the source using the DELETE target of the X selection protocol.</td></tr><tr><td><p><span class="term"><a name="GDK-ACTION-LINK:CAPS"></a><code class="literal">GDK_ACTION_LINK</code></span></p></td><td>Add a link to the data. Note that this is only useful if source and destination agree on what it means.</td></tr><tr><td><p><span class="term"><a name="GDK-ACTION-PRIVATE:CAPS"></a><code class="literal">GDK_ACTION_PRIVATE</code></span></p></td><td>Special action which tells the source that the destination will do something that the source doesn't understand.</td></tr><tr><td><p><span class="term"><a name="GDK-ACTION-ASK:CAPS"></a><code class="literal">GDK_ACTION_ASK</code></span></p></td><td>Ask the user what to do with the data.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3268283"></a><h3><a name="gdk-drag-status"></a>gdk_drag_status ()</h3><a class="indexterm" name="id3268296"></a><pre class="programlisting">void gdk_drag_status (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <a class="link" href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> action, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);</pre><p>Selects one of the actions offered by the drag source.</p><p>This function is called by the drag destination in response to<a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-motion"><code class="function">gdk_drag_motion()</code></a> called by the drag source.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td><td> the selected action which will be taken when a drop happens, or 0 to indicate that a drop will not be accepted.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>time_</code></em> :</span></p></td><td> the timestamp for this operation.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3268416"></a><h3><a name="gdk-drag-drop-succeeded"></a>gdk_drag_drop_succeeded ()</h3><a class="indexterm" name="id3268432"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> gdk_drag_drop_succeeded (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);</pre><p>Returns wether the dropped data has been successfully transferred. This function is intended to be used while handling a <a class="link" href="gdk-Events.html#GDK-DROP-FINISHED:CAPS"><code class="literal">GDK_DROP_FINISHED</code></a> event, its return value ismeaningless at other times.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the drop was successful.</td></tr></tbody></table></div><p class="since">Since 2.6</p></div></div><div class="refsect1" lang="en"><a name="id3268533"></a><div class="refsect2" lang="en"><a name="id3268534"></a></div><hr><div class="refsect2" lang="en"><a name="id3268535"></a></div></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -