📄 gtk-drag-and-drop.html
字号:
NAME="GTK-DRAG-DEST-UNSET"></A>gtk_drag_dest_unset ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_drag_dest_unset (<AHREF="gtkwidget.html">GtkWidget</A> *widget);</PRE></TD></TR></TABLE><P>Clear information about a drop destination set with<AHREF="gtk-drag-and-drop.html#GTK-DRAG-DEST-SET">gtk_drag_dest_set</A>(). The widget will no longer receivenotification of drags.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN7187"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>widget</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a <AHREF="gtkwidget.html">GtkWidget</A> </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN7197"></A><H3><ANAME="GTK-DRAG-FINISH"></A>gtk_drag_finish ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_drag_finish (<AHREF=../gdk/gdk-drag-and-drop.html#GDKDRAGCONTEXT>GdkDragContext</A> *context, <AHREF=../glib/glib-basic-types.html#GBOOLEAN>gboolean</A> success, <AHREF=../glib/glib-basic-types.html#GBOOLEAN>gboolean</A> del, <AHREF=../glib/glib-basic-types.html#GUINT32>guint32</A> time);</PRE></TD></TR></TABLE><P>Inform the drag source that the drop is finished, andthat the data of the drag will no longer be required.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN7206"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>context</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the drag context.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>success</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a flag indicating whether the drop was succesful</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>del</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a flag indicating whether the source should delete the original data. (This should be <TTCLASS="LITERAL">TRUE</TT> for a move)</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>time</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the timestamp from the "drag_data_drop" signal. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN7228"></A><H3><ANAME="GTK-DRAG-GET-DATA"></A>gtk_drag_get_data ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_drag_get_data (<AHREF="gtkwidget.html">GtkWidget</A> *widget, <AHREF=../gdk/gdk-drag-and-drop.html#GDKDRAGCONTEXT>GdkDragContext</A> *context, <AHREF=../gdk/gdk-properties-and-atoms.html#GDKATOM>GdkAtom</A> target, <AHREF=../glib/glib-basic-types.html#GUINT32>guint32</A> time);</PRE></TD></TR></TABLE><P>Get the data associated with a drag. When the datais received or the retrieval fails, GTK+ will emit a "drag_data_received" signal. Failure of the retrievalis indicated by the length field of the <TTCLASS="PARAMETER"><I>selection_data</I></TT>signal parameter being negative. However, when <AHREF="gtk-drag-and-drop.html#GTK-DRAG-GET-DATA">gtk_drag_get_data</A>() is called implicitely because the <TTCLASS="LITERAL">GTK_DRAG_DEFAULT_DROP</TT> was set, then the widget will not receive notification of faileddrops.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN7240"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>widget</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the widget that will receive the "drag_data_received" signal.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>context</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the drag context</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>target</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the target (form of the data) to retrieve.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>time</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a timestamp for retrieving the data. This will generally be the time received in a "drag_data_motion" or "drag_data_drop" signal. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN7261"></A><H3><ANAME="GTK-DRAG-GET-SOURCE-WIDGET"></A>gtk_drag_get_source_widget ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF="gtkwidget.html">GtkWidget</A>* gtk_drag_get_source_widget (<AHREF=../gdk/gdk-drag-and-drop.html#GDKDRAGCONTEXT>GdkDragContext</A> *context);</PRE></TD></TR></TABLE><P>Determine the source widget for a drag.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN7268"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>context</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a (destination side) drag context.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">if the drag is occurring within a single application, a pointer to the source widget. Otherwise, NULL. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN7281"></A><H3><ANAME="GTK-DRAG-HIGHLIGHT"></A>gtk_drag_highlight ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_drag_highlight (<AHREF="gtkwidget.html">GtkWidget</A> *widget);</PRE></TD></TR></TABLE><P>Draw a highlight around a widget. This will attachhandlers to "expose_event" and "draw", so the highlightwill continue to be displayed until gtk_drag_unhighlightis called.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN7287"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>widget</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a widget to highlight </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN7296"></A><H3><ANAME="GTK-DRAG-UNHIGHLIGHT"></A>gtk_drag_unhighlight ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_drag_unhighlight (<AHREF="gtkwidget.html">GtkWidget</A> *widget);</PRE></TD></TR></TABLE><P>Remove a highlight set by <AHREF="gtk-drag-and-drop.html#GTK-DRAG-HIGHLIGHT">gtk_drag_highlight</A>() froma widget.is called.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN7303"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>widget</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a widget to remove the highlight from. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN7312"></A><H3><ANAME="GTK-DRAG-BEGIN"></A>gtk_drag_begin ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../gdk/gdk-drag-and-drop.html#GDKDRAGCONTEXT>GdkDragContext</A>* gtk_drag_begin (<AHREF="gtkwidget.html">GtkWidget</A> *widget, <AHREF="gtk-selections.html#GTKTARGETLIST">GtkTargetList</A> *targets, <AHREF=../gdk/gdk-drag-and-drop.html#GDKDRAGACTION>GdkDragAction</A> actions, <AHREF=../glib/glib-basic-types.html#GINT>gint</A> button, <AHREF=../gdk/gdk-event-structures.html#GDKEVENT>GdkEvent</A> *event);</PRE></TD></TR></TABLE><P>Initiate a drag on the source side. The functiononly needs to be used when the application isstarting drags itself, and is not needed when<AHREF="gtk-drag-and-drop.html#GTK-DRAG-SOURCE-SET">gtk_drag_source_set</A>() is used.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN7324"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>widget</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the source widget.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>targets</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">The targets (data formats) in which the source can provide the data.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>actions</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">A bitmask of the allowed drag actions for this drag.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>button</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">The button the user clicked to start the drag.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>event</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">The event that triggered the start of the drag. Usually</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">The context for this drag. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN7353"></A><H3><ANAME="GTK-DRAG-SET-ICON-WIDGET"></A>gtk_drag_set_icon_widget ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_drag_set_icon_widget (<AHREF=../gdk/gdk-drag-and-drop.html#GDKDRAGCONTEXT>GdkDragContext</A> *context, <AHREF="gtkwidget.html">GtkWidget</A> *widget, <AHREF=../glib/glib-basic-types.html#GINT>gint</A> hot_x, <AHREF=../glib/glib-basic-types.html#GINT>gint</A> hot_y);</PRE></TD></TR></TABLE><P>Change the icon for a widget to a given widget. GTK+will not destroy the icon, so if you don't wantit to persist, you should connect to the "drag_end" signal and destroy it yourself.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN7362"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>context</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the context for a drag. (This must be called with a context for the source side of a drag)</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>widget</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">A toplevel window to use as an icon.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>hot_x</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">The X offset within <TTCLASS="PARAMETER"><I>widget</I></TT> of the hotspot.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>hot_y</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">The Y offset within <TTCLASS="PARAMETER"><I>widget</I></TT> of the hotspot. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN7385"></A><H3><ANAME="GTK-DRAG-SET-ICON-PIXMAP"></A>gtk_drag_set_icon_pixmap ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_drag_set_icon_pixmap (<AHREF=../gdk/gdk-drag-and-drop.html#GDKDRAGCONTEXT>GdkDragContext</A> *context, <AHREF=../gdk/gdk-colormaps-and-colors.html#GDKCOLORMAP>GdkColormap</A> *colormap, <AHREF=../gdk/gdk-bitmaps-and-pixmaps.html#GDKPIXMAP>GdkPixmap</A> *pixmap, <AHREF=../gdk/gdk-bitmaps-and-pixmaps.html#GDKBITMAP>GdkBitmap</A> *mask, <AHREF=../glib/glib-basic-types.html#GINT>gint</A> hot_x, <AHREF=../glib/glib-basic-types.html#GINT>gint</A> hot_y);</PRE></TD></TR></TABLE><P>Sets a given pixmap as the icon for a given drag.GTK+ retains a reference count for the arguments, and will release them when they are no longer needed.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN7396"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>context</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the context for a drag. (This must be called with a context for the source side of a drag)</TD></TR><TR><TDWIDTH="20%"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -