X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali-toolkit%2Fdevel-api%2Fcontrols%2Fcontrol-wrapper-impl.cpp;h=78e442866bfc2557d3b27597dce791978252eea4;hb=HEAD;hp=48019feb90754799b3f81750b83f406c812765bb;hpb=9f77c9e72e5601d52ad3da117b5679311c016028;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/devel-api/controls/control-wrapper-impl.cpp b/dali-toolkit/devel-api/controls/control-wrapper-impl.cpp old mode 100755 new mode 100644 index 48019fe..78e4428 --- a/dali-toolkit/devel-api/controls/control-wrapper-impl.cpp +++ b/dali-toolkit/devel-api/controls/control-wrapper-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * 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. @@ -18,42 +18,73 @@ // CLASS HEADER #include -// INTERNAL INCLUDES +// EXTERNAL INCLUDES +#include +#include #include -#include +#include +#include + +// INTERNAL INCLUDES +#include #include -#include #include +#include +#include namespace Dali { - namespace Toolkit { - namespace Internal { +namespace +{ +BaseHandle Create() +{ + // empty handle as we cannot create control wrapper + return BaseHandle(); +} + +// Setup type-registry. +DALI_TYPE_REGISTRATION_BEGIN(Toolkit::ControlWrapper, Toolkit::Control, Create) +DALI_TYPE_REGISTRATION_END() + +} // namespace /* * Implementation. */ -Dali::Toolkit::ControlWrapper ControlWrapper::New( ControlWrapper* controlWrapper ) +Dali::Toolkit::ControlWrapper ControlWrapper::New(const std::string& typeName, ControlWrapper* controlWrapper) { - ControlWrapperPtr wrapper( controlWrapper ); + ControlWrapperPtr wrapper(controlWrapper); // Pass ownership to CustomActor via derived handle. - Dali::Toolkit::ControlWrapper handle( *wrapper ); + Dali::Toolkit::ControlWrapper handle(*wrapper); // Second-phase initialisation of the implementation. // This can only be done after the CustomActor connection has been made. wrapper->Initialize(); + // Different types of C# custom view registered themselves using type registry, + // but their type names are registered per type not per instance, so they still + // have the same wrong type name in native side when type registry queries the + // unique type name of each instance using typeid() because of the binding. + // Therefore, we have to link each instance with its correct type info if already + // pre-registered. + + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo(typeName); + if(typeInfo) + { + Dali::DevelHandle::SetTypeInfo(handle, typeInfo); + } + return handle; } -ControlWrapper::ControlWrapper( CustomControlBehaviour behaviourFlags ) -: Control( static_cast< ControlBehaviour >( behaviourFlags ) ) +ControlWrapper::ControlWrapper(CustomControlBehaviour behaviourFlags) +: Control(static_cast(behaviourFlags | DISABLE_STYLE_CHANGE_SIGNALS)) { } @@ -66,59 +97,69 @@ void ControlWrapper::RelayoutRequest() CustomActorImpl::RelayoutRequest(); } -float ControlWrapper::GetHeightForWidthBase( float width ) +float ControlWrapper::GetHeightForWidthBase(float width) +{ + return CustomActorImpl::GetHeightForWidthBase(width); +} + +float ControlWrapper::GetWidthForHeightBase(float height) { - return CustomActorImpl::GetHeightForWidthBase( width ); + return CustomActorImpl::GetWidthForHeightBase(height); } -float ControlWrapper::GetWidthForHeightBase( float height ) +float ControlWrapper::CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension) { - return CustomActorImpl::GetWidthForHeightBase( height ); + return CustomActorImpl::CalculateChildSizeBase(child, dimension); } -float ControlWrapper::CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension ) +bool ControlWrapper::RelayoutDependentOnChildrenBase(Dimension::Type dimension) { - return CustomActorImpl::CalculateChildSizeBase( child, dimension ); + return CustomActorImpl::RelayoutDependentOnChildrenBase(dimension); } -bool ControlWrapper::RelayoutDependentOnChildrenBase( Dimension::Type dimension ) +void ControlWrapper::RegisterVisual(Property::Index index, Toolkit::Visual::Base& visual) { - return CustomActorImpl::RelayoutDependentOnChildrenBase( dimension ); + DevelControl::RegisterVisual(*this, index, visual); } -void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual ) +void ControlWrapper::RegisterVisual(Property::Index index, Toolkit::Visual::Base& visual, int depthIndex) { - Control::RegisterVisual( index, visual ); + DevelControl::RegisterVisual(*this, index, visual, depthIndex); } -void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled ) +void ControlWrapper::RegisterVisual(Property::Index index, Toolkit::Visual::Base& visual, bool enabled) { - Control::RegisterVisual( index, visual, enabled ); + DevelControl::RegisterVisual(*this, index, visual, enabled); } -void ControlWrapper::UnregisterVisual( Property::Index index ) +void ControlWrapper::RegisterVisual(Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex) { - Control::UnregisterVisual( index ); + DevelControl::RegisterVisual(*this, index, visual, enabled, depthIndex); } -Toolkit::Visual::Base ControlWrapper::GetVisual( Property::Index index ) const +void ControlWrapper::UnregisterVisual(Property::Index index) { - return Control::GetVisual( index ); + DevelControl::UnregisterVisual(*this, index); } -void ControlWrapper::EnableVisual( Property::Index index, bool enable ) +Toolkit::Visual::Base ControlWrapper::GetVisual(Property::Index index) const { - Control::EnableVisual( index, enable ); + return DevelControl::GetVisual(*this, index); } -bool ControlWrapper::IsVisualEnabled( Property::Index index ) const +void ControlWrapper::EnableVisual(Property::Index index, bool enable) { - return Control::IsVisualEnabled( index ); + DevelControl::EnableVisual(*this, index, enable); } -Dali::Animation ControlWrapper::CreateTransition( const Toolkit::TransitionData& handle ) +bool ControlWrapper::IsVisualEnabled(Property::Index index) const { - return Control::CreateTransition( handle ); + return DevelControl::IsVisualEnabled(*this, index); +} + +Dali::Animation ControlWrapper::CreateTransition(const Toolkit::TransitionData& handle) +{ + return DevelControl::CreateTransition(*this, handle); } void ControlWrapper::ApplyThemeStyle() @@ -126,15 +167,25 @@ void ControlWrapper::ApplyThemeStyle() Toolkit::StyleManager styleManager = StyleManager::Get(); // if style manager is available - if( styleManager ) + if(styleManager) { - StyleManager& styleManagerImpl = GetImpl( styleManager ); + StyleManager& styleManagerImpl = GetImpl(styleManager); // Apply the current style - styleManagerImpl.ApplyThemeStyle( Toolkit::Control( GetOwner() ) ); + styleManagerImpl.ApplyThemeStyle(Toolkit::Control(GetOwner())); } } +Dali::TypeInfo ControlWrapper::GetTypeInfo() +{ + return DevelCustomActor::GetTypeInfo(Self()); +} + +void ControlWrapper::EmitKeyInputFocusSignal(bool focusGained) +{ + Control::EmitKeyInputFocusSignal(focusGained); +} + } // namespace Internal } // namespace Toolkit