diff options
author | Damien Plisson <damien.plisson@yahoo.fr> | 2009-11-10 15:56:46 +0300 |
---|---|---|
committer | Damien Plisson <damien.plisson@yahoo.fr> | 2009-11-10 15:56:46 +0300 |
commit | af2e6c38e99024d5055e66e2aea75de61c3280e9 (patch) | |
tree | f7c58a77af74ccdab2cb13bd48a2e587c6ad32a6 /intern/ghost/GHOST_C-api.h | |
parent | 14f9e686fa7b729a36549778fcf8e2cfd31bf424 (diff) |
Drag & drop implementation at GHOST level (only OSX for now)
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 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)
Note that the event handler is responsible for freeing the received data.
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
- Array of filenames (full paths)
- Bitmap image (not implemented yet)
Diffstat (limited to 'intern/ghost/GHOST_C-api.h')
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index bd812177f17..5e434c0eaa0 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -406,6 +406,17 @@ extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle, GHOST_TButtonMask mask, int* isDown); + +/*************************************************************************************** + ** Drag'n'drop operations + ***************************************************************************************/ + +/** + * Tells if the ongoing drag'n'drop object can be accepted upon mouse drop + */ +extern void GHOST_setAcceptDragOperation(GHOST_SystemHandle systemhandle, GHOST_TInt8 canAccept); + + /** * Returns the event type. * @param eventhandle The handle to the event |