Bind new WindowData 65/290165/9
authorDaekwang Ryu <dkdk.ryu@samsung.com>
Fri, 31 Mar 2023 02:41:05 +0000 (11:41 +0900)
committerDaekwang Ryu <dkdk.ryu@samsung.com>
Wed, 7 Jun 2023 04:37:56 +0000 (13:37 +0900)
Change-Id: I8d2ee15e55b6cc0c45bf9330d9867cfc9c412a62

dali-csharp-binder/file.list
dali-csharp-binder/src/application-wrap.cpp
dali-csharp-binder/src/window-data-wrap.cpp [new file with mode: 0644]

index 0ef04cceb4c8efcfafed81771b017389622677e8..5b1cf2549aee80ac53f687bbb1ea48a4404de63a 100755 (executable)
@@ -68,6 +68,7 @@ SET( dali_csharp_binder_common_src_files
   ${dali_csharp_binder_dir}/src/drag-and-drop-wrap.cpp
   ${dali_csharp_binder_dir}/src/font-client-wrap.cpp
   ${dali_csharp_binder_dir}/src/slim-custom-view-impl.cpp
+  ${dali_csharp_binder_dir}/src/window-data-wrap.cpp
 )
 
 # added for key grab binding only for tizen
index 31e99364c9159f418f902e2d05ffd06f16b5086b..2543f72e4a188b948124859ad20268244c0f12de 100644 (file)
@@ -1722,6 +1722,70 @@ SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_Application_New_WithWindowSizePosition(
   return jresult;
 }
 
+SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_Application_New_WithWindowData(int nuiArgc, char* nuiArgv, char* nuiStyleSheet, bool nuiUIThread, void* nuiWindowData)
+{
+  void*             jresult;
+  int*              argc = nullptr;
+  char***           argv = nullptr;
+  Dali::WindowData* pWindowData;
+  Dali::Application result;
+
+  {
+    // TODO : What should we do if already generated argv exist?
+    ReleaseArgVMemory();
+    // generate argv data from the C# args
+    int   index  = 0;
+    int   length = 0;
+    char* retPtr = NULL;
+    char* nextPtr;
+
+    gArgV = new char*[nuiArgc + 1];
+
+    for(retPtr = strtok_r(nuiArgv, " ", &nextPtr);
+        retPtr != NULL && index < nuiArgc;
+        retPtr = strtok_r(NULL, " ", &nextPtr))
+    {
+      length       = 0;
+      length       = strlen(retPtr);
+      gArgV[index] = new char[length + 1];
+      strncpy(gArgV[index], retPtr, length);
+      gArgV[index][length] = '\0';
+      index++;
+    }
+
+    while(index < nuiArgc)
+    {
+      // if nuiArgc - index >1, maybe cause error.
+      gArgV[index] = NULL;
+      index++;
+    }
+
+    gArgV[nuiArgc] = NULL;
+    gArgC          = nuiArgc;
+
+    argc = &gArgC;
+    argv = &gArgV;
+  }
+
+  std::string styleSheet(nuiStyleSheet);
+  pWindowData = (Dali::WindowData*)nuiWindowData;
+  if(!pWindowData)
+  {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::PositionSize", 0);
+    return 0;
+  }
+
+  {
+    try
+    {
+      result = Dali::Application::New(argc, argv, styleSheet, nuiUIThread, *pWindowData);
+    }
+    CALL_CATCH_EXCEPTION(0);
+  }
+  jresult = new Dali::Application((const Dali::Application&)result);
+  return jresult;
+}
+
 SWIGEXPORT int32_t SWIGSTDCALL CSharp_Dali_Application_GetRenderThreadId(void* jarg1)
 {
   Dali::Application* arg1 = (Dali::Application*)jarg1;
diff --git a/dali-csharp-binder/src/window-data-wrap.cpp b/dali-csharp-binder/src/window-data-wrap.cpp
new file mode 100644 (file)
index 0000000..09bb0b4
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/public-api/adaptor-framework/window-data.h>
+
+#include "common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_new_WindowData()
+{
+  void*             nuiResult;
+  Dali::WindowData* result = 0;
+
+  {
+    try
+    {
+      result = (Dali::WindowData*)new Dali::WindowData();
+    }
+    CALL_CATCH_EXCEPTION(0);
+  }
+
+  nuiResult = (void*)result;
+  return nuiResult;
+}
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_WindowData(void* nuiWindowData)
+{
+  Dali::WindowData* handle = (Dali::WindowData*)0;
+
+  handle = (Dali::WindowData*)nuiWindowData;
+  {
+    try
+    {
+      delete handle;
+    }
+    CALL_CATCH_EXCEPTION();
+  }
+}
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_WindowData_SetPositionSize(void* nuiWindowData, void* nuiPositionSize)
+{
+  Dali::WindowData* pWindowData;
+  Dali::Rect<int>*  rect = 0;
+
+  pWindowData = (Dali::WindowData*)nuiWindowData;
+  if(!pWindowData)
+  {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::WindowData", 0);
+    return;
+  }
+
+  rect = (Dali::Rect<int>*)nuiPositionSize;
+  if(!rect)
+  {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::Rect< int > const & type is null", 0);
+    return;
+  }
+  {
+    try
+    {
+      pWindowData->SetPositionSize(*rect);
+    }
+    CALL_CATCH_EXCEPTION();
+  }
+}
+
+SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_WindowData_GetPositionSize(void* nuiWindowData)
+{
+  void*             nuiResult;
+  Dali::WindowData* pWindowData;
+  Dali::Rect<int>   result;
+
+  pWindowData = (Dali::WindowData*)nuiWindowData;
+  if(!pWindowData)
+  {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::WindowData", 0);
+    return nullptr;
+  }
+
+  {
+    try
+    {
+      result = pWindowData->GetPositionSize();
+    }
+    CALL_CATCH_EXCEPTION(0);
+  }
+
+  nuiResult = new Dali::Rect<int>((const Dali::Rect<int>&)result);
+  return nuiResult;
+}
+
+// --
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_WindowData_SetWindowType(void* nuiWindowData, int nuiWindowType)
+{
+  Dali::WindowData* pWindowData;
+  Dali::WindowType  windowType;
+
+  pWindowData = (Dali::WindowData*)nuiWindowData;
+  if(!pWindowData)
+  {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::WindowData", 0);
+    return;
+  }
+
+  windowType = (Dali::WindowType)nuiWindowType;
+  {
+    try
+    {
+      pWindowData->SetWindowType(windowType);
+    }
+    CALL_CATCH_EXCEPTION();
+  }
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Dali_WindowData_GetWindowType(void* nuiWindowData)
+{
+  int               nuiResult;
+  Dali::WindowData* pWindowData;
+  Dali::WindowType  result;
+
+  pWindowData = (Dali::WindowData*)nuiWindowData;
+  if(!pWindowData)
+  {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::WindowData", 0);
+    return 0;
+  }
+
+  {
+    try
+    {
+      result = (Dali::WindowType)pWindowData->GetWindowType();
+    }
+    CALL_CATCH_EXCEPTION(0);
+  }
+
+  nuiResult = (int)result;
+  return nuiResult;
+}
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_WindowData_SetTransparency(void* nuiWindowData, bool nuiTransparency)
+{
+  Dali::WindowData* pWindowData;
+
+  pWindowData = (Dali::WindowData*)nuiWindowData;
+  if(!pWindowData)
+  {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::WindowData", 0);
+    return;
+  }
+
+  {
+    try
+    {
+      pWindowData->SetTransparency(nuiTransparency);
+    }
+    CALL_CATCH_EXCEPTION();
+  }
+}
+
+SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_WindowData_GetTransparency(void* nuiWindowData)
+{
+  Dali::WindowData* pWindowData;
+  bool              result;
+
+  pWindowData = (Dali::WindowData*)nuiWindowData;
+  if(!pWindowData)
+  {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::WindowData", 0);
+    return 0;
+  }
+
+  {
+    try
+    {
+      result = (bool)pWindowData->GetTransparency();
+    }
+    CALL_CATCH_EXCEPTION(0);
+  }
+
+  return result;
+}
+
+#ifdef __cplusplus
+}
+#endif