[dali_1.2.15] Merge branch 'devel/master'
[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 class ControlRenderer;
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
39   DummyControl();
40   DummyControl(const DummyControl& control);
41   ~DummyControl();
42
43   static DummyControl New( bool override = false );
44
45   static DummyControl DownCast( BaseHandle handle );
46
47
48   DummyControl& operator=(const DummyControl& control);
49
50 public: // Not intended for application developers
51
52   DummyControl( DummyControlImpl& implementation );
53   DummyControl( Dali::Internal::CustomActor* internal );
54 };
55
56 /**
57  * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
58  * This class does not override any of Internal::Control's behaviour.
59  */
60 class DummyControlImpl : public Internal::Control
61 {
62 public:
63
64   static DummyControl New();
65
66 public:
67   inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); }
68   inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); }
69   inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); }
70   inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); }
71   inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); }
72   inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); }
73
74   void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual);
75   void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled );
76   void UnregisterVisual( Property::Index index );
77   void EnableVisual( Property::Index index, bool enabled );
78   bool IsVisualEnabled( Property::Index indepx );
79
80   Toolkit::Visual::Base GetVisual( Property::Index index );
81   Animation CreateTransition( const Toolkit::TransitionData& transition );
82
83   // Used to test signal connections
84   void CustomSlot1( Actor actor );
85
86   bool mCustomSlot1Called;
87   typedef std::vector<Property::Index> VisualIndices;
88   VisualIndices mRegisteredVisualIndices;
89
90 protected:
91
92   DummyControlImpl();
93
94   virtual ~DummyControlImpl();
95 };
96
97 /**
98  * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
99  * This class DOES override Internal::Control's behaviour.
100  */
101 class DummyControlImplOverride : public DummyControlImpl
102 {
103 public:
104
105   static DummyControl New();
106
107 private:
108
109   DummyControlImplOverride();
110
111   virtual ~DummyControlImplOverride();
112
113 private: // From Internal::Control
114
115   virtual void OnInitialize();
116   virtual bool OnAccessibilityActivated();
117   virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
118   virtual bool OnAccessibilityValueChange( bool isIncrease );
119
120   virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
121   virtual void OnPinch(const PinchGesture& pinch);
122   virtual void OnPan(const PanGesture& pan);
123   virtual void OnTap(const TapGesture& tap);
124   virtual void OnLongPress(const LongPressGesture& longPress);
125
126 private: // From CustomActorImpl
127
128   virtual void OnStageConnection( int depth );
129   virtual void OnStageDisconnection();
130   virtual void OnChildAdd(Actor& child);
131   virtual void OnChildRemove(Actor& child);
132   virtual void OnSizeSet(const Vector3& targetSize);
133   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
134   virtual bool OnTouchEvent(const TouchEvent& event);
135   virtual bool OnHoverEvent(const HoverEvent& event);
136   virtual bool OnWheelEvent(const WheelEvent& event);
137   virtual bool OnKeyEvent(const KeyEvent& event);
138   virtual void OnKeyInputFocusGained();
139   virtual void OnKeyInputFocusLost();
140   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
141
142 public:
143
144   bool initializeCalled;
145   bool activatedCalled;
146   bool onAccTouchedCalled;
147   bool onAccValueChangeCalled;
148   bool themeChangeCalled;
149   bool fontChangeCalled;
150   bool pinchCalled;
151   bool panCalled;
152   bool tapCalled;
153   bool longPressCalled;
154   bool stageConnectionCalled;
155   bool stageDisconnectionCalled;
156   bool childAddCalled;
157   bool childRemoveCalled;
158   bool sizeSetCalled;
159   bool sizeAnimationCalled;
160   bool touchEventCalled;
161   bool hoverEventCalled;
162   bool wheelEventCalled;
163   bool keyEventCalled;
164   bool keyInputFocusGained;
165   bool keyInputFocusLost;
166 };
167
168 } // namespace Toolkit
169
170 } // namespace Dali
171
172 #endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__