Bind : Add multi-mimetype feature for Drag and Drop 08/316808/2
authorTaehyub Kim <taehyub.kim@samsung.com>
Wed, 28 Aug 2024 10:55:20 +0000 (19:55 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Tue, 10 Sep 2024 08:31:39 +0000 (17:31 +0900)
Contents
- Allow to set multi-mimetypes for source client (use DragInfo)
- Target client receive source's mimetypes from source client when Enter, Move, Leave
- Target client can set mimetype to receive

Change-Id: I75e33e5549bc57942322fd4f019d054823211c43

dali-csharp-binder/dali-adaptor/drag-and-drop-wrap.cpp

index f3f2f33746f2145a40342633d0ca83e013424282..73214eb4ec63fc4294604be9a240573679294ddd 100644 (file)
@@ -54,7 +54,7 @@ SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_DragAndDrop_New__SWIG_0() {
  return jresult;
 }
 
-SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_StartDragAndDrop(void * argDnD, void * argSource, void * argShadowWindow, void * argMimeType, char * argData, void * argSourceCallback) {
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_StartDragAndDrop(void * argDnD, void * argSource, void * argShadowWindow, char ** argMimeTypes, int argMimeTypesSize, char ** argDataSet, int argDataSetSize, void * argSourceCallback) {
   Dali::DragAndDrop *dnd = (Dali::DragAndDrop *)argDnD;
 
   if (!dnd) {
@@ -83,8 +83,8 @@ SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_StartDragAndDrop(void * argD
   shadow = *pShadow;
 
   Dali::DragAndDrop::DragData dragData;
-  dragData.SetMimeType((const char*)argMimeType);
-  dragData.SetData(argData);
+  dragData.SetMimeTypes((const char**)argMimeTypes, argMimeTypesSize);
+  dragData.SetDataSet((const char**)argDataSet, argDataSetSize);
 
   bool result = false;
   {
@@ -97,8 +97,8 @@ SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_StartDragAndDrop(void * argD
   return result;
 }
 
-SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_AddListener(void * jarg1, void * jarg2, void * jarg3) {
-  Dali::DragAndDrop *dnd = (Dali::DragAndDrop *)jarg1;
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_AddListener(void * argDnD, void * argTarget, char * argMimeType, void * argCallback) {
+  Dali::DragAndDrop *dnd = (Dali::DragAndDrop *)argDnD;
   if (!dnd) {
     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, nullExceptMsg, 0);
     return false;
@@ -107,7 +107,7 @@ SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_AddListener(void * jarg1, vo
   Dali::Actor *argp2;
   Dali::Actor target;
 
-  argp2 = (Dali::Actor *)jarg2;
+  argp2 = (Dali::Actor *)argTarget;
   if (!argp2) {
     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, nullExceptMsg, 0);
     return false;
@@ -117,8 +117,8 @@ SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_AddListener(void * jarg1, vo
   bool result = false;
   {
     try {
-      dndCallback = (DnDCallback)jarg3;
-      result = dnd->AddListener(target, dndCallback);
+      dndCallback = (DnDCallback)argCallback;
+      result = dnd->AddListener(target, argMimeType, dndCallback);
     }
     CALL_CATCH_EXCEPTION(0);
   }
@@ -153,7 +153,7 @@ SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_RemoveListener(void * argDnD
   return result;
 }
 
-SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_Window_AddListener(void * argDnD, void * argTarget, void * argCallback) {
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_Window_AddListener(void * argDnD, void * argTarget, char * argMimeType, void * argCallback) {
   Dali::DragAndDrop *dnd = (Dali::DragAndDrop *)argDnD;
   if (!dnd) {
     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, nullExceptMsg, 0);
@@ -174,7 +174,7 @@ SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragAndDrop_Window_AddListener(void * ar
   {
     try {
       dndCallback = (DnDCallback)argCallback;
-      result = dnd->AddListener(target, dndCallback);
+      result = dnd->AddListener(target, argMimeType, dndCallback);
     }
     CALL_CATCH_EXCEPTION(0);
   }
@@ -258,10 +258,11 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_Dali_DragEvent_GetMimeType(void * argDragEv
   }
   {
     try {
-      const char* mimeType = ((Dali::DragAndDrop::DragEvent &)*dragEvent).GetMimeType();
-      if (mimeType != nullptr)
+
+      char** mimeTypes = (char**)((Dali::DragAndDrop::DragEvent &)*dragEvent).GetMimeTypes();
+      if (mimeTypes != nullptr)
       {
-        result = mimeType;
+        result = mimeTypes[0];
       }
       else
       {
@@ -275,6 +276,23 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_Dali_DragEvent_GetMimeType(void * argDragEv
   return jresult;
 }
 
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_DragEvent_GetMimeTypes(void * argDragEvent, char *** argMimeTypes, int * argMimeTypesSize) {
+  Dali::DragAndDrop::DragEvent *dragEvent = (Dali::DragAndDrop::DragEvent *)argDragEvent;
+
+  if (!dragEvent) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, nullExceptMsg, 0);
+    return false;
+  }
+  {
+    try {
+      *argMimeTypes = (char**)((Dali::DragAndDrop::DragEvent &)*dragEvent).GetMimeTypes();
+      *argMimeTypesSize = ((Dali::DragAndDrop::DragEvent &)*dragEvent).GetMimeTypesSize();
+    }
+    CALL_CATCH_EXCEPTION(0);
+  }
+  return true;
+}
+
 SWIGEXPORT char * SWIGSTDCALL CSharp_Dali_DragEvent_GetData(void * argDragEvent) {
   char * jresult = nullptr;
   Dali::DragAndDrop::DragEvent *dragEvent = (Dali::DragAndDrop::DragEvent *)argDragEvent;