-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2022 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under 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
{
-
-const char* const Control::ACTION_CONTROL_ACTIVATED = "control-activated";
-const char* const Control::SIGNAL_KEY_EVENT = "key-event";
-
Control Control::New()
{
- return ControlImpl::New();
+ return Toolkit::Internal::Control::New();
}
-Control::Control()
+Control Control::New(ControlBehaviour additionalBehaviour)
{
+ return Toolkit::Internal::Control::New(static_cast<Toolkit::Internal::Control::ControlBehaviour>(additionalBehaviour));
}
-Control::Control(const Control& uiControl)
-: CustomActor( uiControl ? static_cast<const ControlImpl&>( uiControl.GetImplementation() ).GetOwner() : NULL)
+Control::Control()
{
}
+Control::Control(const Control& uiControl) = default;
+
+Control::Control(Control&& rhs) = default;
+
Control::~Control()
{
}
-Control& Control::operator=( const Control& handle )
-{
- if( &handle != this )
- {
- CustomActor::operator=( handle );
- }
- return *this;
-}
+Control& Control::operator=(const Control& handle) = default;
-Control Control::DownCast( BaseHandle handle )
-{
- return DownCast<Control, ControlImpl>(handle);
-}
+Control& Control::operator=(Control&& rhs) = default;
-ControlImpl& Control::GetImplementation()
+Control Control::DownCast(BaseHandle handle)
{
- return static_cast<ControlImpl&>(CustomActor::GetImplementation());
+ return DownCast<Control, Internal::Control>(handle);
}
-const ControlImpl& Control::GetImplementation() const
+void Control::SetKeyInputFocus()
{
- return static_cast<const ControlImpl&>(CustomActor::GetImplementation());
+ Internal::GetImplementation(*this).SetKeyInputFocus();
}
-void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy )
+bool Control::HasKeyInputFocus()
{
- GetImplementation().SetSizePolicy( widthPolicy, heightPolicy );
+ return Internal::GetImplementation(*this).HasKeyInputFocus();
}
-void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const
+void Control::ClearKeyInputFocus()
{
- GetImplementation().GetSizePolicy( widthPolicy, heightPolicy );
+ Internal::GetImplementation(*this).ClearKeyInputFocus();
}
-void Control::SetMinimumSize( const Vector3& size )
+PinchGestureDetector Control::GetPinchGestureDetector() const
{
- GetImplementation().SetMinimumSize( size );
+ return Internal::GetImplementation(*this).GetPinchGestureDetector();
}
-const Vector3& Control::GetMinimumSize() const
+PanGestureDetector Control::GetPanGestureDetector() const
{
- return GetImplementation().GetMinimumSize();
+ return Internal::GetImplementation(*this).GetPanGestureDetector();
}
-void Control::SetMaximumSize( const Vector3& size )
+TapGestureDetector Control::GetTapGestureDetector() const
{
- GetImplementation().SetMaximumSize( size );
+ return Internal::GetImplementation(*this).GetTapGestureDetector();
}
-const Vector3& Control::GetMaximumSize() const
+LongPressGestureDetector Control::GetLongPressGestureDetector() const
{
- return GetImplementation().GetMaximumSize();
+ return Internal::GetImplementation(*this).GetLongPressGestureDetector();
}
-Vector3 Control::GetNaturalSize()
+void Control::SetStyleName(const std::string& styleName)
{
- return GetImplementation().GetNaturalSize();
+ Internal::GetImplementation(*this).SetStyleName(styleName);
}
-float Control::GetHeightForWidth( float width )
+const std::string& Control::GetStyleName() const
{
- return GetImplementation().GetHeightForWidth( width );
+ return Internal::GetImplementation(*this).GetStyleName();
}
-float Control::GetWidthForHeight( float height )
+void Control::SetBackgroundColor(const Vector4& color)
{
- return GetImplementation().GetWidthForHeight( height );
+ Internal::GetImplementation(*this).SetBackgroundColor(color);
}
-void Control::SetKeyInputFocus()
+void Control::ClearBackground()
{
- GetImplementation().SetKeyInputFocus();
+ Internal::GetImplementation(*this).ClearBackground();
}
-bool Control::HasKeyInputFocus()
+bool Control::IsResourceReady() const
{
- return GetImplementation().HasKeyInputFocus();
+ const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this);
+ const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(internalControl);
+
+ return controlDataImpl.IsResourceReady();
}
-void Control::ClearKeyInputFocus()
+Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus(Dali::Property::Index index)
{
- GetImplementation().ClearKeyInputFocus();
+ const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this);
+ const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get(internalControl);
+ return controlDataImpl.GetVisualResourceStatus(index);
}
-Control::KeyEventSignalV2& Control::KeyEventSignal()
+Control::KeyEventSignalType& Control::KeyEventSignal()
{
- return GetImplementation().KeyEventSignal();
+ return Internal::GetImplementation(*this).KeyEventSignal();
}
-/**
- * @copydoc ConnectionTrackerInterface::SignalConnected
- */
-void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
+Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
{
- GetImplementation().SignalConnected(slotObserver, callback );
+ return Internal::GetImplementation(*this).KeyInputFocusGainedSignal();
}
-/**
- * @copydoc ConnectionTrackerInterface::SignalDisconnected
- */
-void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback )
+Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
{
- GetImplementation().SignalDisconnected(slotObserver, callback );
+ return Internal::GetImplementation(*this).KeyInputFocusLostSignal();
}
-/**
- * @copydoc ConnectionTrackerInterface::GetConnectionCount
- */
-std::size_t Control::GetConnectionCount() const
+Control::ResourceReadySignalType& Control::ResourceReadySignal()
{
- return GetImplementation().GetConnectionCount( );
-}
+ Internal::Control& internalControl = Toolkit::Internal::GetImplementation(*this);
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
+ return controlImpl.mResourceReadySignal;
+}
-Control::Control(ControlImpl& implementation)
+Control::Control(Internal::Control& implementation)
: CustomActor(implementation)
{
}
Control::Control(Dali::Internal::CustomActor* internal)
: CustomActor(internal)
{
- VerifyCustomActorPointer<ControlImpl>(internal);
+ VerifyCustomActorPointer<Internal::Control>(internal);
}
} // namespace Toolkit