*/
// EXTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/object/base-handle.h>
{
public:
/**
+ * @brief Enumeration for the drag source event type in the source object
+ */
+ enum class SourceEventType
+ {
+ START, ///< Drag and drop is started.
+ CANCEL, ///< Drag and drop is cancelled.
+ ACCEPT, ///< Drag and drop is accepted.
+ FINISH ///< Drag and drop is finished.
+ };
+
+ /**
* @brief Enumeration for the drag event type in the target object
*/
enum class DragType
{
DragEvent()
{
- this->mimeType = nullptr;
+ this->mimeTypes = nullptr;
this->data = nullptr;
}
- DragEvent(DragType type, Dali::Vector2 position, const char* mimeType = nullptr, char* data = nullptr)
+ DragEvent(DragType type, Dali::Vector2 position, const char** mimeTypes = nullptr, int mimeTypesSize = 0, char* data = nullptr)
{
- this->type = type;
- this->position = position;
- this->mimeType = mimeType;
- this->data = data;
+ this->type = type;
+ this->position = position;
+ this->mimeTypes = mimeTypes;
+ this->mimeTypesSize = mimeTypesSize;
+ this->data = data;
}
void SetAction(DragType type)
{
return position;
}
- void SetMimeType(const char* mimeType)
+ void SetMimeTypes(const char** mimeTypes, int mimeTypeSize)
+ {
+ this->mimeTypes = mimeTypes;
+ this->mimeTypesSize = mimeTypeSize;
+ }
+ const char** GetMimeTypes()
{
- this->mimeType = mimeType;
+ return this->mimeTypes;
}
- const char* GetMimeType()
+ int GetMimeTypesSize() const
{
- return mimeType;
+ return mimeTypesSize;
}
void SetData(char* data)
{
this->data = data;
}
- char* GetData()
+ char* GetData() const
{
return data;
}
private:
DragType type{DragType::DROP}; ///< The drag event type.
Dali::Vector2 position; ///< The position of drag object.
- const char* mimeType; ///< The mime type of drag object.
+ const char** mimeTypes{nullptr}; ///< The mime types of drag object.
char* data{nullptr}; ///< The data of drag object.
+ int mimeTypesSize{0}; ///< The size of mime types array.
};
/**
*/
struct DragData
{
- void SetMimeType(const char* mimeType)
+ void SetMimeTypes(const char** mimeTypes, int mimeTypesSize)
{
- this->mimeType = mimeType;
+ this->mimeTypes = mimeTypes;
+ this->mimeTypesSize = mimeTypesSize;
}
- const char* GetMimeType() const
+
+ const char** GetMimeTypes() const
+ {
+ return mimeTypes;
+ }
+
+ int GetMimeTypesSize() const
{
- return mimeType;
+ return mimeTypesSize;
}
- void SetData(char* data)
+
+ void SetDataSet(const char** dataSet, int dataSetSize)
+ {
+ this->dataSet = dataSet;
+ this->dataSetSize = dataSetSize;
+ }
+
+ const char** GetDataSet() const
{
- this->data = data;
+ return dataSet;
}
- char* GetData() const
+
+ int GetDataSetSize() const
{
- return data;
+ return dataSetSize;
}
private:
- const char* mimeType{nullptr}; ///<The mime type of drag data.
- char* data{nullptr}; ///<The drag data.
+ const char** mimeTypes{nullptr};///< The mime types of drag object.
+ int mimeTypesSize{0}; ///< The size of mime types.
+ const char** dataSet{nullptr}; ///<The drag data set.
+ int dataSetSize{0}; ///<The size of data set.
};
using DragAndDropFunction = std::function<void(const DragEvent&)>;
+ using SourceFunction = std::function<void(enum SourceEventType)>;
/**
* @brief Create an uninitialized DragAndDrop.
* @brief Start the drag operation.
*
* @param[in] source The drag source object.
- * @param[in] shadow The shadow object for drag object.
+ * @param[in] shadowWindow The shadow window for drag object.
* @param[in] dragData The data to send to target object.
+ * @param[in] callback The drag source event callback.
* @return bool true if the drag operation is started successfully.
*/
- bool StartDragAndDrop(Dali::Actor source, Dali::Actor shadow, const DragData& dragData);
+ bool StartDragAndDrop(Dali::Actor source, Dali::Window shadowWindow, const DragData& dragData, Dali::DragAndDrop::SourceFunction callback);
/**
* @brief Add the listener for receiving the drag and drop events.
*
* @param[in] target The drop target object.
+ * @param[in] mimeType The mime type of target object.
* @param[in] callback A drag and drop event callback.
* @return bool true if the listener is added successfully.
*/
- bool AddListener(Dali::Actor target, DragAndDropFunction callback);
+ bool AddListener(Dali::Actor target, char* mimeType, DragAndDropFunction callback);
/**
* @brief Remove the listener.
*/
bool RemoveListener(Dali::Actor target);
+ /**
+ * @brief Add the listener for receiving the drag and drop events.
+ *
+ * @param[in] target The drop target object.
+ * @param[in] mimeType The mime type of target object.
+ * @param[in] callback A drag and drop event callback.
+ * @return bool true if the listener is added successfully.
+ */
+ bool AddListener(Dali::Window target, char* mimeType, DragAndDropFunction callback);
+
+ /**
+ * @brief Remove the listener.
+ *
+ * @param[in] target The drop target object.
+ * @return bool true if the listener is removed successfully.
+ */
+ bool RemoveListener(Dali::Window target);
+
public:
/**
* @brief This constructor is used by Adaptor::GetDragAndDrop().