X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fcontrol%2Fcontrol-data-impl.cpp;h=0a19706973a5c48d2e39348eece6a661883490b5;hb=d3a278fc71c792d900071194e50d7235caff0811;hp=4c747047df1f9cb19daea3ba8666378a6a3e0c21;hpb=6da98d4f526029d51c8404964dd954afe9752401;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/control/control-data-impl.cpp b/dali-toolkit/internal/controls/control/control-data-impl.cpp index 4c74704..0a19706 100644 --- a/dali-toolkit/internal/controls/control/control-data-impl.cpp +++ b/dali-toolkit/internal/controls/control/control-data-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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. @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -51,12 +52,12 @@ namespace { -const std::string READING_INFO_TYPE_NAME = "name"; -const std::string READING_INFO_TYPE_ROLE = "role"; -const std::string READING_INFO_TYPE_DESCRIPTION = "description"; -const std::string READING_INFO_TYPE_STATE = "state"; -const std::string READING_INFO_TYPE_ATTRIBUTE_NAME = "reading_info_type"; -const std::string READING_INFO_TYPE_SEPARATOR = "|"; +const char* READING_INFO_TYPE_NAME = "name"; +const char* READING_INFO_TYPE_ROLE = "role"; +const char* READING_INFO_TYPE_DESCRIPTION = "description"; +const char* READING_INFO_TYPE_STATE = "state"; +const char* READING_INFO_TYPE_ATTRIBUTE_NAME = "reading_info_type"; +const char* READING_INFO_TYPE_SEPARATOR = "|"; } // namespace namespace Dali @@ -128,6 +129,38 @@ bool FindVisual(std::string visualName, const RegisteredVisualContainer& visuals return false; } +/** + * Finds visual in given array, returning true if found along with the iterator for that visual as a out parameter + */ +bool FindVisual(const Toolkit::Visual::Base findVisual, const RegisteredVisualContainer& visuals, RegisteredVisualContainer::Iterator& iter) +{ + for(iter = visuals.Begin(); iter != visuals.End(); iter++) + { + Toolkit::Visual::Base visual = (*iter)->visual; + if(visual && visual == findVisual) + { + return true; + } + } + return false; +} + +/** + * Finds internal visual in given array, returning true if found along with the iterator for that visual as a out parameter + */ +bool FindVisual(const Visual::Base& findInternalVisual, const RegisteredVisualContainer& visuals, RegisteredVisualContainer::Iterator& iter) +{ + for(iter = visuals.Begin(); iter != visuals.End(); iter++) + { + Visual::Base& visual = Toolkit::GetImplementation((*iter)->visual); + if((&visual == &findInternalVisual)) + { + return true; + } + } + return false; +} + void FindChangableVisuals(Dictionary& stateVisualsToAdd, Dictionary& stateVisualsToChange, DictionaryKeys& stateVisualsToRemove) @@ -580,11 +613,11 @@ void Control::Impl::CheckHighlightedObjectGeometry() } case Dali::Accessibility::ScreenRelativeMoveType::INSIDE: { - if(rect.width < 0 && accessibleRect.x != lastPosition.x) + if(rect.width < 0 && !Dali::Equals(accessibleRect.x, lastPosition.x)) { mAccessibilityLastScreenRelativeMoveType = (accessibleRect.x < lastPosition.x) ? Dali::Accessibility::ScreenRelativeMoveType::OUTGOING_TOP_LEFT : Dali::Accessibility::ScreenRelativeMoveType::OUTGOING_BOTTOM_RIGHT; } - if(rect.height < 0 && accessibleRect.y != lastPosition.y) + if(rect.height < 0 && !Dali::Equals(accessibleRect.y, lastPosition.y)) { mAccessibilityLastScreenRelativeMoveType = (accessibleRect.y < lastPosition.y) ? Dali::Accessibility::ScreenRelativeMoveType::OUTGOING_TOP_LEFT : Dali::Accessibility::ScreenRelativeMoveType::OUTGOING_BOTTOM_RIGHT; } @@ -804,7 +837,7 @@ void Control::Impl::RegisterVisual(Property::Index index, Toolkit::Visual::Base& { visualImpl.SetOnScene(self); } - else if(visualImpl.IsResourceReady()) // When not being staged, check if visual already 'ResourceReady' before it was Registered. ( Resource may have been loaded already ) + else if(enabled && visualImpl.IsResourceReady()) // When not being staged, check if visual already 'ResourceReady' before it was Registered. ( Resource may have been loaded already ) { ResourceReady(visualImpl); } @@ -893,6 +926,23 @@ bool Control::Impl::IsVisualEnabled(Property::Index index) const return false; } +void Control::Impl::EnableReadyTransitionOverriden(Toolkit::Visual::Base& visual, bool enable) +{ + DALI_LOG_INFO(gLogFilter, Debug::General, "Control::EnableReadyTransitionOverriden(%p, %s)\n", visual, enable ? "T" : "F"); + + RegisteredVisualContainer::Iterator iter; + if(FindVisual(visual, mVisuals, iter)) + { + if((*iter)->overideReadyTransition == enable) + { + DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Control::EnableReadyTransitionOverriden Visual %s(%p) already %s\n", (*iter)->visual.GetName().c_str(), visual, enable ? "enabled" : "disabled"); + return; + } + + (*iter)->overideReadyTransition = enable; + } +} + void Control::Impl::StopObservingVisual(Toolkit::Visual::Base& visual) { Internal::Visual::Base& visualImpl = Toolkit::GetImplementation(visual); @@ -909,6 +959,17 @@ void Control::Impl::StartObservingVisual(Toolkit::Visual::Base& visual) visualImpl.AddEventObserver(*this); } +void Control::Impl::ResourceReady() +{ + // Emit signal if all enabled visuals registered by the control are ready or there are no visuals. + if(IsResourceReady()) + { + // Reset the flag + mNeedToEmitResourceReady = false; + EmitResourceReadySignal(); + } +} + // Called by a Visual when it's resource is ready void Control::Impl::ResourceReady(Visual::Base& object) { @@ -916,41 +977,36 @@ void Control::Impl::ResourceReady(Visual::Base& object) Actor self = mControlImpl.Self(); + RegisteredVisualContainer::Iterator registeredIter; + // A resource is ready, find resource in the registered visuals container and get its index - for(auto registeredIter = mVisuals.Begin(), end = mVisuals.End(); registeredIter != end; ++registeredIter) + if(!FindVisual(object, mVisuals, registeredIter)) { - Internal::Visual::Base& registeredVisualImpl = Toolkit::GetImplementation((*registeredIter)->visual); + return; + } - if(&object == ®isteredVisualImpl) + RegisteredVisualContainer::Iterator visualToRemoveIter; + // Find visual with the same index in the removal container + // Set if off stage as it's replacement is now ready. + // Remove if from removal list as now removed from stage. + // Set Pending flag on the ready visual to false as now ready. + if(FindVisual((*registeredIter)->index, mRemoveVisuals, visualToRemoveIter)) + { + (*registeredIter)->pending = false; + if(!((*visualToRemoveIter)->overideReadyTransition)) { - RegisteredVisualContainer::Iterator visualToRemoveIter; - // Find visual with the same index in the removal container - // Set if off stage as it's replacement is now ready. - // Remove if from removal list as now removed from stage. - // Set Pending flag on the ready visual to false as now ready. - if(FindVisual((*registeredIter)->index, mRemoveVisuals, visualToRemoveIter)) - { - (*registeredIter)->pending = false; - Toolkit::GetImplementation((*visualToRemoveIter)->visual).SetOffScene(self); - mRemoveVisuals.Erase(visualToRemoveIter); - } - break; + Toolkit::GetImplementation((*visualToRemoveIter)->visual).SetOffScene(self); } + mRemoveVisuals.Erase(visualToRemoveIter); } // A visual is ready so control may need relayouting if staged - if(self.GetProperty(Actor::Property::CONNECTED_TO_SCENE)) - { - mControlImpl.RelayoutRequest(); - } + RelayoutRequest(object); - // Emit signal if all enabled visuals registered by the control are ready. - if(IsResourceReady()) + // Called by a Visual when it's resource is ready + if(((*registeredIter)->enabled)) { - // Reset the flag - mNeedToEmitResourceReady = false; - - EmitResourceReadySignal(); + ResourceReady(); } } @@ -970,7 +1026,10 @@ void Control::Impl::NotifyVisualEvent(Visual::Base& object, Property::Index sign void Control::Impl::RelayoutRequest(Visual::Base& object) { - mControlImpl.RelayoutRequest(); + if(mControlImpl.Self().GetProperty(Actor::Property::CONNECTED_TO_SCENE)) + { + mControlImpl.RelayoutRequest(); + } } bool Control::Impl::IsResourceReady() const