gtk.DragAndDrop.DragAndDrop Class Reference

List of all members.

Detailed Description

Description GTK+ 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.


Public Member Functions

GdkDragContext * getDragAndDropStruct ()
 this (GdkDragContext *gdkDragContext)
 Sets our main struct and passes it to the parent class.
void finish (int success, int del, uint time)
 Informs the drag source that the drop is finished, and that the data of the drag will no longer be required.
Widget getSourceWidget ()
 Determines the source widget for a drag.
void setIconWidget (Widget widget, int hotX, int hotY)
 Changes the icon for a widget to a given widget.
void setIconPixmap (Colormap colormap, Pixmap pixmap, Bitmap mask, int hotX, int hotY)
 Sets pixmap as the icon for a given drag.
void setIconPixbuf (Pixbuf pixbuf, int hotX, int hotY)
 Sets pixbuf as the icon for a given drag.
void setIconStock (char[] stockId, int hotX, int hotY)
 Sets the icon for a given drag from a stock ID.
void setIconName (char[] iconName, int hotX, int hotY)
 Sets the icon for a given drag from a named themed icon.
void setIconDefault ()
 Sets the icon for a particular drag to the default icon.

Static Public Member Functions

static void destSet (Widget widget, GtkDestDefaults flags, GtkTargetEntry *targets, int nTargets, GdkDragAction actions)
 Sets a widget as a potential drop destination.
static void destSetProxy (Widget widget, Window proxyWindow, GdkDragProtocol protocol, int useCoordinates)
 Sets this widget as a proxy for drops to another window.
static void destUnset (Widget widget)
 Clears information about a drop destination set with gtk_drag_dest_set().
static GdkAtom destFindTarget (Widget widget, DragContext context, GtkTargetList *targetList)
 Looks for a match between context->targets and the dest_target_list, returning the first matching target, otherwise returning GDK_NONE.
static GtkTargetListdestGetTargetList (Widget widget)
 Returns the list of targets this widget can accept from drag-and-drop.
static void destSetTargetList (Widget widget, GtkTargetList *targetList)
 Sets the target types that this widget can accept from drag-and-drop.
static void destAddTextTargets (Widget widget)
 Add the text targets supported by GtkSelection to the target list of the drag destination.
static void destAddImageTargets (Widget widget)
 Add the image targets supported by GtkSelection to the target list of the drag destination.
static void destAddUriTargets (Widget widget)
 Add the URI targets supported by GtkSelection to the target list of the drag destination.
static void destSetTrackMotion (Widget widget, int trackMotion)
 Tells the widget to emit drag-motion and drag-leave events regardless of the targets and the GTK_DEST_DEFAULT_MOTION flag.
static int destGetTrackMotion (Widget widget)
 Returns whether the widget has been configured to always emit drag-motion signals.
static void getData (Widget widget, DragContext context, GdkAtom target, uint time)
 Gets the data associated with a drag.
static void highlight (Widget widget)
 Draws a highlight around a widget.
static void unhighlight (Widget widget)
 Removes a highlight set by gtk_drag_highlight() from a widget.
static DragContext begin (Widget widget, GtkTargetList *targets, GdkDragAction actions, int button, Event event)
 Initiates a drag on the source side.
static void setDefaultIcon (Colormap colormap, Pixmap pixmap, Bitmap mask, int hotX, int hotY)
 Warning gtk_drag_set_default_icon is deprecated and should not be used in newly-written code.
static int checkThreshold (Widget widget, int startX, int startY, int currentX, int currentY)
 Checks to see if a mouse drag starting at (start_x, start_y) and ending at (current_x, current_y) has passed the GTK+ drag threshold, and thus should trigger the beginning of a drag-and-drop operation.
static void sourceSet (Widget widget, GdkModifierType startButtonMask, GtkTargetEntry *targets, int nTargets, GdkDragAction actions)
 Sets up a widget so that GTK+ will start a drag operation when the user clicks and drags on the widget.
static void sourceSetIcon (Widget widget, Colormap colormap, Pixmap pixmap, Bitmap mask)
 Sets the icon that will be used for drags from a particular widget from a pixmap/mask.
static void sourceSetIconPixbuf (Widget widget, Pixbuf pixbuf)
 Sets the icon that will be used for drags from a particular widget from a GdkPixbuf.
static void sourceSetIconStock (Widget widget, char[] stockId)
 Sets the icon that will be used for drags from a particular source to a stock icon.
static void sourceSetIconName (Widget widget, char[] iconName)
 Sets the icon that will be used for drags from a particular source to a themed icon.
static void sourceUnset (Widget widget)
 Undoes the effects of gtk_drag_source_set().
static void sourceSetTargetList (Widget widget, GtkTargetList *targetList)
 Changes the target types that this widget offers for drag-and-drop.
static GtkTargetListsourceGetTargetList (Widget widget)
 Gets the list of targets this widget can provide for drag-and-drop.
static void sourceAddTextTargets (Widget widget)
 Add the text targets supported by GtkSelection to the target list of the drag source.
static void sourceAddImageTargets (Widget widget)
 Add the writable image targets supported by GtkSelection to the target list of the drag source.
static void sourceAddUriTargets (Widget widget)
 Add the URI targets supported by GtkSelection to the target list of the drag source.

Protected Member Functions

void * getStruct ()
 the main Gtk struct as a void*

Protected Attributes

GdkDragContext * gdkDragContext
 the main Gtk struct


Constructor & Destructor Documentation

gtk.DragAndDrop.DragAndDrop.this ( GdkDragContext *  gdkDragContext  ) 

Sets our main struct and passes it to the parent class.


Member Function Documentation

static DragContext gtk.DragAndDrop.DragAndDrop.begin ( Widget  widget,
GtkTargetList targets,
GdkDragAction  actions,
int  button,
Event  event 
) [static]

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_source_set() is used. widget: the source widget. targets: The targets (data formats) in which the source can provide the data. actions: A bitmask of the allowed drag actions for this drag. button: The button the user clicked to start the drag. event: The event that triggered the start of the drag. Returns: the context for this drag.

static int gtk.DragAndDrop.DragAndDrop.checkThreshold ( Widget  widget,
int  startX,
int  startY,
int  currentX,
int  currentY 
) [static]

Checks to see if a mouse drag starting at (start_x, start_y) and ending at (current_x, current_y) has passed the GTK+ drag threshold, and thus should trigger the beginning of a drag-and-drop operation.

widget: a GtkWidget start_x: X coordinate of start of drag start_y: Y coordinate of start of drag current_x: current X coordinate current_y: current Y coordinate Returns: TRUE if the drag threshold has been passed.

static void gtk.DragAndDrop.DragAndDrop.destAddImageTargets ( Widget  widget  )  [static]

Add the image targets supported by GtkSelection to the target list of the drag destination.

The targets are added with info = 0. If you need another value, use gtk_target_list_add_image_targets() and gtk_drag_dest_set_target_list(). widget: a GtkWidget that's a drag destination Since 2.6

static void gtk.DragAndDrop.DragAndDrop.destAddTextTargets ( Widget  widget  )  [static]

Add the text targets supported by GtkSelection to the target list of the drag destination.

The targets are added with info = 0. If you need another value, use gtk_target_list_add_text_targets() and gtk_drag_dest_set_target_list(). widget: a GtkWidget that's a drag destination Since 2.6

static void gtk.DragAndDrop.DragAndDrop.destAddUriTargets ( Widget  widget  )  [static]

Add the URI targets supported by GtkSelection to the target list of the drag destination.

The targets are added with info = 0. If you need another value, use gtk_target_list_add_uri_targets() and gtk_drag_dest_set_target_list(). widget: a GtkWidget that's a drag destination Since 2.6

static GdkAtom gtk.DragAndDrop.DragAndDrop.destFindTarget ( Widget  widget,
DragContext  context,
GtkTargetList targetList 
) [static]

Looks for a match between context->targets and the dest_target_list, returning the first matching target, otherwise returning GDK_NONE.

dest_target_list should usually be the return value from gtk_drag_dest_get_target_list(), but some widgets may have different valid targets for different parts of the widget; in that case, they will have to implement a drag_motion handler that passes the correct target list to this function. widget: drag destination widget context: drag context target_list: list of droppable targets, or NULL to use gtk_drag_dest_get_target_list (widget). Returns: first target that the source offers and the dest can accept, or GDK_NONE

static GtkTargetList* gtk.DragAndDrop.DragAndDrop.destGetTargetList ( Widget  widget  )  [static]

Returns the list of targets this widget can accept from drag-and-drop.

widget: a GtkWidget Returns: the GtkTargetList, or NULL if none

static int gtk.DragAndDrop.DragAndDrop.destGetTrackMotion ( Widget  widget  )  [static]

Returns whether the widget has been configured to always emit drag-motion signals.

widget: a GtkWidget that's a drag destination Returns: TRUE if the widget always emits drag-motion events Since 2.10

static void gtk.DragAndDrop.DragAndDrop.destSet ( Widget  widget,
GtkDestDefaults  flags,
GtkTargetEntry targets,
int  nTargets,
GdkDragAction  actions 
) [static]

Sets a widget as a potential drop destination.

widget: a GtkWidget flags: the flags that specify what actions GTK+ should take on behalf of a widget for drops onto that widget. The targets and actions fields only are used if GTK_DEST_DEFAULT_MOTION or GTK_DEST_DEFAULT_DROP are given. targets: a pointer to an array of GtkTargetEntrys indicating the drop types that this widget will accept. n_targets: the number of entries in targets. actions: a bitmask of possible actions for a drop onto this widget.

static void gtk.DragAndDrop.DragAndDrop.destSetProxy ( Widget  widget,
Window  proxyWindow,
GdkDragProtocol  protocol,
int  useCoordinates 
) [static]

Sets this widget as a proxy for drops to another window.

widget: a GtkWidget proxy_window: the window to which to forward drag events protocol: the drag protocol which the proxy_window accepts (You can use gdk_drag_get_protocol() to determine this) use_coordinates: If TRUE, send the same coordinates to the destination, because it is an embedded subwindow.

static void gtk.DragAndDrop.DragAndDrop.destSetTargetList ( Widget  widget,
GtkTargetList targetList 
) [static]

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_set(). widget: a GtkWidget that's a drag destination target_list: list of droppable targets, or NULL for none

static void gtk.DragAndDrop.DragAndDrop.destSetTrackMotion ( Widget  widget,
int  trackMotion 
) [static]

Tells the widget to emit drag-motion and drag-leave events regardless of the targets and the GTK_DEST_DEFAULT_MOTION flag.

This may be used when a widget wants to do generic actions regardless of the targets that the source offers. widget: a GtkWidget that's a drag destination track_motion: whether to accept all targets Since 2.10

static void gtk.DragAndDrop.DragAndDrop.destUnset ( Widget  widget  )  [static]

Clears information about a drop destination set with gtk_drag_dest_set().

The widget will no longer receive notification of drags. widget: a GtkWidget

void gtk.DragAndDrop.DragAndDrop.finish ( int  success,
int  del,
uint  time 
)

Informs the drag source that the drop is finished, and that the data of the drag will no longer be required.

context: the drag context. success: a flag indicating whether the drop was successful del: a flag indicating whether the source should delete the original data. (This should be TRUE for a move) time_: the timestamp from the "drag_data_drop" signal.

static void gtk.DragAndDrop.DragAndDrop.getData ( Widget  widget,
DragContext  context,
GdkAtom  target,
uint  time 
) [static]

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 selection_data signal parameter being negative. However, when gtk_drag_get_data() is called implicitely because the GTK_DEST_DEFAULT_DROP was set, then the widget will not receive notification of failed drops. widget: the widget that will receive the "drag_data_received" signal. context: the drag context target: the target (form of the data) to retrieve. time_: a timestamp for retrieving the data. This will generally be the time received in a "drag_data_motion" or "drag_data_drop" signal.

GdkDragContext* gtk.DragAndDrop.DragAndDrop.getDragAndDropStruct (  ) 

Widget gtk.DragAndDrop.DragAndDrop.getSourceWidget (  ) 

Determines the source widget for a drag.

context: a (destination side) drag context. Returns: if the drag is occurring within a single application, a pointer to the source widget. Otherwise, NULL.

void* gtk.DragAndDrop.DragAndDrop.getStruct (  )  [protected]

the main Gtk struct as a void*

static void gtk.DragAndDrop.DragAndDrop.highlight ( Widget  widget  )  [static]

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() is called. widget: a widget to highlight

static void gtk.DragAndDrop.DragAndDrop.setDefaultIcon ( Colormap  colormap,
Pixmap  pixmap,
Bitmap  mask,
int  hotX,
int  hotY 
) [static]

Warning gtk_drag_set_default_icon is deprecated and should not be used in newly-written code.

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. colormap: the colormap of the icon pixmap: the image data for the icon mask: the transparency mask for an image. hot_x: The X offset within widget of the hotspot. hot_y: The Y offset within widget of the hotspot.

void gtk.DragAndDrop.DragAndDrop.setIconDefault (  ) 

Sets the icon for a particular drag to the default icon.

context: the context for a drag. (This must be called with a context for the source side of a drag)

void gtk.DragAndDrop.DragAndDrop.setIconName ( char[]  iconName,
int  hotX,
int  hotY 
)

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 hot_x and hot_y have to be used with care. context: the context for a drag. (This must be called with a context for the source side of a drag) icon_name: name of icon to use hot_x: the X offset of the hotspot within the icon hot_y: the Y offset of the hotspot within the icon Since 2.8

void gtk.DragAndDrop.DragAndDrop.setIconPixbuf ( Pixbuf  pixbuf,
int  hotX,
int  hotY 
)

Sets pixbuf as the icon for a given drag.

context: the context for a drag. (This must be called with a context for the source side of a drag) pixbuf: the GdkPixbuf to use as the drag icon. hot_x: the X offset within widget of the hotspot. hot_y: the Y offset within widget of the hotspot.

void gtk.DragAndDrop.DragAndDrop.setIconPixmap ( Colormap  colormap,
Pixmap  pixmap,
Bitmap  mask,
int  hotX,
int  hotY 
)

Sets pixmap as the icon for a given drag.

GTK+ retains references for the arguments, and will release them when they are no longer needed. In general, gtk_drag_set_icon_pixbuf() will be more convenient to use. context: the context for a drag. (This must be called with a context for the source side of a drag) colormap: the colormap of the icon pixmap: the image data for the icon mask: the transparency mask for the icon hot_x: the X offset within pixmap of the hotspot. hot_y: the Y offset within pixmap of the hotspot.

void gtk.DragAndDrop.DragAndDrop.setIconStock ( char[]  stockId,
int  hotX,
int  hotY 
)

Sets the icon for a given drag from a stock ID.

context: the context for a drag. (This must be called with a context for the source side of a drag) stock_id: the ID of the stock icon to use for the drag. hot_x: the X offset within the icon of the hotspot. hot_y: the Y offset within the icon of the hotspot.

void gtk.DragAndDrop.DragAndDrop.setIconWidget ( Widget  widget,
int  hotX,
int  hotY 
)

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. context: the context for a drag. (This must be called with a context for the source side of a drag) widget: a toplevel window to use as an icon. hot_x: the X offset within widget of the hotspot. hot_y: the Y offset within widget of the hotspot.

static void gtk.DragAndDrop.DragAndDrop.sourceAddImageTargets ( Widget  widget  )  [static]

Add the writable image targets supported by GtkSelection to the target list of the drag source.

The targets are added with info = 0. If you need another value, use gtk_target_list_add_image_targets() and gtk_drag_source_set_target_list(). widget: a GtkWidget that's is a drag source Since 2.6

static void gtk.DragAndDrop.DragAndDrop.sourceAddTextTargets ( Widget  widget  )  [static]

Add the text targets supported by GtkSelection to the target list of the drag source.

The targets are added with info = 0. If you need another value, use gtk_target_list_add_text_targets() and gtk_drag_source_set_target_list(). widget: a GtkWidget that's is a drag source Since 2.6

static void gtk.DragAndDrop.DragAndDrop.sourceAddUriTargets ( Widget  widget  )  [static]

Add the URI targets supported by GtkSelection to the target list of the drag source.

The targets are added with info = 0. If you need another value, use gtk_target_list_add_uri_targets() and gtk_drag_source_set_target_list(). widget: a GtkWidget that's is a drag source Since 2.6

static GtkTargetList* gtk.DragAndDrop.DragAndDrop.sourceGetTargetList ( Widget  widget  )  [static]

Gets the list of targets this widget can provide for drag-and-drop.

widget: a GtkWidget Returns: the GtkTargetList, or NULL if none Since 2.4

static void gtk.DragAndDrop.DragAndDrop.sourceSet ( Widget  widget,
GdkModifierType  startButtonMask,
GtkTargetEntry targets,
int  nTargets,
GdkDragAction  actions 
) [static]

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. widget: a GtkWidget start_button_mask: the bitmask of buttons that can start the drag targets: the table of targets that the drag will support n_targets: the number of items in targets actions: the bitmask of possible actions for a drag from this widget.

static void gtk.DragAndDrop.DragAndDrop.sourceSetIcon ( Widget  widget,
Colormap  colormap,
Pixmap  pixmap,
Bitmap  mask 
) [static]

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() instead. widget: a GtkWidget colormap: the colormap of the icon pixmap: the image data for the icon mask: the transparency mask for an image.

static void gtk.DragAndDrop.DragAndDrop.sourceSetIconName ( Widget  widget,
char[]  iconName 
) [static]

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. widget: a GtkWidget icon_name: name of icon to use Since 2.8

static void gtk.DragAndDrop.DragAndDrop.sourceSetIconPixbuf ( Widget  widget,
Pixbuf  pixbuf 
) [static]

Sets the icon that will be used for drags from a particular widget from a GdkPixbuf.

GTK+ retains a reference for pixbuf and will release it when it is no longer needed. widget: a GtkWidget pixbuf: the GdkPixbuf for the drag icon

static void gtk.DragAndDrop.DragAndDrop.sourceSetIconStock ( Widget  widget,
char[]  stockId 
) [static]

Sets the icon that will be used for drags from a particular source to a stock icon.

widget: a GtkWidget stock_id: the ID of the stock icon to use

static void gtk.DragAndDrop.DragAndDrop.sourceSetTargetList ( Widget  widget,
GtkTargetList targetList 
) [static]

Changes the target types that this widget offers for drag-and-drop.

The widget must first be made into a drag source with gtk_drag_source_set(). widget: a GtkWidget that's a drag source target_list: list of draggable targets, or NULL for none Since 2.4

static void gtk.DragAndDrop.DragAndDrop.sourceUnset ( Widget  widget  )  [static]

Undoes the effects of gtk_drag_source_set().

widget: a GtkWidget

static void gtk.DragAndDrop.DragAndDrop.unhighlight ( Widget  widget  )  [static]

Removes a highlight set by gtk_drag_highlight() from a widget.

widget: a widget to remove the highlight from.


Member Data Documentation

GdkDragContext* gtk.DragAndDrop.DragAndDrop.gdkDragContext [protected]

the main Gtk struct


SourceForge.net Logo DSource.org Logo digitalmars.com Logo