|
DragDrop
|
Home
Documentation
Screenshots
Binary distributions
Source distribution
subclass of Class
DragDrop is not a widget and is not intended to produce instances.
It is a class that manages drag and drop.
A drop can be started using the command
Classy::DragDrop start x y value ...
This should be bound to the <<Drag>> event of the source window.
A window will be notified of a drop by the virtual event <<Drop>>, so
bind window <<Drop>> command
will execute the command when somethind is dropped on the window
The window is also notified of the current drag entering, moving in, or leaving the
window by the <<Drag-Enter>> <<Drag-Motion>> and\
<<Drag-Leave>> events, and can take apropriate actions.
The program can get the data associated with the drag using the command
Classy::DragDrop get ?type?
Config methods
-
Classy::DragDrop start x y value ?option value ...?
-
starts a drag. It clears all previously changed drag and drop settings to their
default values or the ones supplied as options to the start classmethod.
x and y must be the x and y position of the pointer on the screen: you can
use %X and %Y in the event command to get these.
$value is the default value given for the drop if no type is specified.
the options are the same as for the Classy::DragDrop configure classmethod.
-
Classy::DragDrop configure ?option? ?value? ?option value...?
-
returns or changes the options for the current drag. following options are supported:
- -types {type data ?type data ...?}
- gives a list of types, and the data that should be returned when the drop site asks for the data.
- -ftypes {type function ?type function ...?}
- gives a list of types, and a function which will generate the data desired by the drop site.
The function will be executed at global level in the application where the drag originated.
- -transfer type
- type of transfer: $type can be none, copy, move or link
- -cursor cursor
- cursor of drag
- -image image
- dragged image
-
Classy::DragDrop types ?pattern?
-
returns a list of all types supported by the current drag; optionally only those
matching $pattern are returned
-
Classy::DragDrop get ?type?
-
returns the data associated with with the type $type of the current drag.
If no type is given, the default value is returned (the data given to the start classmethod.)
-
Classy::DragDrop bind event ?command?
-
with this classmethod, bindings can be added to the current drag, eg. to change the transfer type
in response to a keypress. Note that the command must come after the drag was
started with the start classmethod.
-
Classy::DragDrop abort
-
abort the current drag.
-
Classy::DragDrop stop
-
make the drop. The user normally does not have to call this classmethod, as it is
usually called by the bindings of DragDrop.
-
Classy::DragDrop move
-
This classmethod is called while dragging. It updates the dragged window, and generates
the Drag events. The user normally does not have to call this classmethod, as it is
usually called by the bindings of DragDrop.