Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_EventDragnDrop.h
| Show All 18 Lines | |||||
| /** \file | /** \file | ||||
| * \ingroup GHOST | * \ingroup GHOST | ||||
| */ | */ | ||||
| #ifndef __GHOST_EVENTDRAGNDROP_H__ | #ifndef __GHOST_EVENTDRAGNDROP_H__ | ||||
| #define __GHOST_EVENTDRAGNDROP_H__ | #define __GHOST_EVENTDRAGNDROP_H__ | ||||
| #include "GHOST_Bitmap.h" | |||||
| #include "GHOST_Event.h" | #include "GHOST_Event.h" | ||||
| extern "C" { | |||||
| #include "IMB_imbuf.h" | |||||
| #include "IMB_imbuf_types.h" | |||||
| }; | |||||
| /** | /** | ||||
| * Drag & drop event | * Drag & drop event | ||||
| * | * | ||||
| * The dragging sequence is performed in four phases: | * The dragging sequence is performed in four phases: | ||||
| * | * | ||||
| * - Start sequence (GHOST_kEventDraggingEntered) that tells | * - Start sequence (GHOST_kEventDraggingEntered) that tells | ||||
| * a drag'n'drop operation has started. | * a drag'n'drop operation has started. | ||||
| Show All 14 Lines | |||||
| * This can happen when the user drops an object on the application icon. | * 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) | * (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder) | ||||
| * | * | ||||
| * Note that the mouse positions are given in Blender coordinates (y=0 at bottom) | * Note that the mouse positions are given in Blender coordinates (y=0 at bottom) | ||||
| * | * | ||||
| * Currently supported object types: | * Currently supported object types: | ||||
| * - UTF-8 string. | * - UTF-8 string. | ||||
| * - array of strings representing filenames (GHOST_TStringArray). | * - array of strings representing filenames (GHOST_TStringArray). | ||||
| * - bitmap #ImBuf. | * - bitmap (GHOST_Bitmap). | ||||
| */ | */ | ||||
| class GHOST_EventDragnDrop : public GHOST_Event { | class GHOST_EventDragnDrop : public GHOST_Event { | ||||
| public: | public: | ||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * \param time The time this event was generated. | * \param time The time this event was generated. | ||||
| * \param type The type of this event. | * \param type The type of this event. | ||||
| * \param dataType The type of the drop candidate object | * \param dataType The type of the drop candidate object | ||||
| Show All 20 Lines | public: | ||||
| ~GHOST_EventDragnDrop() | ~GHOST_EventDragnDrop() | ||||
| { | { | ||||
| // Free the dropped object data | // Free the dropped object data | ||||
| if (m_dragnDropEventData.data == NULL) | if (m_dragnDropEventData.data == NULL) | ||||
| return; | return; | ||||
| switch (m_dragnDropEventData.dataType) { | switch (m_dragnDropEventData.dataType) { | ||||
| case GHOST_kDragnDropTypeBitmap: | case GHOST_kDragnDropTypeBitmap: { | ||||
| IMB_freeImBuf((ImBuf *)m_dragnDropEventData.data); | GHOST_Bitmap *bitmap = (GHOST_Bitmap *)m_dragnDropEventData.data; | ||||
| delete bitmap; | |||||
| break; | break; | ||||
| } | |||||
| case GHOST_kDragnDropTypeFilenames: { | case GHOST_kDragnDropTypeFilenames: { | ||||
| GHOST_TStringArray *strArray = (GHOST_TStringArray *)m_dragnDropEventData.data; | GHOST_TStringArray *strArray = (GHOST_TStringArray *)m_dragnDropEventData.data; | ||||
| int i; | int i; | ||||
| for (i = 0; i < strArray->count; i++) | for (i = 0; i < strArray->count; i++) | ||||
| free(strArray->strings[i]); | free(strArray->strings[i]); | ||||
| free(strArray->strings); | free(strArray->strings); | ||||
| Show All 17 Lines | |||||