2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/public-api/controls/control-impl.h>
22 #include <dali/devel-api/actors/actor-devel.h>
23 #include <dali/devel-api/common/stage.h>
24 #include <dali/devel-api/scripting/scripting.h>
25 #include <dali/integration-api/debug.h>
26 #include <dali/public-api/animation/constraint.h>
27 #include <dali/public-api/math/math-utils.h>
28 #include <dali/public-api/object/type-info.h>
29 #include <dali/public-api/object/type-registry-helper.h>
30 #include <dali/public-api/size-negotiation/relayout-container.h>
31 #include <cstring> // for strcmp
37 #include <dali-toolkit/dali-toolkit.h>
38 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
39 #include <dali-toolkit/devel-api/controls/control-devel.h>
40 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
41 #include <dali-toolkit/devel-api/visuals/color-visual-properties-devel.h>
42 #include <dali-toolkit/devel-api/visuals/visual-actions-devel.h>
43 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
44 #include <dali-toolkit/internal/styling/style-manager-impl.h>
45 #include <dali-toolkit/internal/visuals/color/color-visual.h>
46 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
47 #include <dali-toolkit/public-api/align-enumerations.h>
48 #include <dali-toolkit/public-api/controls/control.h>
49 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
50 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
51 #include <dali-toolkit/public-api/styling/style-manager.h>
52 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
53 #include <dali-toolkit/public-api/visuals/visual-properties.h>
63 #if defined(DEBUG_ENABLED)
64 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_CONTROL_VISUALS");
68 * @brief Creates a clipping renderer if required.
69 * (EG. If no renders exist and clipping is enabled).
70 * @param[in] controlImpl The control implementation.
72 void CreateClippingRenderer(Control& controlImpl)
74 // We want to add a transparent background if we do not have one for clipping.
75 Actor self(controlImpl.Self());
76 int clippingMode = ClippingMode::DISABLED;
77 if(self.GetProperty(Actor::Property::CLIPPING_MODE).Get(clippingMode))
79 Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(controlImpl);
81 if(clippingMode == ClippingMode::CLIP_CHILDREN && controlDataImpl.mVisuals.Empty() && self.GetRendererCount() == 0u)
83 controlImpl.SetBackgroundColor(Color::TRANSPARENT);
88 } // unnamed namespace
90 Toolkit::Control Control::New()
92 return New(ControlBehaviour::CONTROL_BEHAVIOUR_DEFAULT);
95 Toolkit::Control Control::New(ControlBehaviour additionalBehaviour)
97 // Create the implementation, temporarily owned on stack
98 IntrusivePtr<Control> controlImpl = new Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehaviour));
100 // Pass ownership to handle
101 Toolkit::Control handle(*controlImpl);
103 // Second-phase init of the implementation
104 // This can only be done after the CustomActor connection has been made...
105 controlImpl->Initialize();
110 void Control::SetStyleName(const std::string& styleName)
112 if(styleName != mImpl->mStyleName)
114 mImpl->mStyleName = styleName;
116 // Apply new style, if stylemanager is available
117 Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
120 GetImpl(styleManager).ApplyThemeStyle(Toolkit::Control(GetOwner()));
125 const std::string& Control::GetStyleName() const
127 return mImpl->mStyleName;
130 void Control::SetBackgroundColor(const Vector4& color)
132 mImpl->mBackgroundColor = color;
135 map[Toolkit::Visual::Property::TYPE] = Toolkit::Visual::COLOR;
136 map[Toolkit::ColorVisual::Property::MIX_COLOR] = color;
138 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
139 if(visual && visual.GetType() == Toolkit::Visual::COLOR)
141 // Update background color only
142 mImpl->DoAction(Toolkit::Control::Property::BACKGROUND, DevelVisual::Action::UPDATE_PROPERTY, map);
149 void Control::SetBackground(const Property::Map& map)
151 Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual(map);
152 visual.SetName("background");
155 mImpl->RegisterVisual(Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND);
157 // Trigger a size negotiation request that may be needed by the new visual to relayout its contents.
162 void Control::ClearBackground()
164 mImpl->UnregisterVisual(Toolkit::Control::Property::BACKGROUND);
165 mImpl->mBackgroundColor = Color::TRANSPARENT;
167 // Trigger a size negotiation request that may be needed when unregistering a visual.
171 void Control::SetResourceReady()
173 Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(*this);
174 controlDataImpl.ResourceReady();
177 Toolkit::DevelControl::ControlAccessible* Control::GetAccessibleObject()
179 return mImpl->GetAccessibleObject();
182 void Control::EnableGestureDetection(GestureType::Value type)
184 if((type & GestureType::PINCH) && !mImpl->mPinchGestureDetector)
186 mImpl->mPinchGestureDetector = PinchGestureDetector::New();
187 mImpl->mPinchGestureDetector.DetectedSignal().Connect(mImpl, &Impl::PinchDetected);
188 mImpl->mPinchGestureDetector.Attach(Self());
191 if((type & GestureType::PAN) && !mImpl->mPanGestureDetector)
193 mImpl->mPanGestureDetector = PanGestureDetector::New();
194 mImpl->mPanGestureDetector.SetMaximumTouchesRequired(2);
195 mImpl->mPanGestureDetector.DetectedSignal().Connect(mImpl, &Impl::PanDetected);
196 mImpl->mPanGestureDetector.Attach(Self());
199 if((type & GestureType::TAP) && !mImpl->mTapGestureDetector)
201 mImpl->mTapGestureDetector = TapGestureDetector::New();
202 mImpl->mTapGestureDetector.DetectedSignal().Connect(mImpl, &Impl::TapDetected);
203 mImpl->mTapGestureDetector.Attach(Self());
206 if((type & GestureType::LONG_PRESS) && !mImpl->mLongPressGestureDetector)
208 mImpl->mLongPressGestureDetector = LongPressGestureDetector::New();
209 mImpl->mLongPressGestureDetector.DetectedSignal().Connect(mImpl, &Impl::LongPressDetected);
210 mImpl->mLongPressGestureDetector.Attach(Self());
214 void Control::DisableGestureDetection(GestureType::Value type)
216 if((type & GestureType::PINCH) && mImpl->mPinchGestureDetector)
218 mImpl->mPinchGestureDetector.Detach(Self());
219 mImpl->mPinchGestureDetector.Reset();
222 if((type & GestureType::PAN) && mImpl->mPanGestureDetector)
224 mImpl->mPanGestureDetector.Detach(Self());
225 mImpl->mPanGestureDetector.Reset();
228 if((type & GestureType::TAP) && mImpl->mTapGestureDetector)
230 mImpl->mTapGestureDetector.Detach(Self());
231 mImpl->mTapGestureDetector.Reset();
234 if((type & GestureType::LONG_PRESS) && mImpl->mLongPressGestureDetector)
236 mImpl->mLongPressGestureDetector.Detach(Self());
237 mImpl->mLongPressGestureDetector.Reset();
241 PinchGestureDetector Control::GetPinchGestureDetector() const
243 return mImpl->mPinchGestureDetector;
246 PanGestureDetector Control::GetPanGestureDetector() const
248 return mImpl->mPanGestureDetector;
251 TapGestureDetector Control::GetTapGestureDetector() const
253 return mImpl->mTapGestureDetector;
256 LongPressGestureDetector Control::GetLongPressGestureDetector() const
258 return mImpl->mLongPressGestureDetector;
261 void Control::SetKeyboardNavigationSupport(bool isSupported)
263 mImpl->mIsKeyboardNavigationSupported = isSupported;
266 bool Control::IsKeyboardNavigationSupported()
268 return mImpl->mIsKeyboardNavigationSupported;
271 void Control::SetKeyInputFocus()
273 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
275 Toolkit::KeyInputFocusManager::Get().SetFocus(Toolkit::Control::DownCast(Self()));
279 bool Control::HasKeyInputFocus()
282 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
284 Toolkit::Control control = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
285 if(Self() == control)
293 void Control::ClearKeyInputFocus()
295 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
297 Toolkit::KeyInputFocusManager::Get().RemoveFocus(Toolkit::Control::DownCast(Self()));
301 void Control::SetAsKeyboardFocusGroup(bool isFocusGroup)
303 mImpl->mIsKeyboardFocusGroup = isFocusGroup;
305 // The following line will be removed when the deprecated API in KeyboardFocusManager is deleted
306 Toolkit::KeyboardFocusManager::Get().SetAsFocusGroup(Self(), isFocusGroup);
309 bool Control::IsKeyboardFocusGroup()
311 return Toolkit::KeyboardFocusManager::Get().IsFocusGroup(Self());
314 void Control::AccessibilityActivate()
316 // Inform deriving classes
317 OnAccessibilityActivated();
320 void Control::KeyboardEnter()
322 // Inform deriving classes
326 bool Control::OnAccessibilityActivated()
328 if(Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self()))
330 return OnKeyboardEnter();
335 bool Control::OnKeyboardEnter()
337 return false; // Keyboard enter is not handled by default
340 bool Control::OnAccessibilityPan(PanGesture gesture)
342 return false; // Accessibility pan gesture is not handled by default
345 bool Control::OnAccessibilityValueChange(bool isIncrease)
347 return false; // Accessibility value change action is not handled by default
350 bool Control::OnAccessibilityZoom()
352 return false; // Accessibility zoom action is not handled by default
355 DevelControl::ControlAccessible* Control::CreateAccessibleObject()
357 return new DevelControl::ControlAccessible(Self());
360 Actor Control::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled)
365 void Control::OnKeyboardFocusChangeCommitted(Actor commitedFocusableActor)
369 Toolkit::Control::KeyEventSignalType& Control::KeyEventSignal()
371 return mImpl->mKeyEventSignal;
374 Toolkit::Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
376 return mImpl->mKeyInputFocusGainedSignal;
379 Toolkit::Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
381 return mImpl->mKeyInputFocusLostSignal;
384 bool Control::EmitKeyEventSignal(const KeyEvent& event)
386 // Guard against destruction during signal emission
387 Dali::Toolkit::Control handle(GetOwner());
389 bool consumed = false;
391 consumed = mImpl->FilterKeyEvent(event);
393 // signals are allocated dynamically when someone connects
394 if(!consumed && !mImpl->mKeyEventSignal.Empty())
396 consumed = mImpl->mKeyEventSignal.Emit(handle, event);
401 // Notification for derived classes
402 consumed = OnKeyEvent(event);
408 Control::Control(ControlBehaviour behaviourFlags)
409 : CustomActorImpl(static_cast<ActorFlags>(behaviourFlags)),
410 mImpl(new Impl(*this))
412 mImpl->mFlags = behaviourFlags;
420 void Control::Initialize()
422 // Call deriving classes so initialised before styling is applied to them.
425 if(!(mImpl->mFlags & DISABLE_STYLE_CHANGE_SIGNALS))
427 Toolkit::StyleManager styleManager = StyleManager::Get();
429 // if stylemanager is available
432 StyleManager& styleManagerImpl = GetImpl(styleManager);
434 // Register for style changes
435 styleManagerImpl.ControlStyleChangeSignal().Connect(this, &Control::OnStyleChange);
437 // Apply the current style
438 styleManagerImpl.ApplyThemeStyleAtInit(Toolkit::Control(GetOwner()));
442 if(mImpl->mFlags & REQUIRES_KEYBOARD_NAVIGATION_SUPPORT)
444 SetKeyboardNavigationSupport(true);
448 Self().GetTypeInfo(type);
451 const auto& typeName = type.GetName();
452 DevelControl::AppendAccessibilityAttribute(Toolkit::Control::DownCast(Self()), "class", typeName);
456 void Control::OnInitialize()
460 bool Control::IsResourceReady() const
462 const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(*this);
463 return controlDataImpl.IsResourceReady();
466 void Control::OnStyleChange(Toolkit::StyleManager styleManager, StyleChange::Type change)
468 // By default the control is only interested in theme (not font) changes
469 if(styleManager && change == StyleChange::THEME_CHANGE)
471 GetImpl(styleManager).ApplyThemeStyle(Toolkit::Control(GetOwner()));
476 void Control::OnPinch(const PinchGesture& pinch)
478 if(!(mImpl->mStartingPinchScale))
481 mImpl->mStartingPinchScale = new Vector3;
484 if(pinch.GetState() == GestureState::STARTED)
486 *(mImpl->mStartingPinchScale) = Self().GetCurrentProperty<Vector3>(Actor::Property::SCALE);
489 Self().SetProperty(Actor::Property::SCALE, *(mImpl->mStartingPinchScale) * pinch.GetScale());
492 void Control::OnPan(const PanGesture& pan)
496 void Control::OnTap(const TapGesture& tap)
500 void Control::OnLongPress(const LongPressGesture& longPress)
504 void Control::EmitKeyInputFocusSignal(bool focusGained)
506 Dali::Toolkit::Control handle(GetOwner());
508 if(Accessibility::IsUp())
510 auto accessible = GetAccessibleObject();
511 if(DALI_LIKELY(accessible))
513 accessible->EmitFocused(focusGained);
514 auto parent = accessible->GetParent();
515 if(parent && !accessible->GetStates()[Dali::Accessibility::State::MANAGES_DESCENDANTS])
517 parent->EmitActiveDescendantChanged(accessible);
524 // signals are allocated dynamically when someone connects
525 if(!mImpl->mKeyInputFocusGainedSignal.Empty())
527 mImpl->mKeyInputFocusGainedSignal.Emit(handle);
532 // signals are allocated dynamically when someone connects
533 if(!mImpl->mKeyInputFocusLostSignal.Empty())
535 mImpl->mKeyInputFocusLostSignal.Emit(handle);
540 void Control::OnSceneConnection(int depth)
542 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Control::OnSceneConnection number of registered visuals(%d)\n", mImpl->mVisuals.Size());
546 for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter != mImpl->mVisuals.End(); iter++)
548 // Check whether the visual is empty and enabled
549 if((*iter)->visual && (*iter)->enabled)
551 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Control::OnSceneConnection Setting visual(%d) on scene\n", (*iter)->index);
552 Toolkit::GetImplementation((*iter)->visual).SetOnScene(self);
556 // The clipping renderer is only created if required.
557 CreateClippingRenderer(*this);
560 void Control::OnSceneDisconnection()
562 mImpl->OnSceneDisconnection();
565 void Control::OnKeyInputFocusGained()
567 EmitKeyInputFocusSignal(true);
570 void Control::OnKeyInputFocusLost()
572 EmitKeyInputFocusSignal(false);
575 void Control::OnChildAdd(Actor& child)
579 void Control::OnChildRemove(Actor& child)
583 void Control::OnPropertySet(Property::Index index, const Property::Value& propertyValue)
585 // If the clipping mode has been set, we may need to create a renderer.
586 // Only do this if we are already on-stage as the OnSceneConnection will handle the off-stage clipping controls.
589 case Actor::Property::CLIPPING_MODE:
591 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
593 // Note: This method will handle whether creation of the renderer is required.
594 CreateClippingRenderer(*this);
598 case Actor::Property::VISIBLE:
600 auto* accessible = GetAccessibleObject();
601 if(DALI_LIKELY(accessible))
603 accessible->EmitVisible(Self().GetProperty<bool>(Actor::Property::VISIBLE));
607 case DevelActor::Property::USER_INTERACTION_ENABLED:
609 const bool enabled = propertyValue.Get<bool>();
610 if(!enabled && Self() == Dali::Toolkit::KeyboardFocusManager::Get().GetCurrentFocusActor())
612 Dali::Toolkit::KeyboardFocusManager::Get().ClearFocus();
619 void Control::OnSizeSet(const Vector3& targetSize)
621 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
624 Vector2 size(targetSize);
625 visual.SetTransformAndSize(Property::Map(), size); // Send an empty map as we do not want to modify the visual's set transform
629 void Control::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
631 // @todo size negotiate background to new size, animate as well?
634 bool Control::OnKeyEvent(const KeyEvent& event)
636 return false; // Do not consume
639 void Control::OnRelayout(const Vector2& size, RelayoutContainer& container)
641 for(unsigned int i = 0, numChildren = Self().GetChildCount(); i < numChildren; ++i)
643 Actor child = Self().GetChildAt(i);
644 Vector2 newChildSize(size);
646 // When set the padding or margin on the control, child should be resized and repositioned.
647 if((mImpl->mPadding.start != 0) || (mImpl->mPadding.end != 0) || (mImpl->mPadding.top != 0) || (mImpl->mPadding.bottom != 0) ||
648 (mImpl->mMargin.start != 0) || (mImpl->mMargin.end != 0) || (mImpl->mMargin.top != 0) || (mImpl->mMargin.bottom != 0))
650 Extents padding = mImpl->mPadding;
652 Dali::CustomActor ownerActor(GetOwner());
653 Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>(ownerActor.GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
655 if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection)
657 std::swap(padding.start, padding.end);
660 newChildSize.width = size.width - (padding.start + padding.end);
661 newChildSize.height = size.height - (padding.top + padding.bottom);
663 // Cannot use childs Position property as it can already have padding and margin applied on it,
664 // so we end up cumulatively applying them over and over again.
665 Vector2 childOffset(0.f, 0.f);
666 childOffset.x += (mImpl->mMargin.start + padding.start);
667 childOffset.y += (mImpl->mMargin.top + padding.top);
669 child.SetProperty(Actor::Property::POSITION, Vector2(childOffset.x, childOffset.y));
671 container.Add(child, newChildSize);
674 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
677 visual.SetTransformAndSize(Property::Map(), size); // Send an empty map as we do not want to modify the visual's set transform
681 void Control::OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
685 Vector3 Control::GetNaturalSize()
687 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Control::GetNaturalSize for %s\n", Self().GetProperty<std::string>(Dali::Actor::Property::NAME).c_str());
688 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
692 visual.GetNaturalSize(naturalSize);
693 naturalSize.width += (mImpl->mPadding.start + mImpl->mPadding.end);
694 naturalSize.height += (mImpl->mPadding.top + mImpl->mPadding.bottom);
695 return Vector3(naturalSize);
697 return Vector3::ZERO;
700 float Control::CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension)
702 return CalculateChildSizeBase(child, dimension);
705 float Control::GetHeightForWidth(float width)
707 return GetHeightForWidthBase(width);
710 float Control::GetWidthForHeight(float height)
712 return GetWidthForHeightBase(height);
715 bool Control::RelayoutDependentOnChildren(Dimension::Type dimension)
717 return RelayoutDependentOnChildrenBase(dimension);
720 void Control::OnCalculateRelayoutSize(Dimension::Type dimension)
724 void Control::OnLayoutNegotiated(float size, Dimension::Type dimension)
728 void Control::SignalConnected(SlotObserver* slotObserver, CallbackBase* callback)
730 mImpl->SignalConnected(slotObserver, callback);
733 void Control::SignalDisconnected(SlotObserver* slotObserver, CallbackBase* callback)
735 mImpl->SignalDisconnected(slotObserver, callback);
738 void Control::MakeVisualTransition(Dali::Property::Map& sourcePropertyMap, Dali::Property::Map& destinationPropertyMap, Dali::Toolkit::Control source, Dali::Toolkit::Control destination, Dali::Property::Index visualIndex)
740 sourcePropertyMap.Clear();
741 destinationPropertyMap.Clear();
743 Toolkit::Visual::Base sourceVisual = DevelControl::GetVisual(GetImplementation(source), visualIndex);
744 Toolkit::Visual::Base destinationVisual = DevelControl::GetVisual(GetImplementation(destination), visualIndex);
746 // If source or destination doesn't have the visual, do not create transition for the visual.
747 if(!sourceVisual || !destinationVisual)
752 Property::Map sourceMap;
753 Property::Map destinationMap;
754 sourceVisual.CreatePropertyMap(sourceMap);
755 destinationVisual.CreatePropertyMap(destinationMap);
757 static auto findValueVector4 = [](const Property::Map& map, Property::Index index, const Vector4& defaultValue = Vector4()) -> Vector4 {
758 Property::Value* propertyValue = map.Find(index);
761 return propertyValue->Get<Vector4>();
766 static auto findValueFloat = [](const Property::Map& map, Property::Index index, const float& defaultValue = 0.0f) -> float {
767 Property::Value* propertyValue = map.Find(index);
770 return propertyValue->Get<float>();
775 Vector4 defaultMixColor(Color::TRANSPARENT);
776 Vector4 defaultCornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
777 float defaultBorderlineWidth(0.0f);
778 Vector4 defaultBorderlineColor(0.0f, 0.0f, 0.0f, 1.0f);
779 float defaultBorderlineOffset(0.0f);
781 Vector4 sourceMixColor = findValueVector4(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR, defaultMixColor);
782 Vector4 sourceCornerRadius = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, defaultCornerRadius);
783 float sourceBorderlineWidth = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, defaultBorderlineWidth);
784 Vector4 sourceBorderlineColor = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, defaultBorderlineColor);
785 float sourceBorderlineOffset = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, defaultBorderlineOffset);
787 Vector4 destinationMixColor = findValueVector4(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR, defaultMixColor);
788 Vector4 destinationCornerRadius = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, defaultCornerRadius);
789 float destinationBorderlineWidth = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, defaultBorderlineWidth);
790 Vector4 destinationBorderlineColor = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, defaultBorderlineColor);
791 float destinationBorderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, defaultBorderlineOffset);
793 // If the value of the source Control and that of destination Control is different, the property should be transitioned.
794 if(Vector3(sourceMixColor) != Vector3(destinationMixColor))
796 sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, Vector3(sourceMixColor));
797 destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, Vector3(destinationMixColor));
800 if(std::abs(sourceMixColor.a - destinationMixColor.a) > Math::MACHINE_EPSILON_1)
802 sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::OPACITY, sourceMixColor.a);
803 destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::OPACITY, destinationMixColor.a);
806 if(sourceCornerRadius != destinationCornerRadius)
808 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceCornerRadius);
809 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationCornerRadius);
812 if(!Dali::Equals(sourceBorderlineWidth, destinationBorderlineWidth))
814 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
815 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
818 if(sourceBorderlineColor != destinationBorderlineColor)
820 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
821 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
824 if(!Dali::Equals(sourceBorderlineOffset, destinationBorderlineOffset))
826 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
827 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
831 Control& GetImplementation(Dali::Toolkit::Control& handle)
833 CustomActorImpl& customInterface = handle.GetImplementation();
834 // downcast to control
835 Control& impl = dynamic_cast<Internal::Control&>(customInterface);
839 const Control& GetImplementation(const Dali::Toolkit::Control& handle)
841 const CustomActorImpl& customInterface = handle.GetImplementation();
842 // downcast to control
843 const Control& impl = dynamic_cast<const Internal::Control&>(customInterface);
847 } // namespace Internal
849 } // namespace Toolkit