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)
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
GHOST_System::GHOST_System()
|
||||
: m_displayManager(0), m_timerManager(0), m_windowManager(0), m_eventManager(0), m_ndofManager(0)
|
||||
{
|
||||
m_canAcceptDragOperation = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -275,6 +276,15 @@ GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButtonMask mask, bool& isDown
|
||||
return success;
|
||||
}
|
||||
|
||||
void GHOST_System::setAcceptDragOperation(bool canAccept)
|
||||
{
|
||||
m_canAcceptDragOperation = canAccept;
|
||||
}
|
||||
|
||||
bool GHOST_System::canAcceptDragOperation() const
|
||||
{
|
||||
return m_canAcceptDragOperation;
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_System::init()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user