19.3. Functions

You can find the full DragAndDrop specification in GObj.drag_ops. And you can use these functions(methods) and events like this:

[widget]#drag#[method name]
[widget]#drag#connect#[event name]

19.3.1. Setting up the source widget

The method drag#source_set specifies a set of target types for a drag operation on a widget.

method source_set :
	?modi:Gdk.Tags.modifier list ->
	?actions:Gdk.Tags.drag_action list ->
	Gtk.target_entry list -> unit

The parameters signify the following:

The Gtk.target_entry type is the following structure:

type target_entry = {
	target : string; 
	flags : Tags.target_flags list; 
	info : int; 
} 

type target_flags = [ `SAME_APP | `SAME_WIDGET ] 

The fields specify a string representing the drag type, optional flags and application assigned integer identifier.

If a widget is no longer required to act as a source for drag-and-drop operations, the method drag#source_unset can be used to remove a set of drag-and-drop target types.

method source_unset : unit -> unit

19.3.2. Signals on the source widget:

The source widget is sent the following signals during a drag-and-drop operation.

Table 19-1. Source widget signals

drag_beginmethod beginning : callback:(drag_context -> unit) -> GtkSignal.id
drag_motionmethod motion : callback:(drag_context -> x:int -> y:int -> time:int32 -> bool) -> GtkSignal.id
drag_data_getmethod data_get : callback:(drag_context -> selection_context -> info:int -> time:int32 -> unit) -> GtkSignal.id
drag_data_deletemethod data_delete : callback:(drag_context -> unit) -> GtkSignal.id
drag_dropmethod drop : callback:(drag_context -> x:int -> y:int -> time:int32 -> bool) -> GtkSignal.id
drag_endmethod ending : callback:(drag_context -> unit) -> GtkSignal.id

19.3.3. Setting up a destination widget:

drag#dest_set specifies that this widget can receive drops and specifies what types of drops it can receive.

drag#dest_unset specifies that the widget can no longer receive drops.

method dest_set :
	?flags:Gtk.Tags.dest_defaults list ->
	?actions:Gdk.Tags.drag_action list ->
	Gtk.target_entry list -> unit

method dest_unset : unit -> unit

19.3.4. Signals on the destination widget:

The destination widget is sent the following signals during a drag-and-drop operation.

Table 19-2. Destination widget signals

drag_data_receivedmethod data_received : callback:(drag_context -> x:int -> y:int -> selection_data -> info:int -> time:int32 -> unit) -> GtkSignal.id