Merge "Prepare for Tizen 4.0 Build" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control.cpp
index 2022ce5..b882c1d 100644 (file)
@@ -1,20 +1,27 @@
-//
-// 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) 2016 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/public-api/controls/control-impl.h>
 
 namespace Dali
@@ -23,20 +30,17 @@ 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 Internal::Control::New();
 }
 
 Control::Control()
 {
 }
 
-Control::Control(const Control& uiControl)
-: CustomActor( uiControl ? static_cast<const ControlImpl&>( uiControl.GetImplementation() ).GetOwner() : NULL)
+Control::Control( const Control& uiControl )
+: CustomActor( uiControl  )
 {
 }
 
@@ -55,110 +59,94 @@ Control& Control::operator=( const Control& handle )
 
 Control Control::DownCast( BaseHandle handle )
 {
-  return DownCast<Control, ControlImpl>(handle);
+  return DownCast< Control, Internal::Control >(handle);
 }
 
-ControlImpl& Control::GetImplementation()
+void Control::SetKeyInputFocus()
 {
-  return static_cast<ControlImpl&>(CustomActor::GetImplementation());
+  Internal::GetImplementation(*this).SetKeyInputFocus();
 }
 
-const ControlImpl& Control::GetImplementation() const
+bool Control::HasKeyInputFocus()
 {
-  return static_cast<const ControlImpl&>(CustomActor::GetImplementation());
+  return Internal::GetImplementation(*this).HasKeyInputFocus();
 }
 
-void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy )
+void Control::ClearKeyInputFocus()
 {
-  GetImplementation().SetSizePolicy( widthPolicy, heightPolicy );
+  Internal::GetImplementation(*this).ClearKeyInputFocus();
 }
 
-void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const
+PinchGestureDetector Control::GetPinchGestureDetector() const
 {
-  GetImplementation().GetSizePolicy( widthPolicy, heightPolicy );
+  return Internal::GetImplementation(*this).GetPinchGestureDetector();
 }
 
-void Control::SetMinimumSize( const Vector3& size )
+PanGestureDetector Control::GetPanGestureDetector() const
 {
-  GetImplementation().SetMinimumSize( size );
+  return Internal::GetImplementation(*this).GetPanGestureDetector();
 }
 
-const Vector3& Control::GetMinimumSize() const
+TapGestureDetector Control::GetTapGestureDetector() const
 {
-  return GetImplementation().GetMinimumSize();
+  return Internal::GetImplementation(*this).GetTapGestureDetector();
 }
 
-void Control::SetMaximumSize( const Vector3& size )
+LongPressGestureDetector Control::GetLongPressGestureDetector() const
 {
-  GetImplementation().SetMaximumSize( size );
+  return Internal::GetImplementation(*this).GetLongPressGestureDetector();
 }
 
-const Vector3& Control::GetMaximumSize() const
+void Control::SetStyleName( const std::string& styleName )
 {
-  return GetImplementation().GetMaximumSize();
+  Internal::GetImplementation(*this).SetStyleName( styleName );
 }
 
-Vector3 Control::GetNaturalSize()
+const std::string& Control::GetStyleName() const
 {
-  return GetImplementation().GetNaturalSize();
+  return Internal::GetImplementation(*this).GetStyleName();
 }
 
-float Control::GetHeightForWidth( float width )
+void Control::SetBackgroundColor( const Vector4& color )
 {
-  return GetImplementation().GetHeightForWidth( width );
+  Internal::GetImplementation(*this).SetBackgroundColor( color );
 }
 
-float Control::GetWidthForHeight( float height )
+Vector4 Control::GetBackgroundColor() const
 {
-  return GetImplementation().GetWidthForHeight( height );
-}
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetBackgroundColor() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" );
 
-void Control::SetKeyInputFocus()
-{
-  GetImplementation().SetKeyInputFocus();
+  return Internal::GetImplementation(*this).GetBackgroundColor();
 }
 
-bool Control::HasKeyInputFocus()
+void Control::SetBackgroundImage( Image image )
 {
-  return GetImplementation().HasKeyInputFocus();
-}
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" );
 
-void Control::ClearKeyInputFocus()
-{
-  GetImplementation().ClearKeyInputFocus();
+  Internal::GetImplementation(*this).SetBackgroundImage( image );
 }
 
-Control::KeyEventSignalV2& Control::KeyEventSignal()
+void Control::ClearBackground()
 {
-  return GetImplementation().KeyEventSignal();
+  Internal::GetImplementation(*this).ClearBackground();
 }
 
-/**
- * @copydoc ConnectionTrackerInterface::SignalConnected
- */
-void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
+Control::KeyEventSignalType& Control::KeyEventSignal()
 {
-  GetImplementation().SignalConnected(slotObserver, callback );
+  return Internal::GetImplementation(*this).KeyEventSignal();
 }
 
-/**
- * @copydoc ConnectionTrackerInterface::SignalDisconnected
- */
-void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback )
+Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
 {
-  GetImplementation().SignalDisconnected(slotObserver, callback );
+  return Internal::GetImplementation(*this).KeyInputFocusGainedSignal();
 }
 
-/**
- * @copydoc ConnectionTrackerInterface::GetConnectionCount
- */
-std::size_t Control::GetConnectionCount() const
+Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
 {
-  return GetImplementation().GetConnectionCount( );
+  return Internal::GetImplementation(*this).KeyInputFocusLostSignal();
 }
 
-
-Control::Control(ControlImpl& implementation)
+Control::Control(Internal::Control& implementation)
 : CustomActor(implementation)
 {
 }
@@ -166,7 +154,7 @@ Control::Control(ControlImpl& implementation)
 Control::Control(Dali::Internal::CustomActor* internal)
 : CustomActor(internal)
 {
-  VerifyCustomActorPointer<ControlImpl>(internal);
+  VerifyCustomActorPointer<Internal::Control>(internal);
 }
 
 } // namespace Toolkit