96f10b24edc0bb08e95ffc30f92d78d16191ca75
[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   ~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   // Used to test signal connections
75   void CustomSlot1( Actor actor, const Vector3& value );
76
77   bool mCustomSlot1Called;
78   Vector3 mCustomSlot1Value;
79
80 protected:
81
82   DummyControlImpl();
83
84   virtual ~DummyControlImpl();
85 };
86
87 /**
88  * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
89  * This class DOES override Internal::Control's behaviour.
90  */
91 class DummyControlImplOverride : public DummyControlImpl
92 {
93 public:
94
95   static DummyControl New();
96
97 private:
98
99   DummyControlImplOverride();
100
101   virtual ~DummyControlImplOverride();
102
103 private: // From Internal::Control
104
105   virtual void OnInitialize();
106   virtual void OnThemeChange( StyleManager styleManager );
107   virtual void OnFontChange(bool defaultFontChange, bool defaultFontSizeChange);
108   virtual void OnPinch(const PinchGesture& pinch);
109   virtual void OnPan(const PanGesture& pan);
110   virtual void OnTap(const TapGesture& tap);
111   virtual void OnLongPress(const LongPressGesture& longPress);
112
113 private: // From CustomActorImpl
114
115   virtual void OnStageConnection();
116   virtual void OnStageDisconnection();
117   virtual void OnChildAdd(Actor& child);
118   virtual void OnChildRemove(Actor& child);
119   virtual void OnSizeSet(const Vector3& targetSize);
120   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
121   virtual bool OnTouchEvent(const TouchEvent& event);
122   virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
123   virtual bool OnKeyEvent(const KeyEvent& event);
124   virtual void OnKeyInputFocusGained();
125   virtual void OnKeyInputFocusLost();
126
127 public:
128
129   bool initializeCalled;
130   bool themeChangeCalled;
131   bool fontChangeCalled;
132   bool pinchCalled;
133   bool panCalled;
134   bool tapCalled;
135   bool longPressCalled;
136   bool stageConnectionCalled;
137   bool stageDisconnectionCalled;
138   bool childAddCalled;
139   bool childRemoveCalled;
140   bool sizeSetCalled;
141   bool sizeAnimationCalled;
142   bool touchEventCalled;
143   bool mouseWheelEventCalled;
144   bool keyEventCalled;
145   bool keyInputFocusGained;
146   bool keyInputFocusLost;
147 };
148
149 } // namespace Toolkit
150
151 } // namespace Dali
152
153 #endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__