(Control) Can connect to gestures through scripting
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / control.cpp
index 8652f1a..d01ad83 100644 (file)
@@ -1,18 +1,19 @@
-//
-// 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) 2014 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.
+ *
+ */
 
 #include <dali-toolkit/public-api/controls/control.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
@@ -24,21 +25,16 @@ namespace Toolkit
 {
 
 const char* const Control::ACTION_CONTROL_ACTIVATED = "control-activated";
+
 const char* const Control::SIGNAL_KEY_EVENT = "key-event";
+const char* const Control::SIGNAL_TAPPED = "tapped";
+const char* const Control::SIGNAL_PANNED = "panned";
+const char* const Control::SIGNAL_PINCHED = "pinched";
+const char* const Control::SIGNAL_LONG_PRESSED = "long-pressed";
 
 Control Control::New()
 {
-  // Use TypeRegistry to create instance of control so that the type-info matches Control rather than ControlImpl
-  TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(Control) );
-  DALI_ASSERT_ALWAYS( typeInfo && "TypeRegistry returning Invalid TypeInfo" );
-
-  BaseHandle handle = typeInfo.CreateInstance();
-  DALI_ASSERT_ALWAYS( handle && "Unable to Create Control" );
-
-  Control control = DownCast( handle );
-  DALI_ASSERT_ALWAYS( handle && "TypeRegistry did not create a Control" );
-
-  return control;
+  return Internal::Control::New();
 }
 
 Control::Control()
@@ -46,7 +42,7 @@ Control::Control()
 }
 
 Control::Control(const Control& uiControl)
-: CustomActor( uiControl ? static_cast<const ControlImpl&>( uiControl.GetImplementation() ).GetOwner() : NULL)
+: CustomActor( uiControl ? static_cast< const Internal::Control& >( uiControl.GetImplementation() ).GetOwner() : NULL)
 {
 }
 
@@ -65,17 +61,17 @@ 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()
+Internal::Control& Control::GetImplementation()
 {
-  return static_cast<ControlImpl&>(CustomActor::GetImplementation());
+  return static_cast<Internal::Control&>(CustomActor::GetImplementation());
 }
 
-const ControlImpl& Control::GetImplementation() const
+const Internal::Control& Control::GetImplementation() const
 {
-  return static_cast<const ControlImpl&>(CustomActor::GetImplementation());
+  return static_cast<const Internal::Control&>(CustomActor::GetImplementation());
 }
 
 void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy )
@@ -188,32 +184,7 @@ Control::KeyEventSignalV2& Control::KeyEventSignal()
   return GetImplementation().KeyEventSignal();
 }
 
-/**
- * @copydoc ConnectionTrackerInterface::SignalConnected
- */
-void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
-{
-  GetImplementation().SignalConnected(slotObserver, callback );
-}
-
-/**
- * @copydoc ConnectionTrackerInterface::SignalDisconnected
- */
-void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback )
-{
-  GetImplementation().SignalDisconnected(slotObserver, callback );
-}
-
-/**
- * @copydoc ConnectionTrackerInterface::GetConnectionCount
- */
-std::size_t Control::GetConnectionCount() const
-{
-  return GetImplementation().GetConnectionCount( );
-}
-
-
-Control::Control(ControlImpl& implementation)
+Control::Control(Internal::Control& implementation)
 : CustomActor(implementation)
 {
 }
@@ -221,7 +192,7 @@ Control::Control(ControlImpl& implementation)
 Control::Control(Dali::Internal::CustomActor* internal)
 : CustomActor(internal)
 {
-  VerifyCustomActorPointer<ControlImpl>(internal);
+  VerifyCustomActorPointer<Internal::Control>(internal);
 }
 
 } // namespace Toolkit