[Bf-committers] Drag'n'drop feature initiated

Damien Plisson damien.plisson at yahoo.fr
Tue Nov 17 09:57:08 CET 2009


Hi all,

I've started the implementation of the drag'n'drop feature by implementing it in ghost, with a new event type (class GHOST_EventDragnDrop) that is meant to be os independent.

The dragging sequence is performed in four phases:

- Start sequence (GHOST_kEventDraggingEntered) that tells a drag'n'drop operation has started. Already gives the object data type, and the entering mouse location

- Update mouse position (GHOST_kEventDraggingUpdated) sent upon each mouse move until the drag'n'drop operation stops, to give the updated mouse position.
Useful to highlight a potential destination, and update the status (through GHOST_setAcceptDragOperation) telling if the object can be dropped at the current cursor position.

- Abort drag'n'drop sequence (GHOST_kEventDraggingExited) sent when the user moved the mouse outside the window.

- Send the dropped data (GHOST_kEventDraggingDropDone)

- Outside of the normal sequence, dropped data can be directly sent (GHOST_kEventDraggingDropOnIcon). This can happen when the user drops an object on the application icon. (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder). But in this event, no mouse coordinates are set.

The "dropped object" data is freed upon event object release (already handled in the event dispatch loop).

And the mouse position is sent directly in blender client coordinates (y=0 at bottom).

The GHOST_setAcceptDragOperation(TRUE) call must be placed before the user drops the object for it to be accepted.

Current handled data types :
- Text string (meant to be any string but filename, type = char *)
- Array of filenames (full paths, type = GHOST_TStringArray )
- Bitmap image (not implemented yet - is it available in x11 & win ?)

The ghost, and its mac implementation are already in svn.

So now, feel free to make use of these events in the various blender features (e.g. sequencer, ...), and for x11 & win coders to implement it on their platforms !

Cheers,

Damien


More information about the Bf-committers mailing list