Updated control transitions to work with visual transform
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / dummy-control.h
1 #ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
2 #define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/dali-toolkit.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 class DummyControlImpl;
31
32 /**
33  * Control does not have a New method so use this dummy class for the handle.
34  */
35 class DummyControl : public Control
36 {
37 public:
38   enum PropertyRange
39   {
40     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
41     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property index
42   };
43
44   struct Property
45   {
46     enum Type
47     {
48       TEST_VISUAL = PROPERTY_START_INDEX
49     };
50   };
51
52   DummyControl();
53   DummyControl(const DummyControl& control);
54   ~DummyControl();
55
56   static DummyControl New( bool override = false );
57
58   static DummyControl DownCast( BaseHandle handle );
59
60
61   DummyControl& operator=(const DummyControl& control);
62
63 public: // Not intended for application developers
64
65   DummyControl( DummyControlImpl& implementation );
66   DummyControl( Dali::Internal::CustomActor* internal );
67 };
68
69 /**
70  * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
71  * This class does not override any of Internal::Control's behaviour.
72  */
73 class DummyControlImpl : public Internal::Control
74 {
75 public:
76
77   static DummyControl New();
78
79 public:
80   inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); }
81   inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); }
82   inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); }
83   inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); }
84   inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); }
85   inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); }
86
87   void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual);
88   void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled );
89   void UnregisterVisual( Property::Index index );
90   void EnableVisual( Property::Index index, bool enabled );
91   bool IsVisualEnabled( Property::Index indepx );
92
93   Toolkit::Visual::Base GetVisual( Property::Index index );
94   Animation CreateTransition( const Toolkit::TransitionData& transition );
95
96   static void SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
97
98   static Property::Value GetProperty( BaseObject* object, Dali::Property::Index propertyIndex );
99
100   // Used to test signal connections
101   void CustomSlot1( Actor actor );
102
103   bool mCustomSlot1Called;
104   typedef std::vector<Property::Index> VisualIndices;
105   VisualIndices mRegisteredVisualIndices;
106
107 protected:
108
109   DummyControlImpl();
110
111   virtual ~DummyControlImpl();
112 };
113
114 /**
115  * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
116  * This class DOES override Internal::Control's behaviour.
117  */
118 class DummyControlImplOverride : public DummyControlImpl
119 {
120 public:
121
122   static DummyControl New();
123
124 private:
125
126   DummyControlImplOverride();
127
128   virtual ~DummyControlImplOverride();
129
130 private: // From Internal::Control
131
132   virtual void OnInitialize();
133   virtual bool OnAccessibilityActivated();
134   virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
135   virtual bool OnAccessibilityValueChange( bool isIncrease );
136
137   virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
138   virtual void OnPinch(const PinchGesture& pinch);
139   virtual void OnPan(const PanGesture& pan);
140   virtual void OnTap(const TapGesture& tap);
141   virtual void OnLongPress(const LongPressGesture& longPress);
142
143 private: // From CustomActorImpl
144
145   virtual void OnStageConnection( int depth );
146   virtual void OnStageDisconnection();
147   virtual void OnChildAdd(Actor& child);
148   virtual void OnChildRemove(Actor& child);
149   virtual void OnSizeSet(const Vector3& targetSize);
150   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
151   virtual bool OnTouchEvent(const TouchEvent& event);
152   virtual bool OnHoverEvent(const HoverEvent& event);
153   virtual bool OnWheelEvent(const WheelEvent& event);
154   virtual bool OnKeyEvent(const KeyEvent& event);
155   virtual void OnKeyInputFocusGained();
156   virtual void OnKeyInputFocusLost();
157   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
158
159 public:
160
161   bool initializeCalled;
162   bool activatedCalled;
163   bool onAccTouchedCalled;
164   bool onAccValueChangeCalled;
165   bool themeChangeCalled;
166   bool fontChangeCalled;
167   bool pinchCalled;
168   bool panCalled;
169   bool tapCalled;
170   bool longPressCalled;
171   bool stageConnectionCalled;
172   bool stageDisconnectionCalled;
173   bool childAddCalled;
174   bool childRemoveCalled;
175   bool sizeSetCalled;
176   bool sizeAnimationCalled;
177   bool touchEventCalled;
178   bool hoverEventCalled;
179   bool wheelEventCalled;
180   bool keyEventCalled;
181   bool keyInputFocusGained;
182   bool keyInputFocusLost;
183 };
184
185 } // namespace Toolkit
186
187 } // namespace Dali
188
189 #endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__