Synopsis#include <gtk/gtk.h> enum GtkDestDefaults; enum GtkTargetFlags; void gtk_drag_dest_set (GtkWidget *widget, GtkDestDefaults flags, const GtkTargetEntry *targets, gint n_targets, GdkDragAction actions); void gtk_drag_dest_set_proxy (GtkWidget *widget, GdkWindow *proxy_window, GdkDragProtocol protocol, gboolean use_coordinates); void gtk_drag_dest_unset (GtkWidget *widget); GdkAtom gtk_drag_dest_find_target (GtkWidget *widget, GdkDragContext *context, GtkTargetList *target_list); GtkTargetList* gtk_drag_dest_get_target_list (GtkWidget *widget); void gtk_drag_dest_set_target_list (GtkWidget *widget, GtkTargetList *target_list); void gtk_drag_dest_add_text_targets (GtkWidget *widget); void gtk_drag_dest_add_image_targets (GtkWidget *widget); void gtk_drag_dest_add_uri_targets (GtkWidget *widget); void gtk_drag_dest_set_track_motion (GtkWidget *widget, gboolean track_motion); gboolean gtk_drag_dest_get_track_motion (GtkWidget *widget); void gtk_drag_finish (GdkDragContext *context, gboolean success, gboolean del, guint32 time_); void gtk_drag_get_data (GtkWidget *widget, GdkDragContext *context, GdkAtom target, guint32 time_); GtkWidget* gtk_drag_get_source_widget (GdkDragContext *context); void gtk_drag_highlight (GtkWidget *widget); void gtk_drag_unhighlight (GtkWidget *widget); GdkDragContext* gtk_drag_begin (GtkWidget *widget, GtkTargetList *targets, GdkDragAction actions, gint button, GdkEvent *event); void gtk_drag_set_icon_widget (GdkDragContext *context, GtkWidget *widget, gint hot_x, gint hot_y); void gtk_drag_set_icon_pixmap (GdkDragContext *context, GdkColormap *colormap, GdkPixmap *pixmap, GdkBitmap *mask, gint hot_x, gint hot_y); void gtk_drag_set_icon_pixbuf (GdkDragContext *context, GdkPixbuf *pixbuf, gint hot_x, gint hot_y); void gtk_drag_set_icon_stock (GdkDragContext *context, const gchar *stock_id, gint hot_x, gint hot_y); void gtk_drag_set_icon_name (GdkDragContext *context, const gchar *icon_name, gint hot_x, gint hot_y); void gtk_drag_set_icon_default (GdkDragContext *context); void gtk_drag_set_default_icon (GdkColormap *colormap, GdkPixmap *pixmap, GdkBitmap *mask, gint hot_x, gint hot_y); gboolean gtk_drag_check_threshold (GtkWidget *widget, gint start_x, gint start_y, gint current_x, gint current_y); void gtk_drag_source_set (GtkWidget *widget, GdkModifierType start_button_mask, const GtkTargetEntry *targets, gint n_targets, GdkDragAction actions); void gtk_drag_source_set_icon (GtkWidget *widget, GdkColormap *colormap, GdkPixmap *pixmap, GdkBitmap *mask); void gtk_drag_source_set_icon_pixbuf (GtkWidget *widget, GdkPixbuf *pixbuf); void gtk_drag_source_set_icon_stock (GtkWidget *widget, const gchar *stock_id); void gtk_drag_source_set_icon_name (GtkWidget *widget, const gchar *icon_name); void gtk_drag_source_unset (GtkWidget *widget); void gtk_drag_source_set_target_list (GtkWidget *widget, GtkTargetList *target_list); GtkTargetList* gtk_drag_source_get_target_list (GtkWidget *widget); void gtk_drag_source_add_text_targets (GtkWidget *widget); void gtk_drag_source_add_image_targets (GtkWidget *widget); void gtk_drag_source_add_uri_targets (GtkWidget *widget); DescriptionGTK+ has a rich set of functions for doing inter-process communication via the drag-and-drop metaphor. GTK+ can do drag-and-drop (DND) via multiple protocols. The currently supported protocols are the Xdnd and Motif protocols. As well as the functions listed here, applications may need to use some facilities provided for Selections. Also, the Drag and Drop API makes use of signals in the GtkWidget class. Detailsenum GtkDestDefaultstypedef enum { GTK_DEST_DEFAULT_MOTION = 1 << 0, /* respond to "drag_motion" */ GTK_DEST_DEFAULT_HIGHLIGHT = 1 << 1, /* auto-highlight */ GTK_DEST_DEFAULT_DROP = 1 << 2, /* respond to "drag_drop" */ GTK_DEST_DEFAULT_ALL = 0x07 } GtkDestDefaults; The GtkDestDefaults enumeration specifies the various types of action that will be taken on behalf of the user for a drag destination site.
enum GtkTargetFlagstypedef enum { GTK_TARGET_SAME_APP = 1 << 0, /*< nick=same-app >*/ GTK_TARGET_SAME_WIDGET = 1 << 1, /*< nick=same-widget >*/ GTK_TARGET_OTHER_APP = 1 << 2, /*< nick=other-app >*/ GTK_TARGET_OTHER_WIDGET = 1 << 3 /*< nick=other-widget >*/ } GtkTargetFlags; The GtkTargetFlags enumeration is used to specify constraints on an entry in a GtkTargetTable.
gtk_drag_dest_set ()void gtk_drag_dest_set (GtkWidget *widget, GtkDestDefaults flags, const GtkTargetEntry *targets, gint n_targets, GdkDragAction actions); Sets a widget as a potential drop destination, and adds default behaviors.
The default behaviors listed in
Things become more complicated when you try to preview the dragged data,
as described in the documentation for "drag-motion". The default
behaviors described by
gtk_drag_dest_set_proxy ()void gtk_drag_dest_set_proxy (GtkWidget *widget, GdkWindow *proxy_window, GdkDragProtocol protocol, gboolean use_coordinates); Sets this widget as a proxy for drops to another window.
gtk_drag_dest_unset ()void gtk_drag_dest_unset (GtkWidget *widget);
Clears information about a drop destination set with
gtk_drag_dest_find_target ()GdkAtom gtk_drag_dest_find_target (GtkWidget *widget, GdkDragContext *context, GtkTargetList *target_list);
Looks for a match between
gtk_drag_dest_get_target_list ()GtkTargetList* gtk_drag_dest_get_target_list (GtkWidget *widget); Returns the list of targets this widget can accept from drag-and-drop.
gtk_drag_dest_set_target_list ()void gtk_drag_dest_set_target_list (GtkWidget *widget, GtkTargetList *target_list);
Sets the target types that this widget can accept from drag-and-drop.
The widget must first be made into a drag destination with
gtk_drag_dest_add_text_targets ()void gtk_drag_dest_add_text_targets (GtkWidget *widget);
Add the text targets supported by GtkSelection to
the target list of the drag destination. The targets
are added with
Since 2.6 gtk_drag_dest_add_image_targets ()void gtk_drag_dest_add_image_targets (GtkWidget *widget);
Add the image targets supported by GtkSelection to
the target list of the drag destination. The targets
are added with
Since 2.6 gtk_drag_dest_add_uri_targets ()void gtk_drag_dest_add_uri_targets (GtkWidget *widget);
Add the URI targets supported by GtkSelection to
the target list of the drag destination. The targets
are added with
Since 2.6 gtk_drag_dest_set_track_motion ()void gtk_drag_dest_set_track_motion (GtkWidget *widget, gboolean track_motion);
Tells the widget to emit ::drag-motion and ::drag-leave
events regardless of the targets and the This may be used when a widget wants to do generic actions regardless of the targets that the source offers.
Since 2.10 gtk_drag_dest_get_track_motion ()gboolean gtk_drag_dest_get_track_motion (GtkWidget *widget); Returns whether the widget has been configured to always emit ::drag-motion signals.
Since 2.10 gtk_drag_finish ()void gtk_drag_finish (GdkDragContext *context, gboolean success, gboolean del, guint32 time_); Informs the drag source that the drop is finished, and that the data of the drag will no longer be required.
gtk_drag_get_data ()void gtk_drag_get_data (GtkWidget *widget, GdkDragContext *context, GdkAtom target, guint32 time_);
Gets the data associated with a drag. When the data
is received or the retrieval fails, GTK+ will emit a
"drag_data_received" signal. Failure of the retrieval
is indicated by the length field of the
gtk_drag_get_source_widget ()GtkWidget* gtk_drag_get_source_widget (GdkDragContext *context); Determines the source widget for a drag.
gtk_drag_highlight ()void gtk_drag_highlight (GtkWidget *widget);
Draws a highlight around a widget. This will attach
handlers to "expose_event" and "draw", so the highlight
will continue to be displayed until
gtk_drag_unhighlight ()void gtk_drag_unhighlight (GtkWidget *widget);
Removes a highlight set by
gtk_drag_begin ()GdkDragContext* gtk_drag_begin (GtkWidget *widget, GtkTargetList *targets, GdkDragAction actions, gint button, GdkEvent *event);
Initiates a drag on the source side. The function
only needs to be used when the application is
starting drags itself, and is not needed when
gtk_drag_set_icon_widget ()void gtk_drag_set_icon_widget (GdkDragContext *context, GtkWidget *widget, gint hot_x, gint hot_y); Changes the icon for a widget to a given widget. GTK+ will not destroy the icon, so if you don't want it to persist, you should connect to the "drag-end" signal and destroy it yourself.
gtk_drag_set_icon_pixmap ()void gtk_drag_set_icon_pixmap (GdkDragContext *context, GdkColormap *colormap, GdkPixmap *pixmap, GdkBitmap *mask, gint hot_x, gint hot_y);
Sets
gtk_drag_set_icon_pixbuf ()void gtk_drag_set_icon_pixbuf (GdkDragContext *context, GdkPixbuf *pixbuf, gint hot_x, gint hot_y);
Sets
gtk_drag_set_icon_stock ()void gtk_drag_set_icon_stock (GdkDragContext *context, const gchar *stock_id, gint hot_x, gint hot_y); Sets the icon for a given drag from a stock ID.
gtk_drag_set_icon_name ()void gtk_drag_set_icon_name (GdkDragContext *context, const gchar *icon_name, gint hot_x, gint hot_y);
Sets the icon for a given drag from a named themed icon. See
the docs for GtkIconTheme for more details. Note that the
size of the icon depends on the icon theme (the icon is
loaded at the symbolic size GTK_ICON_SIZE_DND), thus
Since 2.8 gtk_drag_set_icon_default ()void gtk_drag_set_icon_default (GdkDragContext *context); Sets the icon for a particular drag to the default icon.
gtk_drag_set_default_icon ()void gtk_drag_set_default_icon (GdkColormap *colormap, GdkPixmap *pixmap, GdkBitmap *mask, gint hot_x, gint hot_y); Warning
Changes the default drag icon. GTK+ retains references for the arguments, and will release them when they are no longer needed. This function is obsolete. The default icon should now be changed via the stock system by changing the stock pixbuf for GTK_STOCK_DND.
gtk_drag_check_threshold ()gboolean gtk_drag_check_threshold (GtkWidget *widget, gint start_x, gint start_y, gint current_x, gint current_y);
Checks to see if a mouse drag starting at (
gtk_drag_source_set ()void gtk_drag_source_set (GtkWidget *widget, GdkModifierType start_button_mask, const GtkTargetEntry *targets, gint n_targets, GdkDragAction actions); Sets up a widget so that GTK+ will start a drag operation when the user clicks and drags on the widget. The widget must have a window.
gtk_drag_source_set_icon ()void gtk_drag_source_set_icon (GtkWidget *widget, GdkColormap *colormap, GdkPixmap *pixmap, GdkBitmap *mask);
Sets the icon that will be used for drags from a particular widget
from a pixmap/mask. GTK+ retains references for the arguments, and
will release them when they are no longer needed.
Use
gtk_drag_source_set_icon_pixbuf ()void gtk_drag_source_set_icon_pixbuf (GtkWidget *widget, GdkPixbuf *pixbuf);
Sets the icon that will be used for drags from a particular widget
from a GdkPixbuf. GTK+ retains a reference for
gtk_drag_source_set_icon_stock ()void gtk_drag_source_set_icon_stock (GtkWidget *widget, const gchar *stock_id); Sets the icon that will be used for drags from a particular source to a stock icon.
gtk_drag_source_set_icon_name ()void gtk_drag_source_set_icon_name (GtkWidget *widget, const gchar *icon_name); Sets the icon that will be used for drags from a particular source to a themed icon. See the docs for GtkIconTheme for more details.
Since 2.8 gtk_drag_source_unset ()void gtk_drag_source_unset (GtkWidget *widget);
Undoes the effects of
gtk_drag_source_set_target_list ()void gtk_drag_source_set_target_list (GtkWidget *widget, GtkTargetList *target_list);
Changes the target types that this widget offers for drag-and-drop.
The widget must first be made into a drag source with
Since 2.4 gtk_drag_source_get_target_list ()GtkTargetList* gtk_drag_source_get_target_list (GtkWidget *widget); Gets the list of targets this widget can provide for drag-and-drop.
Since 2.4 gtk_drag_source_add_text_targets ()void gtk_drag_source_add_text_targets (GtkWidget *widget);
Add the text targets supported by GtkSelection to
the target list of the drag source. The targets
are added with
Since 2.6 gtk_drag_source_add_image_targets ()void gtk_drag_source_add_image_targets (GtkWidget *widget);
Add the writable image targets supported by GtkSelection to
the target list of the drag source. The targets
are added with
Since 2.6 gtk_drag_source_add_uri_targets ()void gtk_drag_source_add_uri_targets (GtkWidget *widget);
Add the URI targets supported by GtkSelection to
the target list of the drag source. The targets
are added with
Since 2.6 |