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]
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:
modi specifies a list of buttons that can start the drag (e.g. `BUTTON1): see Gdk.Tags.modifier
Gtk.target_entry list specifies a table of target data types the drag will support
actions specifies a list of possible actions for a drag from this window
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
The source widget is sent the following signals during a drag-and-drop operation.
Table 19-1. Source widget signals
drag_begin | method beginning : callback:(drag_context -> unit) -> GtkSignal.id |
drag_motion | method motion : callback:(drag_context -> x:int -> y:int -> time:int32 -> bool) -> GtkSignal.id |
drag_data_get | method data_get : callback:(drag_context -> selection_context -> info:int -> time:int32 -> unit) -> GtkSignal.id |
drag_data_delete | method data_delete : callback:(drag_context -> unit) -> GtkSignal.id |
drag_drop | method drop : callback:(drag_context -> x:int -> y:int -> time:int32 -> bool) -> GtkSignal.id |
drag_end | method ending : callback:(drag_context -> unit) -> GtkSignal.id |
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
The destination widget is sent the following signals during a drag-and-drop operation.