2 * Copyright (c) 2022 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/object/type-info.h>
28 #include <dali/public-api/object/type-registry-helper.h>
29 #include <dali/public-api/size-negotiation/relayout-container.h>
30 #include <cstring> // for strcmp
36 #include <dali-toolkit/dali-toolkit.h>
37 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
38 #include <dali-toolkit/devel-api/controls/control-devel.h>
39 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
40 #include <dali-toolkit/devel-api/visuals/visual-actions-devel.h>
41 #include <dali-toolkit/devel-api/visuals/color-visual-properties-devel.h>
42 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
43 #include <dali-toolkit/internal/styling/style-manager-impl.h>
44 #include <dali-toolkit/internal/visuals/color/color-visual.h>
45 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
46 #include <dali-toolkit/public-api/align-enumerations.h>
47 #include <dali-toolkit/public-api/controls/control.h>
48 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
49 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
50 #include <dali-toolkit/public-api/styling/style-manager.h>
51 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
52 #include <dali-toolkit/public-api/visuals/visual-properties.h>
62 #if defined(DEBUG_ENABLED)
63 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_CONTROL_VISUALS");
67 * @brief Creates a clipping renderer if required.
68 * (EG. If no renders exist and clipping is enabled).
69 * @param[in] controlImpl The control implementation.
71 void CreateClippingRenderer(Control& controlImpl)
73 // We want to add a transparent background if we do not have one for clipping.
74 Actor self(controlImpl.Self());
75 int clippingMode = ClippingMode::DISABLED;
76 if(self.GetProperty(Actor::Property::CLIPPING_MODE).Get(clippingMode))
78 Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(controlImpl);
80 if(clippingMode == ClippingMode::CLIP_CHILDREN && controlDataImpl.mVisuals.Empty() && self.GetRendererCount() == 0u)
82 controlImpl.SetBackgroundColor(Color::TRANSPARENT);
87 } // unnamed namespace
89 Toolkit::Control Control::New()
91 return New(ControlBehaviour::CONTROL_BEHAVIOUR_DEFAULT);
94 Toolkit::Control Control::New(ControlBehaviour additionalBehaviour)
96 // Create the implementation, temporarily owned on stack
97 IntrusivePtr<Control> controlImpl = new Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehaviour));
99 // Pass ownership to handle
100 Toolkit::Control handle(*controlImpl);
102 // Second-phase init of the implementation
103 // This can only be done after the CustomActor connection has been made...
104 controlImpl->Initialize();
109 void Control::SetStyleName(const std::string& styleName)
111 if(styleName != mImpl->mStyleName)
113 mImpl->mStyleName = styleName;
115 // Apply new style, if stylemanager is available
116 Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
119 GetImpl(styleManager).ApplyThemeStyle(Toolkit::Control(GetOwner()));
124 const std::string& Control::GetStyleName() const
126 return mImpl->mStyleName;
129 void Control::SetBackgroundColor(const Vector4& color)
131 mImpl->mBackgroundColor = color;
134 map[Toolkit::Visual::Property::TYPE] = Toolkit::Visual::COLOR;
135 map[Toolkit::ColorVisual::Property::MIX_COLOR] = color;
137 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
138 if(visual && visual.GetType() == Toolkit::Visual::COLOR)
140 // Update background color only
141 mImpl->DoAction(Toolkit::Control::Property::BACKGROUND, DevelVisual::Action::UPDATE_PROPERTY, map);
148 void Control::SetBackground(const Property::Map& map)
150 Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual(map);
151 visual.SetName("background");
154 mImpl->RegisterVisual(Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND);
156 // Trigger a size negotiation request that may be needed by the new visual to relayout its contents.
161 void Control::ClearBackground()
163 mImpl->UnregisterVisual(Toolkit::Control::Property::BACKGROUND);
164 mImpl->mBackgroundColor = Color::TRANSPARENT;
166 // Trigger a size negotiation request that may be needed when unregistering a visual.
170 Toolkit::DevelControl::ControlAccessible* Control::GetAccessibleObject()
172 return mImpl->GetAccessibleObject();
175 void Control::EnableGestureDetection(GestureType::Value type)
177 if((type & GestureType::PINCH) && !mImpl->mPinchGestureDetector)
179 mImpl->mPinchGestureDetector = PinchGestureDetector::New();
180 mImpl->mPinchGestureDetector.DetectedSignal().Connect(mImpl, &Impl::PinchDetected);
181 mImpl->mPinchGestureDetector.Attach(Self());
184 if((type & GestureType::PAN) && !mImpl->mPanGestureDetector)
186 mImpl->mPanGestureDetector = PanGestureDetector::New();
187 mImpl->mPanGestureDetector.SetMaximumTouchesRequired(2);
188 mImpl->mPanGestureDetector.DetectedSignal().Connect(mImpl, &Impl::PanDetected);
189 mImpl->mPanGestureDetector.Attach(Self());
192 if((type & GestureType::TAP) && !mImpl->mTapGestureDetector)
194 mImpl->mTapGestureDetector = TapGestureDetector::New();
195 mImpl->mTapGestureDetector.DetectedSignal().Connect(mImpl, &Impl::TapDetected);
196 mImpl->mTapGestureDetector.Attach(Self());
199 if((type & GestureType::LONG_PRESS) && !mImpl->mLongPressGestureDetector)
201 mImpl->mLongPressGestureDetector = LongPressGestureDetector::New();
202 mImpl->mLongPressGestureDetector.DetectedSignal().Connect(mImpl, &Impl::LongPressDetected);
203 mImpl->mLongPressGestureDetector.Attach(Self());
207 void Control::DisableGestureDetection(GestureType::Value type)
209 if((type & GestureType::PINCH) && mImpl->mPinchGestureDetector)
211 mImpl->mPinchGestureDetector.Detach(Self());
212 mImpl->mPinchGestureDetector.Reset();
215 if((type & GestureType::PAN) && mImpl->mPanGestureDetector)
217 mImpl->mPanGestureDetector.Detach(Self());
218 mImpl->mPanGestureDetector.Reset();
221 if((type & GestureType::TAP) && mImpl->mTapGestureDetector)
223 mImpl->mTapGestureDetector.Detach(Self());
224 mImpl->mTapGestureDetector.Reset();
227 if((type & GestureType::LONG_PRESS) && mImpl->mLongPressGestureDetector)
229 mImpl->mLongPressGestureDetector.Detach(Self());
230 mImpl->mLongPressGestureDetector.Reset();
234 PinchGestureDetector Control::GetPinchGestureDetector() const
236 return mImpl->mPinchGestureDetector;
239 PanGestureDetector Control::GetPanGestureDetector() const
241 return mImpl->mPanGestureDetector;
244 TapGestureDetector Control::GetTapGestureDetector() const
246 return mImpl->mTapGestureDetector;
249 LongPressGestureDetector Control::GetLongPressGestureDetector() const
251 return mImpl->mLongPressGestureDetector;
254 void Control::SetKeyboardNavigationSupport(bool isSupported)
256 mImpl->mIsKeyboardNavigationSupported = isSupported;
259 bool Control::IsKeyboardNavigationSupported()
261 return mImpl->mIsKeyboardNavigationSupported;
264 void Control::SetKeyInputFocus()
266 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
268 Toolkit::KeyInputFocusManager::Get().SetFocus(Toolkit::Control::DownCast(Self()));
272 bool Control::HasKeyInputFocus()
275 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
277 Toolkit::Control control = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
278 if(Self() == control)
286 void Control::ClearKeyInputFocus()
288 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
290 Toolkit::KeyInputFocusManager::Get().RemoveFocus(Toolkit::Control::DownCast(Self()));
294 void Control::SetAsKeyboardFocusGroup(bool isFocusGroup)
296 mImpl->mIsKeyboardFocusGroup = isFocusGroup;
298 // The following line will be removed when the deprecated API in KeyboardFocusManager is deleted
299 Toolkit::KeyboardFocusManager::Get().SetAsFocusGroup(Self(), isFocusGroup);
302 bool Control::IsKeyboardFocusGroup()
304 return Toolkit::KeyboardFocusManager::Get().IsFocusGroup(Self());
307 void Control::AccessibilityActivate()
309 // Inform deriving classes
310 OnAccessibilityActivated();
313 void Control::KeyboardEnter()
315 // Inform deriving classes
319 bool Control::OnAccessibilityActivated()
321 if(Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self()))
323 return OnKeyboardEnter();
328 bool Control::OnKeyboardEnter()
330 return false; // Keyboard enter is not handled by default
333 bool Control::OnAccessibilityPan(PanGesture gesture)
335 return false; // Accessibility pan gesture is not handled by default
338 bool Control::OnAccessibilityValueChange(bool isIncrease)
340 return false; // Accessibility value change action is not handled by default
343 bool Control::OnAccessibilityZoom()
345 return false; // Accessibility zoom action is not handled by default
348 DevelControl::ControlAccessible* Control::CreateAccessibleObject()
350 return new DevelControl::ControlAccessible(Self());
353 Actor Control::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled)
358 void Control::OnKeyboardFocusChangeCommitted(Actor commitedFocusableActor)
362 Toolkit::Control::KeyEventSignalType& Control::KeyEventSignal()
364 return mImpl->mKeyEventSignal;
367 Toolkit::Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
369 return mImpl->mKeyInputFocusGainedSignal;
372 Toolkit::Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
374 return mImpl->mKeyInputFocusLostSignal;
377 bool Control::EmitKeyEventSignal(const KeyEvent& event)
379 // Guard against destruction during signal emission
380 Dali::Toolkit::Control handle(GetOwner());
382 bool consumed = false;
384 consumed = mImpl->FilterKeyEvent(event);
386 // signals are allocated dynamically when someone connects
387 if(!consumed && !mImpl->mKeyEventSignal.Empty())
389 consumed = mImpl->mKeyEventSignal.Emit(handle, event);
394 // Notification for derived classes
395 consumed = OnKeyEvent(event);
401 Control::Control(ControlBehaviour behaviourFlags)
402 : CustomActorImpl(static_cast<ActorFlags>(behaviourFlags)),
403 mImpl(new Impl(*this))
405 mImpl->mFlags = behaviourFlags;
413 void Control::Initialize()
415 // Call deriving classes so initialised before styling is applied to them.
418 if(!(mImpl->mFlags & DISABLE_STYLE_CHANGE_SIGNALS))
420 Toolkit::StyleManager styleManager = StyleManager::Get();
422 // if stylemanager is available
425 StyleManager& styleManagerImpl = GetImpl(styleManager);
427 // Register for style changes
428 styleManagerImpl.ControlStyleChangeSignal().Connect(this, &Control::OnStyleChange);
430 // Apply the current style
431 styleManagerImpl.ApplyThemeStyleAtInit(Toolkit::Control(GetOwner()));
435 if(mImpl->mFlags & REQUIRES_KEYBOARD_NAVIGATION_SUPPORT)
437 SetKeyboardNavigationSupport(true);
441 Self().GetTypeInfo(type);
444 auto typeName = type.GetName();
445 DevelControl::AppendAccessibilityAttribute(Toolkit::Control::DownCast(Self()), "class", typeName);
449 void Control::OnInitialize()
453 void Control::OnStyleChange(Toolkit::StyleManager styleManager, StyleChange::Type change)
455 // By default the control is only interested in theme (not font) changes
456 if(styleManager && change == StyleChange::THEME_CHANGE)
458 GetImpl(styleManager).ApplyThemeStyle(Toolkit::Control(GetOwner()));
463 void Control::OnPinch(const PinchGesture& pinch)
465 if(!(mImpl->mStartingPinchScale))
468 mImpl->mStartingPinchScale = new Vector3;
471 if(pinch.GetState() == GestureState::STARTED)
473 *(mImpl->mStartingPinchScale) = Self().GetCurrentProperty<Vector3>(Actor::Property::SCALE);
476 Self().SetProperty(Actor::Property::SCALE, *(mImpl->mStartingPinchScale) * pinch.GetScale());
479 void Control::OnPan(const PanGesture& pan)
483 void Control::OnTap(const TapGesture& tap)
487 void Control::OnLongPress(const LongPressGesture& longPress)
491 void Control::EmitKeyInputFocusSignal(bool focusGained)
493 Dali::Toolkit::Control handle(GetOwner());
495 if(Accessibility::IsUp())
497 auto self = GetAccessibleObject();
498 self->EmitFocused(focusGained);
499 auto parent = self->GetParent();
500 if(parent && !self->GetStates()[Dali::Accessibility::State::MANAGES_DESCENDANTS])
502 parent->EmitActiveDescendantChanged(self);
508 // signals are allocated dynamically when someone connects
509 if(!mImpl->mKeyInputFocusGainedSignal.Empty())
511 mImpl->mKeyInputFocusGainedSignal.Emit(handle);
516 // signals are allocated dynamically when someone connects
517 if(!mImpl->mKeyInputFocusLostSignal.Empty())
519 mImpl->mKeyInputFocusLostSignal.Emit(handle);
524 void Control::OnSceneConnection(int depth)
526 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Control::OnSceneConnection number of registered visuals(%d)\n", mImpl->mVisuals.Size());
530 for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter != mImpl->mVisuals.End(); iter++)
532 // Check whether the visual is empty and enabled
533 if((*iter)->visual && (*iter)->enabled)
535 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Control::OnSceneConnection Setting visual(%d) on scene\n", (*iter)->index);
536 Toolkit::GetImplementation((*iter)->visual).SetOnScene(self);
540 // The clipping renderer is only created if required.
541 CreateClippingRenderer(*this);
544 void Control::OnSceneDisconnection()
546 mImpl->OnSceneDisconnection();
549 void Control::OnKeyInputFocusGained()
551 EmitKeyInputFocusSignal(true);
554 void Control::OnKeyInputFocusLost()
556 EmitKeyInputFocusSignal(false);
559 void Control::OnChildAdd(Actor& child)
563 void Control::OnChildRemove(Actor& child)
567 void Control::OnPropertySet(Property::Index index, const Property::Value& propertyValue)
569 // If the clipping mode has been set, we may need to create a renderer.
570 // Only do this if we are already on-stage as the OnSceneConnection will handle the off-stage clipping controls.
573 case Actor::Property::CLIPPING_MODE:
575 if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
577 // Note: This method will handle whether creation of the renderer is required.
578 CreateClippingRenderer(*this);
582 case Actor::Property::VISIBLE:
584 GetAccessibleObject()->EmitVisible(Self().GetProperty<bool>(Actor::Property::VISIBLE));
590 void Control::OnSizeSet(const Vector3& targetSize)
592 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
595 Vector2 size(targetSize);
596 visual.SetTransformAndSize(Property::Map(), size); // Send an empty map as we do not want to modify the visual's set transform
600 void Control::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
602 // @todo size negotiate background to new size, animate as well?
605 bool Control::OnKeyEvent(const KeyEvent& event)
607 return false; // Do not consume
610 void Control::OnRelayout(const Vector2& size, RelayoutContainer& container)
612 for(unsigned int i = 0, numChildren = Self().GetChildCount(); i < numChildren; ++i)
614 Actor child = Self().GetChildAt(i);
615 Vector2 newChildSize(size);
617 // When set the padding or margin on the control, child should be resized and repositioned.
618 if((mImpl->mPadding.start != 0) || (mImpl->mPadding.end != 0) || (mImpl->mPadding.top != 0) || (mImpl->mPadding.bottom != 0) ||
619 (mImpl->mMargin.start != 0) || (mImpl->mMargin.end != 0) || (mImpl->mMargin.top != 0) || (mImpl->mMargin.bottom != 0))
621 Extents padding = mImpl->mPadding;
623 Dali::CustomActor ownerActor(GetOwner());
624 Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>(ownerActor.GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
626 if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection)
628 std::swap(padding.start, padding.end);
631 newChildSize.width = size.width - (padding.start + padding.end);
632 newChildSize.height = size.height - (padding.top + padding.bottom);
634 // Cannot use childs Position property as it can already have padding and margin applied on it,
635 // so we end up cumulatively applying them over and over again.
636 Vector2 childOffset(0.f, 0.f);
637 childOffset.x += (mImpl->mMargin.start + padding.start);
638 childOffset.y += (mImpl->mMargin.top + padding.top);
640 child.SetProperty(Actor::Property::POSITION, Vector2(childOffset.x, childOffset.y));
642 container.Add(child, newChildSize);
645 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
648 visual.SetTransformAndSize(Property::Map(), size); // Send an empty map as we do not want to modify the visual's set transform
652 void Control::OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
656 Vector3 Control::GetNaturalSize()
658 DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Control::GetNaturalSize for %s\n", Self().GetProperty<std::string>(Dali::Actor::Property::NAME).c_str());
659 Toolkit::Visual::Base visual = mImpl->GetVisual(Toolkit::Control::Property::BACKGROUND);
663 visual.GetNaturalSize(naturalSize);
664 naturalSize.width += (mImpl->mPadding.start + mImpl->mPadding.end);
665 naturalSize.height += (mImpl->mPadding.top + mImpl->mPadding.bottom);
666 return Vector3(naturalSize);
668 return Vector3::ZERO;
671 float Control::CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension)
673 return CalculateChildSizeBase(child, dimension);
676 float Control::GetHeightForWidth(float width)
678 return GetHeightForWidthBase(width);
681 float Control::GetWidthForHeight(float height)
683 return GetWidthForHeightBase(height);
686 bool Control::RelayoutDependentOnChildren(Dimension::Type dimension)
688 return RelayoutDependentOnChildrenBase(dimension);
691 void Control::OnCalculateRelayoutSize(Dimension::Type dimension)
695 void Control::OnLayoutNegotiated(float size, Dimension::Type dimension)
699 void Control::SignalConnected(SlotObserver* slotObserver, CallbackBase* callback)
701 mImpl->SignalConnected(slotObserver, callback);
704 void Control::SignalDisconnected(SlotObserver* slotObserver, CallbackBase* callback)
706 mImpl->SignalDisconnected(slotObserver, callback);
709 void Control::MakeVisualTransition(Dali::Property::Map& sourcePropertyMap, Dali::Property::Map& destinationPropertyMap,
710 Dali::Toolkit::Control source, Dali::Toolkit::Control destination, Dali::Property::Index visualIndex)
712 sourcePropertyMap.Clear();
713 destinationPropertyMap.Clear();
715 Toolkit::Visual::Base sourceVisual = DevelControl::GetVisual(GetImplementation(source), visualIndex);
716 Toolkit::Visual::Base destinationVisual = DevelControl::GetVisual(GetImplementation(destination), visualIndex);
718 // If source or destination doesn't have the visual, do not create transition for the visual.
719 if(!sourceVisual || !destinationVisual)
724 Property::Map sourceMap;
725 Property::Map destinationMap;
726 sourceVisual.CreatePropertyMap(sourceMap);
727 destinationVisual.CreatePropertyMap(destinationMap);
729 static auto findValueVector4 = [](const Property::Map& map, Property::Index index, const Vector4& defaultValue = Vector4()) -> Vector4
731 Property::Value* propertyValue = map.Find(index);
734 return propertyValue->Get<Vector4>();
739 static auto findValueFloat = [](const Property::Map& map, Property::Index index, const float& defaultValue = 0.0f) -> float
741 Property::Value* propertyValue = map.Find(index);
744 return propertyValue->Get<float>();
749 Vector4 defaultMixColor(Color::TRANSPARENT);
750 Vector4 defaultCornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
751 float defaultBorderlineWidth(0.0f);
752 Vector4 defaultBorderlineColor(0.0f, 0.0f, 0.0f, 1.0f);
753 float defaultBorderlineOffset(0.0f);
755 Vector4 sourceMixColor = findValueVector4(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR, defaultMixColor);
756 Vector4 sourceCornerRadius = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, defaultCornerRadius);
757 float sourceBorderlineWidth = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, defaultBorderlineWidth);
758 Vector4 sourceBorderlineColor = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, defaultBorderlineColor);
759 float sourceBorderlineOffset = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, defaultBorderlineOffset);
761 Vector4 destinationMixColor = findValueVector4(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR, defaultMixColor);
762 Vector4 destinationCornerRadius = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, defaultCornerRadius);
763 float destinationBorderlineWidth = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, defaultBorderlineWidth);
764 Vector4 destinationBorderlineColor = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, defaultBorderlineColor);
765 float destinationBorderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, defaultBorderlineOffset);
767 // If the value of the source Control and that of destination Control is different, the property should be transitioned.
768 if(Vector3(sourceMixColor) != Vector3(destinationMixColor))
770 sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, Vector3(sourceMixColor));
771 destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::MIX_COLOR, Vector3(destinationMixColor));
774 if(std::abs(sourceMixColor.a - destinationMixColor.a) > Math::MACHINE_EPSILON_1)
776 sourcePropertyMap.Add(Dali::Toolkit::Visual::Property::OPACITY, sourceMixColor.a);
777 destinationPropertyMap.Add(Dali::Toolkit::Visual::Property::OPACITY, destinationMixColor.a);
780 if(sourceCornerRadius != destinationCornerRadius)
782 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceCornerRadius);
783 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationCornerRadius);
786 if(sourceBorderlineWidth != destinationBorderlineWidth)
788 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
789 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
792 if(sourceBorderlineColor != destinationBorderlineColor)
794 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
795 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
798 if(sourceBorderlineOffset != destinationBorderlineOffset)
800 sourcePropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
801 destinationPropertyMap.Add(Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
805 Control& GetImplementation(Dali::Toolkit::Control& handle)
807 CustomActorImpl& customInterface = handle.GetImplementation();
808 // downcast to control
809 Control& impl = dynamic_cast<Internal::Control&>(customInterface);
813 const Control& GetImplementation(const Dali::Toolkit::Control& handle)
815 const CustomActorImpl& customInterface = handle.GetImplementation();
816 // downcast to control
817 const Control& impl = dynamic_cast<const Internal::Control&>(customInterface);
821 } // namespace Internal
823 } // namespace Toolkit