Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / event / events / pinch-gesture-detector-impl.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 // CLASS HEADER
18 #include <dali/internal/event/events/pinch-gesture-detector-impl.h>
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/events/pinch-gesture.h>
22 #include <dali/public-api/object/type-registry.h>
23 #include <dali/internal/event/events/gesture-event-processor.h>
24 #include <dali/integration-api/debug.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 namespace
33 {
34 BaseHandle Create()
35 {
36   return Dali::PinchGestureDetector::New();
37 }
38
39 TypeRegistration mType( typeid(Dali::PinchGestureDetector), typeid(Dali::GestureDetector), Create );
40
41 SignalConnectorType signalConnector1( mType, Dali::PinchGestureDetector::SIGNAL_PINCH_DETECTED, &PinchGestureDetector::DoConnectSignal );
42
43 }
44
45
46 PinchGestureDetectorPtr PinchGestureDetector::New()
47 {
48   return new PinchGestureDetector;
49 }
50
51 PinchGestureDetector::PinchGestureDetector()
52 : GestureDetector(Gesture::Pinch)
53 {
54 }
55
56 PinchGestureDetector::~PinchGestureDetector()
57 {
58 }
59
60 void PinchGestureDetector::EmitPinchGestureSignal(Dali::Actor actor, const PinchGesture& pinch)
61 {
62   // Guard against destruction during signal emission
63   Dali::PinchGestureDetector handle( this );
64
65   mDetectedSignalV2.Emit( actor, pinch );
66 }
67
68 bool PinchGestureDetector::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
69 {
70   bool connected( true );
71   PinchGestureDetector* gesture = dynamic_cast<PinchGestureDetector*>(object);
72
73   if ( Dali::PinchGestureDetector::SIGNAL_PINCH_DETECTED == signalName )
74   {
75     gesture->DetectedSignal().Connect( tracker, functor );
76   }
77   else
78   {
79     // signalName does not match any signal
80     connected = false;
81   }
82
83   return connected;
84 }
85
86 void PinchGestureDetector::OnActorAttach(Actor& actor)
87 {
88   // Do nothing
89 }
90
91 void PinchGestureDetector::OnActorDetach(Actor& actor)
92 {
93   // Do nothing
94 }
95
96 void PinchGestureDetector::OnActorDestroyed(Object& object)
97 {
98   // Do nothing
99 }
100
101 } // namespace Internal
102
103 } // namespace Dali