/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*
*/
+// CLASS HEADER
#include <dali-toolkit/public-api/controls/control.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
namespace Dali
{
-
namespace Toolkit
{
-
Control Control::New()
{
return Internal::Control::New();
{
}
-Control::Control(const Control& uiControl)
-: CustomActor( uiControl ? static_cast< const Internal::Control& >( uiControl.GetImplementation() ).GetOwner() : NULL)
-{
-}
-
-Control::~Control()
-{
-}
+Control::Control(const Control& uiControl) = default;
-Control& Control::operator=( const Control& handle )
-{
- if( &handle != this )
- {
- CustomActor::operator=( handle );
- }
- return *this;
-}
+Control::Control(Control&& rhs) = default;
-Control Control::DownCast( BaseHandle handle )
-{
- return DownCast< Control, Internal::Control >(handle);
-}
-
-Internal::Control& Control::GetImplementation()
-{
- return static_cast<Internal::Control&>(CustomActor::GetImplementation());
-}
-
-const Internal::Control& Control::GetImplementation() const
+Control::~Control()
{
- return static_cast<const Internal::Control&>(CustomActor::GetImplementation());
}
-void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy )
-{
- GetImplementation().SetSizePolicy( widthPolicy, heightPolicy );
-}
+Control& Control::operator=(const Control& handle) = default;
-void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const
-{
- GetImplementation().GetSizePolicy( widthPolicy, heightPolicy );
-}
+Control& Control::operator=(Control&& rhs) = default;
-void Control::SetMinimumSize( const Vector3& size )
+Control Control::DownCast(BaseHandle handle)
{
- GetImplementation().SetMinimumSize( size );
+ return DownCast<Control, Internal::Control>(handle);
}
-const Vector3& Control::GetMinimumSize() const
+void Control::SetKeyInputFocus()
{
- return GetImplementation().GetMinimumSize();
+ Internal::GetImplementation(*this).SetKeyInputFocus();
}
-void Control::SetMaximumSize( const Vector3& size )
+bool Control::HasKeyInputFocus()
{
- GetImplementation().SetMaximumSize( size );
+ return Internal::GetImplementation(*this).HasKeyInputFocus();
}
-const Vector3& Control::GetMaximumSize() const
+void Control::ClearKeyInputFocus()
{
- return GetImplementation().GetMaximumSize();
+ Internal::GetImplementation(*this).ClearKeyInputFocus();
}
-Vector3 Control::GetNaturalSize()
+PinchGestureDetector Control::GetPinchGestureDetector() const
{
- return GetImplementation().GetNaturalSize();
+ return Internal::GetImplementation(*this).GetPinchGestureDetector();
}
-float Control::GetHeightForWidth( float width )
+PanGestureDetector Control::GetPanGestureDetector() const
{
- return GetImplementation().GetHeightForWidth( width );
+ return Internal::GetImplementation(*this).GetPanGestureDetector();
}
-float Control::GetWidthForHeight( float height )
+TapGestureDetector Control::GetTapGestureDetector() const
{
- return GetImplementation().GetWidthForHeight( height );
+ return Internal::GetImplementation(*this).GetTapGestureDetector();
}
-void Control::SetKeyInputFocus()
+LongPressGestureDetector Control::GetLongPressGestureDetector() const
{
- GetImplementation().SetKeyInputFocus();
+ return Internal::GetImplementation(*this).GetLongPressGestureDetector();
}
-bool Control::HasKeyInputFocus()
+void Control::SetStyleName(const std::string& styleName)
{
- return GetImplementation().HasKeyInputFocus();
+ Internal::GetImplementation(*this).SetStyleName(styleName);
}
-void Control::ClearKeyInputFocus()
+const std::string& Control::GetStyleName() const
{
- GetImplementation().ClearKeyInputFocus();
+ return Internal::GetImplementation(*this).GetStyleName();
}
-PinchGestureDetector Control::GetPinchGestureDetector() const
+void Control::SetBackgroundColor(const Vector4& color)
{
- return GetImplementation().GetPinchGestureDetector();
+ Internal::GetImplementation(*this).SetBackgroundColor(color);
}
-PanGestureDetector Control::GetPanGestureDetector() const
+void Control::ClearBackground()
{
- return GetImplementation().GetPanGestureDetector();
+ Internal::GetImplementation(*this).ClearBackground();
}
-TapGestureDetector Control::GetTapGestureDetector() const
+bool Control::IsResourceReady() const
{
- return GetImplementation().GetTapGestureDetector();
-}
+ const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this);
+ const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(internalControl);
-LongPressGestureDetector Control::GetLongPressGestureDetector() const
-{
- return GetImplementation().GetLongPressGestureDetector();
+ return controlDataImpl.IsResourceReady();
}
-void Control::SetBackgroundColor( const Vector4& color )
+Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus(Dali::Property::Index index)
{
- GetImplementation().SetBackgroundColor( color );
+ const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this);
+ const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(internalControl);
+ return controlDataImpl.GetVisualResourceStatus(index);
}
-Vector4 Control::GetBackgroundColor() const
+Control::KeyEventSignalType& Control::KeyEventSignal()
{
- return GetImplementation().GetBackgroundColor();
+ return Internal::GetImplementation(*this).KeyEventSignal();
}
-void Control::SetBackground( Image image )
+Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
{
- GetImplementation().SetBackground( image );
+ return Internal::GetImplementation(*this).KeyInputFocusGainedSignal();
}
-void Control::ClearBackground()
+Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
{
- GetImplementation().ClearBackground();
+ return Internal::GetImplementation(*this).KeyInputFocusLostSignal();
}
-Actor Control::GetBackgroundActor() const
+Control::ResourceReadySignalType& Control::ResourceReadySignal()
{
- return GetImplementation().GetBackgroundActor();
-}
+ Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this);
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
-Control::KeyEventSignalType& Control::KeyEventSignal()
-{
- return GetImplementation().KeyEventSignal();
+ return controlImpl.mResourceReadySignal;
}
Control::Control(Internal::Control& implementation)