From: sarajammal Date: Mon, 3 Oct 2022 08:40:03 +0000 (+0300) Subject: GetLineBoundingRectangle wrapper X-Git-Tag: dali_2.2.9~8^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e294310784bc1aa6d2019d2e032f76d427631c7;p=platform%2Fcore%2Fuifw%2Fdali-csharp-binder.git GetLineBoundingRectangle wrapper Wrapper API for GetLineBoundingRectangle in TextGeometry, that calculates the: - X, Y positions - Width and Height Those are returned in a Rect The patch depends on: https://review.tizen.org/gerrit/c/platform/core/uifw/dali-toolkit/+/282292 Change-Id: Idf0dc97cb4100211d9dc149eade483fbd0f01080 --- diff --git a/dali-csharp-binder/file.list b/dali-csharp-binder/file.list index 1eb61342..1ac04e07 100755 --- a/dali-csharp-binder/file.list +++ b/dali-csharp-binder/file.list @@ -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 index 00000000..7d70c138 --- /dev/null +++ b/dali-csharp-binder/src/text-geometry-wrap.cpp @@ -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 +#include +#include +#include +#include +#include +#include + +// 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 + ((const Dali::Rect &)(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 + ((const Dali::Rect &)(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 + ((const Dali::Rect &)(Dali::Toolkit::Text::TextGeometry::GetLineBoundingRectangle( *textEditor, lineIndex))); + } + CALL_CATCH_EXCEPTION(0); + } + + return resultRect; +} + +#ifdef __cplusplus +} +#endif +