[NUI] Spannable Module: Wrap SetSpannedText API 29/285029/3
authorssabah <s.sabah@samsung.com>
Sun, 4 Dec 2022 20:58:17 +0000 (23:58 +0300)
committershrouq Sabah <s.sabah@samsung.com>
Sun, 18 Dec 2022 20:19:57 +0000 (20:19 +0000)
Wrap SetSpannedText API for:
  - TextLabel
  - TextField
  - TextEditor

Change-Id: I6368bb88a63cd54e9b6263f8c3f645bc2146a1a3

dali-csharp-binder/file.list
dali-csharp-binder/src/text-spannable-api-wrap.cpp [new file with mode: 0644]

index ba36913..1d65078 100755 (executable)
@@ -47,6 +47,7 @@ SET( dali_csharp_binder_common_src_files
   ${dali_csharp_binder_dir}/src/text-spanned-wrap.cpp
   ${dali_csharp_binder_dir}/src/text-spannable-wrap.cpp
   ${dali_csharp_binder_dir}/src/text-spannable-string-wrap.cpp
+  ${dali_csharp_binder_dir}/src/text-spannable-api-wrap.cpp
   ${dali_csharp_binder_dir}/src/text-utils-wrap.cpp
   ${dali_csharp_binder_dir}/src/capabilities-wrap.cpp
   ${dali_csharp_binder_dir}/src/capture-wrap.cpp
diff --git a/dali-csharp-binder/src/text-spannable-api-wrap.cpp b/dali-csharp-binder/src/text-spannable-api-wrap.cpp
new file mode 100644 (file)
index 0000000..91d90f9
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2022 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-spannable.h>
+#include <dali/dali.h>
+
+// INTERNAL INCLUDES
+#include "common.h"
+
+/* Callback for returning strings to C# without leaking memory */
+typedef char *(SWIGSTDCALL *SWIG_CSharpStringHelperCallback)(const char *);
+extern SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+using namespace Dali::Toolkit::Text;
+
+SWIGEXPORT void SWIGSTDCALL
+CSharp_Dali_TextLabel_SetSpannedText(void *refTextLabel, void *refSpanned) {
+
+  Dali::Toolkit::TextLabel *textLabelPtr = (Dali::Toolkit::TextLabel *)0;
+  textLabelPtr = (Dali::Toolkit::TextLabel *)refTextLabel;
+  if (!textLabelPtr) {
+    SWIG_CSharpSetPendingExceptionArgument(
+        SWIG_CSharpArgumentNullException,
+        "Attempt to dereference null TextLabel", 0);
+    return;
+  }
+
+  Spanned *spannedPtr = (Spanned *)0;
+  spannedPtr = (Spanned *)refSpanned;
+  if (!spannedPtr) {
+    SWIG_CSharpSetPendingExceptionArgument(
+        SWIG_CSharpArgumentNullException, "Attempt to dereference null Spanned",
+        0);
+    return;
+  }
+
+  {
+    try {
+      SetSpannedText(*textLabelPtr, *spannedPtr);
+    }
+    CALL_CATCH_EXCEPTION();
+  }
+}
+
+SWIGEXPORT void SWIGSTDCALL
+CSharp_Dali_TextField_SetSpannedText(void *refTextField, void *refSpanned) {
+
+  Dali::Toolkit::TextField *textFieldPtr = (Dali::Toolkit::TextField *)0;
+  textFieldPtr = (Dali::Toolkit::TextField *)refTextField;
+  if (!textFieldPtr) {
+    SWIG_CSharpSetPendingExceptionArgument(
+        SWIG_CSharpArgumentNullException,
+        "Attempt to dereference null TextField", 0);
+    return;
+  }
+
+  Spanned *spannedPtr = (Spanned *)0;
+  spannedPtr = (Spanned *)refSpanned;
+  if (!spannedPtr) {
+    SWIG_CSharpSetPendingExceptionArgument(
+        SWIG_CSharpArgumentNullException, "Attempt to dereference null Spanned",
+        0);
+    return;
+  }
+
+  {
+    try {
+      SetSpannedText(*textFieldPtr, *spannedPtr);
+    }
+    CALL_CATCH_EXCEPTION();
+  }
+}
+
+SWIGEXPORT void SWIGSTDCALL
+CSharp_Dali_TextEditor_SetSpannedText(void *refTextEditor, void *refSpanned) {
+
+  Dali::Toolkit::TextEditor *textEditorPtr = (Dali::Toolkit::TextEditor *)0;
+  textEditorPtr = (Dali::Toolkit::TextEditor *)refTextEditor;
+  if (!textEditorPtr) {
+    SWIG_CSharpSetPendingExceptionArgument(
+        SWIG_CSharpArgumentNullException,
+        "Attempt to dereference null TextEditor", 0);
+    return;
+  }
+
+  Spanned *spannedPtr = (Spanned *)0;
+  spannedPtr = (Spanned *)refSpanned;
+  if (!spannedPtr) {
+    SWIG_CSharpSetPendingExceptionArgument(
+        SWIG_CSharpArgumentNullException, "Attempt to dereference null Spanned",
+        0);
+    return;
+  }
+
+  {
+    try {
+      SetSpannedText(*textEditorPtr, *spannedPtr);
+    }
+    CALL_CATCH_EXCEPTION();
+  }
+}
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file