GetLineBoundingRectangle wrapper 15/282415/13
authorsarajammal <s.al-jammal@partner.samsung.com>
Mon, 3 Oct 2022 08:40:03 +0000 (11:40 +0300)
committersarajammal <s.al-jammal@partner.samsung.com>
Thu, 8 Dec 2022 14:03:50 +0000 (17:03 +0300)
Wrapper API for GetLineBoundingRectangle in TextGeometry, that calculates the:
- X, Y positions
- Width and Height

Those are returned in a Rect<float>

The patch depends on:
https://review.tizen.org/gerrit/c/platform/core/uifw/dali-toolkit/+/282292

Change-Id: Idf0dc97cb4100211d9dc149eade483fbd0f01080

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

index 1eb6134..1ac04e0 100755 (executable)
@@ -40,6 +40,7 @@ SET( dali_csharp_binder_common_src_files
   ${dali_csharp_binder_dir}/src/animation-wrap.cpp
   ${dali_csharp_binder_dir}/src/adaptor-wrap.cpp
   ${dali_csharp_binder_dir}/src/extents-wrap.cpp
+  ${dali_csharp_binder_dir}/src/text-geometry-wrap.cpp
   ${dali_csharp_binder_dir}/src/text-label-wrap.cpp
   ${dali_csharp_binder_dir}/src/text-utils-wrap.cpp
   ${dali_csharp_binder_dir}/src/capabilities-wrap.cpp
diff --git a/dali-csharp-binder/src/text-geometry-wrap.cpp b/dali-csharp-binder/src/text-geometry-wrap.cpp
new file mode 100644 (file)
index 0000000..7d70c13
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2021 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/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-field.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-field-devel.h>
+#include <dali-toolkit/devel-api/text/text-geometry-devel.h>
+
+// INTERNAL INCLUDES
+#include "common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_TextGeometry_TextLabel_GetLineBoundingRectangle(void * pTextLabel, uint32_t lineIndex)
+{
+  Dali::Toolkit::TextLabel *textLabel = (Dali::Toolkit::TextLabel *) 0;
+  void* resultRect;
+
+  textLabel = (Dali::Toolkit::TextLabel *)pTextLabel;
+  {
+    try {
+      resultRect = new Dali::Rect<float>
+      ((const Dali::Rect<float> &)(Dali::Toolkit::Text::TextGeometry::GetLineBoundingRectangle( *textLabel, lineIndex)));
+    }
+    CALL_CATCH_EXCEPTION(0);
+  }
+
+  return resultRect;
+}
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_TextGeometry_TextField_GetLineBoundingRectangle(void * pTextField, uint32_t lineIndex)
+{
+  Dali::Toolkit::TextField *textField = (Dali::Toolkit::TextField *) 0;
+  void* resultRect;
+
+  textField = (Dali::Toolkit::TextField *)pTextField;
+  {
+    try {
+      resultRect = new Dali::Rect<float>
+      ((const Dali::Rect<float> &)(Dali::Toolkit::Text::TextGeometry::GetLineBoundingRectangle( *textField, lineIndex)));
+    }
+    CALL_CATCH_EXCEPTION(0);
+  }
+
+  return resultRect;
+}
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_TextGeometry_TextEditor_GetLineBoundingRectangle(void * pTextEditor, uint32_t lineIndex)
+{
+  Dali::Toolkit::TextEditor *textEditor = (Dali::Toolkit::TextEditor *) 0;
+  void* resultRect;
+
+  textEditor = (Dali::Toolkit::TextEditor *)pTextEditor;
+  {
+    try {
+      resultRect = new Dali::Rect<float>
+      ((const Dali::Rect<float> &)(Dali::Toolkit::Text::TextGeometry::GetLineBoundingRectangle( *textEditor, lineIndex)));
+    }
+    CALL_CATCH_EXCEPTION(0);
+  }
+
+  return resultRect;
+}
+
+#ifdef __cplusplus
+}
+#endif
+