From c9ebd5427b3483a1edd25a0a3c7f73dfcc22eb98 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Fri, 1 Nov 2024 18:47:49 +0900 Subject: [PATCH] Bind GetPropertyObject for VisualObject Change-Id: Ib818a04bcbf5deac951fd8bd047547a7ea642c12 Signed-off-by: Eunki, Hong --- .../visual-objects/visual-object-impl.cpp | 11 ++++++++++ .../visual-objects/visual-object-impl.h | 5 +++++ .../common/visual-objects/visual-object.cpp | 21 +++++++++++++++++++ .../common/visual-objects/visual-object.h | 11 ++++++++++ 4 files changed, 48 insertions(+) diff --git a/dali-csharp-binder/common/visual-objects/visual-object-impl.cpp b/dali-csharp-binder/common/visual-objects/visual-object-impl.cpp index 8f54d61c..7cd347b3 100644 --- a/dali-csharp-binder/common/visual-objects/visual-object-impl.cpp +++ b/dali-csharp-binder/common/visual-objects/visual-object-impl.cpp @@ -194,6 +194,17 @@ void VisualObject::LowerBelow(Dali::Internal::VisualObject& target) } } +Dali::Property VisualObject::GetPropertyObject(Dali::Property::Key visualPropertyKey) +{ + if(mVisual) + { + return mVisual.GetPropertyObject(std::move(visualPropertyKey)); + } + + Handle handle; + return Dali::Property(handle, Property::INVALID_INDEX); +} + // Private and internal void VisualObject::AttachToContainerInternal(Dali::VisualObjectsContainer container) diff --git a/dali-csharp-binder/common/visual-objects/visual-object-impl.h b/dali-csharp-binder/common/visual-objects/visual-object-impl.h index 954cdb1e..ac14d708 100644 --- a/dali-csharp-binder/common/visual-objects/visual-object-impl.h +++ b/dali-csharp-binder/common/visual-objects/visual-object-impl.h @@ -120,6 +120,11 @@ public: ///< Public API */ void LowerBelow(Dali::Internal::VisualObject& target); + /** + * @copydoc Dali::VisualObject::GetPropertyObject() + */ + Dali::Property GetPropertyObject(Dali::Property::Key visualPropertyKey); + public: ///< Called from Internal::VisualObjectsContainer /** * @brief Set the container who contain this visual object. diff --git a/dali-csharp-binder/common/visual-objects/visual-object.cpp b/dali-csharp-binder/common/visual-objects/visual-object.cpp index 60d3c9c6..56b2a2fd 100644 --- a/dali-csharp-binder/common/visual-objects/visual-object.cpp +++ b/dali-csharp-binder/common/visual-objects/visual-object.cpp @@ -108,6 +108,11 @@ void VisualObject::LowerBelow(Dali::VisualObject target) GetImplementation(*this).LowerBelow(GetImplementation(target)); } +Dali::Property VisualObject::GetPropertyObject(Dali::Property::Key visualPropertyKey) +{ + return GetImplementation(*this).GetPropertyObject(std::move(visualPropertyKey)); +} + } // namespace Dali #ifdef __cplusplus @@ -352,6 +357,22 @@ SWIGEXPORT void SWIGSTDCALL CSharp_Dali_VisualObject_LowerBelow(void* nuiVisualO })); } +SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_VisualObject_GetPropertyObject(void* nuiVisualObject, int visualPropertyIndex) +{ + Dali::VisualObject* visualObject = (Dali::VisualObject*)0; + + GUARD_ON_NULL_RET0(nuiVisualObject); + visualObject = (Dali::VisualObject*)nuiVisualObject; + + void* result = 0; + try_catch(([&]() { + Dali::Property property = visualObject->GetPropertyObject((Dali::Property::Index)visualPropertyIndex); + result = new Dali::Property(property.object, property.propertyIndex, property.componentIndex); + })); + + return result; +} + #ifdef __cplusplus } #endif \ No newline at end of file diff --git a/dali-csharp-binder/common/visual-objects/visual-object.h b/dali-csharp-binder/common/visual-objects/visual-object.h index a06c98d6..32ac1cbf 100644 --- a/dali-csharp-binder/common/visual-objects/visual-object.h +++ b/dali-csharp-binder/common/visual-objects/visual-object.h @@ -207,6 +207,17 @@ public: ///< Public API */ void LowerBelow(VisualObject target); + /** + * @brief Retrieve the property object associated with the given visual property key. + * It will return invalid property if visual object is not be attached to any control. + * @note Returned Property will be invalidated after we call CreateVisual method. + * + * @SINCE_2_3.50 + * @param[in] visualPropertyKey The key of the visual's property. + * @return The Property object + */ + Dali::Property GetPropertyObject(Dali::Property::Key visualPropertyKey); + public: VisualObject() = default; ~VisualObject() = default; -- 2.34.1