2 * Copyright (c) 2024 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/size-negotiation/relayout-container.h>
29 #include <cstring> // for strcmp
34 #include <dali-toolkit/dali-toolkit.h>
35 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
36 #include <dali-toolkit/devel-api/controls/control-devel.h>
37 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
38 #include <dali-toolkit/devel-api/visuals/color-visual-properties-devel.h>
39 #include <dali-toolkit/devel-api/visuals/visual-actions-devel.h>
40 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
41 #include <dali-toolkit/internal/styling/style-manager-impl.h>
42 #include <dali-toolkit/internal/visuals/color/color-visual.h>
43 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
44 #include <dali-toolkit/public-api/align-enumerations.h>
45 #include <dali-toolkit/public-api/controls/control.h>
46 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
47 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
48 #include <dali-toolkit/public-api/styling/style-manager.h>
49 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
50 #include <dali-toolkit/public-api/visuals/visual-properties.h>
60 #if defined(DEBUG_ENABLED)
61 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_CONTROL_VISUALS");
65 * @brief Creates a clipping renderer if required.
66 * (EG. If no renders exist and clipping is enabled).
67 * @param[in] controlImpl The control implementation.
69 void CreateClippingRenderer(Control& controlImpl)
71 // We want to add a transparent background if we do not have one for clipping.
72 Actor self(controlImpl.Self());
73 int clippingMode = ClippingMode::DISABLED;
74 if(self.GetProperty(Actor::Property::CLIPPING_MODE).Get(clippingMode))
76 Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(controlImpl);
78 if(clippingMode == ClippingMode::CLIP_CHILDREN && controlDataImpl.mVisuals.Empty() && self.GetRendererCount() == 0u)
80 controlImpl.SetBackgroundColor(Color::TRANSPARENT);
85 } // unnamed namespace
87 Toolkit::Control Control::New()
89 return New(ControlBehaviour::CONTROL_BEHAVIOUR_DEFAULT);
92 Toolkit::Control Control::New(ControlBehaviour additionalBehaviour)
94 // Create the implementation, temporarily owned on stack
95 IntrusivePtr<Control> controlImpl = new Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehaviour));
97 // Pass ownership to handle
98 Toolkit::Control handle(*controlImpl);
100 // Second-phase init of the implementation
101 // This can only be done after the CustomActor connection has been made...
102 controlImpl->Initialize();
107 void Control::SetStyleName(const std::string& styleName)
109 if(styleName != mImpl->mStyleName)
111 mImpl->mStyleName = styleName;
113 // Apply new style, if stylemanager is available
114 Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
117 GetImpl(styleManager).ApplyThemeStyle(Toolkit::Control(GetOwner()));
122 const std::string& Control::GetStyleName() const
124 return mImpl->mStyleName;
127 void Control::SetBackgroundColor(const Vector4& color)
129 mImpl->mBackgroundColor = color;
132 map[Toolkit::Visual::Property::TYPE] = Toolkit::Visual::COLOR;
133 map[Toolkit::ColorVisual::Property::MIX_COLOR] = color;
135 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
136 if(visual && visual.GetType() == Toolkit::Visual::COLOR)
138 // Update background color only
139 mImpl->DoAction(Toolkit::Control::Property::BACKGROUND, DevelVisual::Action::UPDATE_PROPERTY, map);
146 void Control::SetBackground(const Property::Map& map)
148 Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual(map);
149 visual.SetName("background");
152 mImpl->RegisterVisual(Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND);
154 // Trigger a size negotiation request that may be needed by the new visual to relayout its contents.
159 void Control::ClearBackground()
161 mImpl->UnregisterVisual(Toolkit::Control::Property::BACKGROUND);
162 mImpl->mBackgroundColor = Color::TRANSPARENT;
164 // Trigger a size negotiation request that may be needed when unregistering a visual.
168 void Control::SetResourceReady()
170 Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(*this);
171 controlDataImpl.ResourceReady();
174 Toolkit::DevelControl::ControlAccessible* Control::GetAccessibleObject()
176 return mImpl->GetAccessibleObject();
179 void Control::EnableGestureDetection(GestureType::Value type)
181 if((type & GestureType::PINCH) && !mImpl->mPinchGestureDetector)
183 mImpl->mPinchGestureDetector = PinchGestureDetector::New();
184 mImpl->mPinchGestureDetector.DetectedSignal().Connect(mImpl, &Impl::PinchDetected);
185 mImpl->mPinchGestureDetector.Attach(Self());
188 if((type & GestureType::PAN) && !mImpl->mPanGestureDetector)
190 mImpl->mPanGestureDetector = PanGestureDetector::New();
191 mImpl->mPanGestureDetector.SetMaximumTouchesRequired(2);
192 mImpl->mPanGestureDetector.DetectedSignal().Connect(mImpl, &Impl::PanDetected);
193 mImpl->mPanGestureDetector.Attach(Self());
196 if((type & GestureType::TAP) && !mImpl->mTapGestureDetector)
198 mImpl->mTapGestureDetector = TapGestureDetector::New();
199 mImpl->mTapGestureDetector.DetectedSignal().Connect(mImpl, &Impl::TapDetected);
200 mImpl->mTapGestureDetector.Attach(Self());
203 if((type & GestureType::LONG_PRESS) && !mImpl->mLongPressGestureDetector)
205 mImpl->mLongPressGestureDetector = LongPressGestureDetector::New();
206 mImpl->mLongPressGestureDetector.DetectedSignal().Connect(mImpl, &Impl::LongPressDetected);
207 mImpl->mLongPressGestureDetector.Attach(Self());
211 void Control::DisableGestureDetection(GestureType::Value type)
213 if((type & GestureType::PINCH) && mImpl->mPinchGestureDetector)
215 mImpl->mPinchGestureDetector.Detach(Self());
216 mImpl->mPinchGestureDetector.Reset();
219 if((type & GestureType::PAN) && mImpl->mPanGestureDetector)
221 mImpl->mPanGestureDetector.Detach(Self());
222 mImpl->mPanGestureDetector.Reset();
225 if((type & GestureType::TAP) && mImpl->mTapGestureDetector)
227 mImpl->mTapGestureDetector.Detach(Self());
228 mImpl->mTapGestureDetector.Reset();
231 if((type & GestureType::LONG_PRESS) && mImpl->mLongPressGestureDetector)
233 mImpl->mLongPressGestureDetector.Detach(Self());
234 mImpl->mLongPressGestureDetector.Reset();
238 PinchGestureDetector Control::GetPinchGestureDetector() const
240 return mImpl->mPinchGestureDetector;
243 PanGestureDetector Control::GetPanGestureDetector() const
245 return mImpl->mPanGestureDetector;
248 TapGestureDetector Control::GetTapGestureDetector() const
250 return mImpl->mTapGestureDetector;
253 LongPressGestureDetector Control::GetLongPressGestureDetector() const
255 return mImpl->mLongPressGestureDetector;
258 void Control::SetKeyboardNavigationSupport(bool isSupported)
260 mImpl->mIsKeyboardNavigationSupported = isSupported;
263 bool Control::IsKeyboardNavigationSupported()
265 return mImpl->mIsKeyboardNavigationSupported;
268 void Control::SetKeyInputFocus()
270 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
272 Toolkit::KeyInputFocusManager::Get().SetFocus(Toolkit::Control::DownCast(Self()));
276 bool Control::HasKeyInputFocus()
279 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
281 Toolkit::Control control = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
282 if(Self() == control)
290 void Control::ClearKeyInputFocus()
292 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
294 Toolkit::KeyInputFocusManager::Get().RemoveFocus(Toolkit::Control::DownCast(Self()));
298 void Control::SetAsKeyboardFocusGroup(bool isFocusGroup)
300 mImpl->mIsKeyboardFocusGroup = isFocusGroup;
302 // The following line will be removed when the deprecated API in KeyboardFocusManager is deleted
303 Toolkit::KeyboardFocusManager::Get().SetAsFocusGroup(Self(), isFocusGroup);
306 bool Control::IsKeyboardFocusGroup()
308 return Toolkit::KeyboardFocusManager::Get().IsFocusGroup(Self());
311 void Control::KeyboardEnter()
313 // Inform deriving classes
317 bool Control::OnAccessibilityActivated()
319 if(Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self()))
321 return OnKeyboardEnter();
326 bool Control::OnKeyboardEnter()
328 return false; // Keyboard enter is not handled by default
331 bool Control::OnAccessibilityPan(PanGesture gesture)
333 return false; // Accessibility pan gesture is not handled by default
336 bool Control::OnAccessibilityValueChange(bool isIncrease)
338 return false; // Accessibility value change action is not handled by default
341 bool Control::OnAccessibilityZoom()
343 return false; // Accessibility zoom action is not handled by default
346 DevelControl::ControlAccessible* Control::CreateAccessibleObject()
348 return new DevelControl::ControlAccessible(Self());
351 Actor Control::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled)
356 void Control::OnKeyboardFocusChangeCommitted(Actor commitedFocusableActor)
360 Toolkit::Control::KeyEventSignalType& Control::KeyEventSignal()
362 return mImpl->mKeyEventSignal;
365 Toolkit::Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
367 return mImpl->mKeyInputFocusGainedSignal;
370 Toolkit::Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
372 return mImpl->mKeyInputFocusLostSignal;
375 bool Control::EmitKeyEventSignal(const KeyEvent& event)
377 // Guard against destruction during signal emission
378 Dali::Toolkit::Control handle(GetOwner());
380 bool consumed = false;
382 consumed = mImpl->FilterKeyEvent(event);
384 // signals are allocated dynamically when someone connects
385 if(!consumed && !mImpl->mKeyEventSignal.Empty())
387 consumed = mImpl->mKeyEventSignal.Emit(handle, event);
392 // Notification for derived classes
393 consumed = OnKeyEvent(event);
399 Control::Control(ControlBehaviour behaviourFlags)
400 : CustomActorImpl(static_cast<ActorFlags>(behaviourFlags)),
401 mImpl(new Impl(*this))
403 mImpl->mFlags = behaviourFlags;
411 void Control::Initialize()
413 // Call deriving classes so initialised before styling is applied to them.
416 if(!(mImpl->mFlags & DISABLE_STYLE_CHANGE_SIGNALS))
418 Toolkit::StyleManager styleManager = StyleManager::Get();
420 // if stylemanager is available
423 StyleManager& styleManagerImpl = GetImpl(styleManager);
425 // Register for style changes
426 styleManagerImpl.ControlStyleChangeSignal().Connect(this, &Control::OnStyleChange);
428 // Apply the current style
429 styleManagerImpl.ApplyThemeStyleAtInit(Toolkit::Control(GetOwner()));
433 if(mImpl->mFlags & REQUIRES_KEYBOARD_NAVIGATION_SUPPORT)
435 SetKeyboardNavigationSupport(true);
439 void Control::OnInitialize()
443 bool Control::IsResourceReady() const
445 const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(*this);
446 return controlDataImpl.IsResourceReady();
449 void Control::OnStyleChange(Toolkit::StyleManager styleManager, StyleChange::Type change)
451 // By default the control is only interested in theme (not font) changes
452 if(styleManager && change == StyleChange::THEME_CHANGE)
454 GetImpl(styleManager).ApplyThemeStyle(Toolkit::Control(GetOwner()));
459 void Control::OnPinch(const PinchGesture& pinch)
461 if(!(mImpl->mStartingPinchScale))
464 mImpl->mStartingPinchScale = new Vector3;
467 if(pinch.GetState() == GestureState::STARTED)
469 *(mImpl->mStartingPinchScale) = Self().GetCurrentProperty<Vector3>(Actor::Property::SCALE);
472 Self().SetProperty(Actor::Property::SCALE, *(mImpl->mStartingPinchScale) * pinch.GetScale());
475 void Control::OnPan(const PanGesture& pan)
479 void Control::OnTap(const TapGesture& tap)
483 void Control::OnLongPress(const LongPressGesture& longPress)
487 void Control::EmitKeyInputFocusSignal(bool focusGained)
489 Dali::Toolkit::Control handle(GetOwner());
491 if(Accessibility::IsUp())
493 auto accessible = GetAccessibleObject();
494 if(DALI_LIKELY(accessible))
496 accessible->EmitFocused(focusGained);
497 auto parent = accessible->GetParent();
498 if(parent && !accessible->GetStates()[Dali::Accessibility::State::MANAGES_DESCENDANTS])
500 parent->EmitActiveDescendantChanged(accessible);
507 // signals are allocated dynamically when someone connects
508 if(!mImpl->mKeyInputFocusGainedSignal.Empty())
510 mImpl->mKeyInputFocusGainedSignal.Emit(handle);
515 // signals are allocated dynamically when someone connects
516 if(!mImpl->mKeyInputFocusLostSignal.Empty())
518 mImpl->mKeyInputFocusLostSignal.Emit(handle);
523 void Control::OnSceneConnection(int depth)
525 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Control::OnSceneConnection number of registered visuals(%d)\n", mImpl->mVisuals.Size());
529 for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter != mImpl->mVisuals.End(); iter++)
531 // Check whether the visual is empty and enabled
532 if((*iter)->visual && (*iter)->enabled)
534 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Control::OnSceneConnection Setting visual(%d) on scene\n", (*iter)->index);
535 Toolkit::GetImplementation((*iter)->visual).SetOnScene(self);
539 // The clipping renderer is only created if required.
540 CreateClippingRenderer(*this);
543 void Control::OnSceneDisconnection()
545 mImpl->OnSceneDisconnection();
548 void Control::OnKeyInputFocusGained()
550 EmitKeyInputFocusSignal(true);
553 void Control::OnKeyInputFocusLost()
555 EmitKeyInputFocusSignal(false);
558 void Control::OnChildAdd(Actor& child)
562 void Control::OnChildRemove(Actor& child)
566 void Control::OnPropertySet(Property::Index index, const Property::Value& propertyValue)
568 // If the clipping mode has been set, we may need to create a renderer.
569 // Only do this if we are already on-stage as the OnSceneConnection will handle the off-stage clipping controls.
572 case Actor::Property::CLIPPING_MODE:
574 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
576 // Note: This method will handle whether creation of the renderer is required.
577 CreateClippingRenderer(*this);
581 case Actor::Property::VISIBLE:
583 auto* accessible = GetAccessibleObject();
584 if(DALI_LIKELY(accessible))
586 accessible->EmitVisible(Self().GetProperty<bool>(Actor::Property::VISIBLE));
590 case DevelActor::Property::USER_INTERACTION_ENABLED:
592 const bool enabled = propertyValue.Get<bool>();
593 if(!enabled && Self() == Dali::Toolkit::KeyboardFocusManager::Get().GetCurrentFocusActor())
595 Dali::Toolkit::KeyboardFocusManager::Get().ClearFocus();
602 void Control::OnSizeSet(const Vector3& targetSize)
604 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
607 Vector2 size(targetSize);
608 visual.SetTransformAndSize(Property::Map(), size); // Send an empty map as we do not want to modify the visual's set transform
612 void Control::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
614 // @todo size negotiate background to new size, animate as well?
617 bool Control::OnKeyEvent(const KeyEvent& event)
619 return false; // Do not consume
622 void Control::OnRelayout(const Vector2& size, RelayoutContainer& container)
624 for(unsigned int i = 0, numChildren = Self().GetChildCount(); i < numChildren; ++i)
626 Actor child = Self().GetChildAt(i);
627 Vector2 newChildSize(size);
629 // When set the padding or margin on the control, child should be resized and repositioned.
630 if((mImpl->mPadding.start != 0) || (mImpl->mPadding.end != 0) || (mImpl->mPadding.top != 0) || (mImpl->mPadding.bottom != 0) ||
631 (mImpl->mMargin.start != 0) || (mImpl->mMargin.end != 0) || (mImpl->mMargin.top != 0) || (mImpl->mMargin.bottom != 0))
633 Extents padding = mImpl->mPadding;
635 Dali::CustomActor ownerActor(GetOwner());
636 Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>(ownerActor.GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
638 if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection)
640 std::swap(padding.start, padding.end);
643 newChildSize.width = size.width - (padding.start + padding.end);
644 newChildSize.height = size.height - (padding.top + padding.bottom);
646 // Cannot use childs Position property as it can already have padding and margin applied on it,
647 // so we end up cumulatively applying them over and over again.
648 Vector2 childOffset(0.f, 0.f);
649 childOffset.x += (mImpl->mMargin.start + padding.start);
650 childOffset.y += (mImpl->mMargin.top + padding.top);
652 child.SetProperty(Actor::Property::POSITION, Vector2(childOffset.x, childOffset.y));
654 container.Add(child, newChildSize);
657 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
660 visual.SetTransformAndSize(Property::Map(), size); // Send an empty map as we do not want to modify the visual's set transform
664 void Control::OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
668 Vector3 Control::GetNaturalSize()
670 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Control::GetNaturalSize for %s\n", Self().GetProperty<std::string>(Dali::Actor::Property::NAME).c_str());
671 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
675 visual.GetNaturalSize(naturalSize);
676 naturalSize.width += (mImpl->mPadding.start + mImpl->mPadding.end);
677 naturalSize.height += (mImpl->mPadding.top + mImpl->mPadding.bottom);
678 return Vector3(naturalSize);
680 return Vector3::ZERO;
683 float Control::CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension)
685 return CalculateChildSizeBase(child, dimension);
688 float Control::GetHeightForWidth(float width)
690 return GetHeightForWidthBase(width);
693 float Control::GetWidthForHeight(float height)
695 return GetWidthForHeightBase(height);
698 bool Control::RelayoutDependentOnChildren(Dimension::Type dimension)
700 return RelayoutDependentOnChildrenBase(dimension);
703 void Control::OnCalculateRelayoutSize(Dimension::Type dimension)
707 void Control::OnLayoutNegotiated(float size, Dimension::Type dimension)
711 void Control::SignalConnected(SlotObserver* slotObserver, CallbackBase* callback)
713 mImpl->SignalConnected(slotObserver, callback);
716 void Control::SignalDisconnected(SlotObserver* slotObserver, CallbackBase* callback)
718 mImpl->SignalDisconnected(slotObserver, callback);
721 void Control::MakeVisualTransition(Dali::Property::Map& sourcePropertyMap, Dali::Property::Map& destinationPropertyMap, Dali::Toolkit::Control source, Dali::Toolkit::Control destination, Dali::Property::Index visualIndex)
723 sourcePropertyMap.Clear();
724 destinationPropertyMap.Clear();
726 Toolkit::Visual::Base sourceVisual = DevelControl::GetVisual(GetImplementation(source), visualIndex);
727 Toolkit::Visual::Base destinationVisual = DevelControl::GetVisual(GetImplementation(destination), visualIndex);
729 // If source or destination doesn't have the visual, do not create transition for the visual.
730 if(!sourceVisual || !destinationVisual)
735 Property::Map sourceMap;
736 Property::Map destinationMap;
737 sourceVisual.CreatePropertyMap(sourceMap);
738 destinationVisual.CreatePropertyMap(destinationMap);
740 static auto findValueVector4 = [](const Property::Map& map, Property::Index index, const Vector4& defaultValue = Vector4()) -> Vector4 {
741 Property::Value* propertyValue = map.Find(index);
744 return propertyValue->Get<Vector4>();
749 static auto findValueFloat = [](const Property::Map& map, Property::Index index, const float& defaultValue = 0.0f) -> float {
750 Property::Value* propertyValue = map.Find(index);
753 return propertyValue->Get<float>();
758 Vector4 defaultMixColor(Color::TRANSPARENT);
759 Vector4 defaultCornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
760 float defaultBorderlineWidth(0.0f);
761 Vector4 defaultBorderlineColor(0.0f, 0.0f, 0.0f, 1.0f);
762 float defaultBorderlineOffset(0.0f);
764 Vector4 sourceMixColor = findValueVector4(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR, defaultMixColor);
765 Vector4 sourceCornerRadius = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, defaultCornerRadius);
766 float sourceBorderlineWidth = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, defaultBorderlineWidth);
767 Vector4 sourceBorderlineColor = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, defaultBorderlineColor);
768 float sourceBorderlineOffset = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, defaultBorderlineOffset);
770 Vector4 destinationMixColor = findValueVector4(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR, defaultMixColor);
771 Vector4 destinationCornerRadius = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, defaultCornerRadius);
772 float destinationBorderlineWidth = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, defaultBorderlineWidth);
773 Vector4 destinationBorderlineColor = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, defaultBorderlineColor);
774 float destinationBorderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, defaultBorderlineOffset);
776 // If the value of the source Control and that of destination Control is different, the property should be transitioned.
777 if(Vector3(sourceMixColor) != Vector3(destinationMixColor))
779 sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, Vector3(sourceMixColor));
780 destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, Vector3(destinationMixColor));
783 if(std::abs(sourceMixColor.a - destinationMixColor.a) > Math::MACHINE_EPSILON_1)
785 sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::OPACITY, sourceMixColor.a);
786 destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::OPACITY, destinationMixColor.a);
789 if(sourceCornerRadius != destinationCornerRadius)
791 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceCornerRadius);
792 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationCornerRadius);
795 if(!Dali::Equals(sourceBorderlineWidth, destinationBorderlineWidth))
797 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
798 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
801 if(sourceBorderlineColor != destinationBorderlineColor)
803 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
804 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
807 if(!Dali::Equals(sourceBorderlineOffset, destinationBorderlineOffset))
809 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
810 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
814 Control& GetImplementation(Dali::Toolkit::Control& handle)
816 CustomActorImpl& customInterface = handle.GetImplementation();
817 // downcast to control
818 Control& impl = dynamic_cast<Internal::Control&>(customInterface);
822 const Control& GetImplementation(const Dali::Toolkit::Control& handle)
824 const CustomActorImpl& customInterface = handle.GetImplementation();
825 // downcast to control
826 const Control& impl = dynamic_cast<const Internal::Control&>(customInterface);
830 } // namespace Internal
832 } // namespace Toolkit