40dcf4fc8952ffa246d9e3a42e77c8e29d90ea72
[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 Flora License, Version 1.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://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <dali-toolkit/dali-toolkit.h>
22
23 namespace Dali
24 {
25
26 namespace Toolkit
27 {
28
29 class DummyControlImpl;
30
31 /**
32  * Control does not have a New method so use this dummy class for the handle.
33  */
34 class DummyControl : public Control
35 {
36 public:
37
38   DummyControl();
39   DummyControl(const DummyControl& control);
40   virtual ~DummyControl();
41
42   static DummyControl New( bool override = false );
43
44   static DummyControl DownCast( BaseHandle handle );
45
46
47   DummyControl& operator=(const DummyControl& control);
48
49   // Used to test signal connections
50   void CustomSlot1( Actor actor, const Vector3& value );
51
52 public:
53
54   bool mCustomSlot1Called;
55   Vector3 mCustomSlot1Value;
56
57 public: // Not intended for application developers
58
59   DummyControl( DummyControlImpl& implementation );
60   DummyControl( Dali::Internal::CustomActor* internal );
61 };
62
63 /**
64  * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
65  * This class does not override any of Internal::Control's behaviour.
66  */
67 class DummyControlImpl : public Internal::Control
68 {
69 public:
70
71   static DummyControl New();
72
73 public:
74   inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); }
75   inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); }
76   inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); }
77   inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); }
78   inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); }
79   inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); }
80
81 protected:
82
83   DummyControlImpl();
84
85   virtual ~DummyControlImpl();
86 };
87
88 /**
89  * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
90  * This class DOES override Internal::Control's behaviour.
91  */
92 class DummyControlImplOverride : public DummyControlImpl
93 {
94 public:
95
96   static DummyControl New();
97
98 private:
99
100   DummyControlImplOverride();
101
102   virtual ~DummyControlImplOverride();
103
104 private: // From Internal::Control
105
106   virtual void OnInitialize();
107   virtual void OnThemeChange( StyleManager styleManager );
108   virtual void OnFontChange(bool defaultFontChange, bool defaultFontSizeChange);
109   virtual void OnPinch(PinchGesture pinch);
110   virtual void OnPan(PanGesture pan);
111   virtual void OnTap(TapGesture tap);
112   virtual void OnLongPress(LongPressGesture longPress);
113
114 private: // From CustomActorImpl
115
116   virtual void OnStageConnection();
117   virtual void OnStageDisconnection();
118   virtual void OnChildAdd(Actor& child);
119   virtual void OnChildRemove(Actor& child);
120   virtual void OnSizeSet(const Vector3& targetSize);
121   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
122   virtual bool OnTouchEvent(const TouchEvent& event);
123   virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
124   virtual bool OnKeyEvent(const KeyEvent& event);
125   virtual void OnKeyInputFocusGained();
126   virtual void OnKeyInputFocusLost();
127
128 public:
129
130   bool initializeCalled;
131   bool themeChangeCalled;
132   bool fontChangeCalled;
133   bool pinchCalled;
134   bool panCalled;
135   bool tapCalled;
136   bool longPressCalled;
137   bool stageConnectionCalled;
138   bool stageDisconnectionCalled;
139   bool childAddCalled;
140   bool childRemoveCalled;
141   bool sizeSetCalled;
142   bool sizeAnimationCalled;
143   bool touchEventCalled;
144   bool mouseWheelEventCalled;
145   bool keyEventCalled;
146   bool keyInputFocusGained;
147   bool keyInputFocusLost;
148 };
149
150 } // namespace Toolkit
151
152 } // namespace Dali
153
154 #endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__