NAME
DragSite - Commands set for Drag facilities
COMMAND
DragSite::include class type event
DragSite::register path ?option value...?
DragSite::setdrag path subpath initcmd endcmd ?force?



DESCRIPTION

Commands of this namespace enable user to define a BWidget or a Tk widget as a drag site.



COMMAND
DragSite::include class type event
This command provides a simple way to include options relatives to a drag site into BWidget resources definition. It includes the options needed for register: -dragevent, initialized to event, -draginitcmd and -dragendcmd, initialized to empty string, and two new options:
-dragenabledSpecifies wether or not drag is active (initialized to 0)
-dragtypeDefault or alternate dragged data type (initialized to type)
DragSite::register path ?option value...?
This command is used to declare path as a drag site. Options are:

-dragendcmd
Command called when drag terminates (ie when user release drag icon). This command is called with the following arguments:
  • the pathname of the drag source (the widget itself),
  • the pathname of the drop target,
  • the operation,
  • the type of the dragged data,
  • the dragged data,
  • result of the drop,
If the drop does not occurs, the target and the operation are empty string and the result is 0. If the drop occurs, the result is the value returned by the dropcmd command of the target.
-dragevent
Event associated to the drag. Must be a <ButtonPress-x> event.
-draginitcmd
Command called when drag initiates. When the event of option dragevent occurs on path, this command is called with the following arguments:
  • pathname of the drag source (path),
  • root x-coordinate of pointer,
  • root y-coordinate of pointer,
  • a toplevel created to represent dragged data. When returning, if it has no children, a bitmap is automatically displayed.
The command must return a list containing three elements:
  • the type of the data,
  • the list of operations,
  • and the data.
In all other cases, drag is canceled.
The list of operations specifies the possible operations that can be done. It has the form {modifier operation modifier operation...}, where modifier is one of default, shift, control or alt and operation is one of copy, move or link.
The drag icon contains a bitmap that indicates the current operation, except if the operation is the default one (specified by the default modifier).
If no default modifier is available, the default operation is forced to be copy, even if copy does not appears as a supported operation.
copy operation is forced to be a possible operation in order to have at leat one common supported operation between drag source and drop target. Normally, copy operation does not modify the drag source.
DragSite::setdrag path subpath initcmd endcmd ?force?
This command provides a simple way to call register during a BWidget creation or configuration. setdrag verifies the modification flag of options dragenabled and dragevent and calls register if needed according to the options values and initcmd and endcmd arguments. draginitcmd and dragendcmd are not taken from options of widget because they are considered as user command, called by BWidget implementation of drag-init and drag-end events.