?? gdk-drag-and-drop.html
字號:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Drag and Drop</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GDK Reference Manual"><link rel="up" href="reference.html" title="API Reference"><link rel="prev" href="gdk-Selections.html" title="Selections"><link rel="next" href="gdk-Properties-and-Atoms.html" title="Properties and Atoms"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="reference" href="reference.html" title="API Reference"><link rel="index" href="ix01.html" title="Index"><link rel="index" href="ix02.html" title="Index of deprecated symbols"><link rel="index" href="ix03.html" title="Index of new symbols in 2.2"><link rel="index" href="ix04.html" title="Index of new symbols in 2.4"><link rel="index" href="ix05.html" title="Index of new symbols in 2.6"><link rel="index" href="ix06.html" title="Index of new symbols in 2.8"><link rel="index" href="ix07.html" title="Index of new symbols in 2.10"><link rel="index" href="ix08.html" title="Index of new symbols in 2.12"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="gdk-Selections.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GDK Reference Manual</th><td><a accesskey="n" href="gdk-Properties-and-Atoms.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id3265018" class="shortcut">Top</a>  |  <a href="#id3265663" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="gdk-Drag-and-Drop"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3265018"></a><span class="refentrytitle">Drag and Drop</span></h2><p>Drag and Drop — Functions for controlling drag and drop handling</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include <gdk/gdk.h><a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-get-selection">gdk_drag_get_selection</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);void <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-abort">gdk_drag_abort</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);void <a class="link" href="gdk-Drag-and-Drop.html#gdk-drop-reply">gdk_drop_reply</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> ok, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a>* <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-context-new">gdk_drag_context_new</a> (void);void <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-drop">gdk_drag_drop</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);void <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-find-window">gdk_drag_find_window</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *drag_window, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> x_root, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> y_root, <a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> **dest_window, <a class="link" href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);void <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-find-window-for-screen">gdk_drag_find_window_for_screen</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *drag_window, <a class="link" href="GdkScreen.html" title="GdkScreen">GdkScreen</a> *screen, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> x_root, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> y_root, <a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> **dest_window, <a class="link" href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);void <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-context-ref">gdk_drag_context_ref</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a>* <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-begin">gdk_drag_begin</a> (<a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *window, <ahref="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList">GList</a> *targets);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-motion">gdk_drag_motion</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *dest_window, <a class="link" href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> protocol, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> x_root, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> y_root, <a class="link" href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> suggested_action, <a class="link" href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> possible_actions, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);void <a class="link" href="gdk-Drag-and-Drop.html#gdk-drop-finish">gdk_drop_finish</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> success, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-get-protocol">gdk_drag_get_protocol</a> (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> xid, <a class="link" href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-get-protocol-for-display">gdk_drag_get_protocol_for_display</a> (<a class="link" href="GdkDisplay.html" title="GdkDisplay">GdkDisplay</a> *display, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> xid, <a class="link" href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);enum <a class="link" href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a>;void <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-context-unref">gdk_drag_context_unref</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context); <a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a>;enum <a class="link" href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a>;void <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-status">gdk_drag_status</a> (<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_);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-drop-succeeded">gdk_drag_drop_succeeded</a> (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);</pre></div><div class="refsect1" lang="en"><a name="id3265663"></a><h2>Description</h2><p>These functions provide a low level interface for drag and drop.The X backend of GDK supports both the Xdnd and Motif drag and drop protocols transparently, the Win32 backend supports the WM_DROPFILES protocol.</p><p>GTK+ provides a higher level abstraction based on top of these functions,and so they are not normally needed in GTK+ applications.See the <ahref="/usr/share/gtk-doc/html/gtk/gtk-Drag-and-Drop.html">Drag and Drop</a> section ofthe GTK+ documentation for more information.</p></div><div class="refsect1" lang="en"><a name="id3265696"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3265707"></a><h3><a name="gdk-drag-get-selection"></a>gdk_drag_get_selection ()</h3><a class="indexterm" name="id3265720"></a><pre class="programlisting"><a class="link" href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> gdk_drag_get_selection (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);</pre><p>Returns the selection atom for the current source window.</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> the selection atom.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3265790"></a><h3><a name="gdk-drag-abort"></a>gdk_drag_abort ()</h3><a class="indexterm" name="id3265802"></a><pre class="programlisting">void gdk_drag_abort (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);</pre><p>Aborts a drag without dropping. </p><p>This function is 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>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="id3265887"></a><h3><a name="gdk-drop-reply"></a>gdk_drop_reply ()</h3><a class="indexterm" name="id3265900"></a><pre class="programlisting">void gdk_drop_reply (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> ok, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);</pre><p>Accepts or rejects a drop. </p><p>This function is called by the drag destination in responseto a drop initiated 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>ok</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 drop is 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="id3266018"></a><h3><a name="gdk-drag-context-new"></a>gdk_drag_context_new ()</h3><a class="indexterm" name="id3266031"></a><pre class="programlisting"><a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a>* gdk_drag_context_new (void);</pre><p>Creates a new <a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the newly created <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="id3266087"></a><h3><a name="gdk-drag-drop"></a>gdk_drag_drop ()</h3><a class="indexterm" name="id3266100"></a><pre class="programlisting">void gdk_drag_drop (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);</pre><p>Drops on the current destination.</p><p>This function is 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>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="id3266185"></a><h3><a name="gdk-drag-find-window"></a>gdk_drag_find_window ()</h3><a class="indexterm" name="id3266198"></a><pre class="programlisting">void gdk_drag_find_window (<a class="link" href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context, <a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *drag_window, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> x_root, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> y_root, <a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> **dest_window, <a class="link" href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);</pre><p>Finds the destination window and DND protocol to use at thegiven pointer position. </p><p>This function is called by the drag source to obtain the <em class="parameter"><code>dest_window</code></em> and <em class="parameter"><code>protocol</code></em> parameters for <a class="link" href="gdk-Drag-and-Drop.html#gdk-drag-motion"><code class="function">gdk_drag_motion()</code></a>.</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>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -