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