1 #ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
2 #define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali-toolkit/dali-toolkit.h>
30 class DummyControlImpl;
33 * Control does not have a New method so use this dummy class for the handle.
35 class DummyControl : public Control
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
48 TEST_VISUAL = PROPERTY_START_INDEX,
56 DummyControl(const DummyControl& control);
59 static DummyControl New( bool override = false );
61 static DummyControl DownCast( BaseHandle handle );
64 DummyControl& operator=(const DummyControl& control);
66 public: // Not intended for application developers
68 DummyControl( DummyControlImpl& implementation );
69 DummyControl( Dali::Internal::CustomActor* internal );
73 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
74 * This class does not override any of Internal::Control's behaviour.
76 class DummyControlImpl : public Toolkit::Internal::Control
80 static DummyControl New();
83 inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); }
84 inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); }
85 inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); }
86 inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); }
87 inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); }
88 inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); }
90 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual);
91 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled );
92 void UnregisterVisual( Property::Index index );
93 void EnableVisual( Property::Index index, bool enabled );
94 bool IsVisualEnabled( Property::Index index );
96 Toolkit::Visual::Base GetVisual( Property::Index index );
97 Animation CreateTransition( const Toolkit::TransitionData& transition );
99 static void SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
101 static Property::Value GetProperty( BaseObject* object, Dali::Property::Index propertyIndex );
103 // Used to test signal connections
104 void CustomSlot1( Actor actor );
106 bool mCustomSlot1Called;
107 typedef std::vector<Property::Index> VisualIndices;
108 VisualIndices mRegisteredVisualIndices;
114 virtual ~DummyControlImpl();
121 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
122 * This class DOES override Internal::Control's behaviour.
124 class DummyControl : public Toolkit::DummyControlImpl
128 static Toolkit::DummyControl New();
130 void SetLayout( Property::Index visualIndex, Property::Map& map );
136 virtual ~DummyControl();
138 private: // From Internal::Control
140 virtual void OnInitialize();
141 virtual bool OnAccessibilityActivated();
142 virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
143 virtual bool OnAccessibilityValueChange( bool isIncrease );
145 virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
146 virtual void OnPinch(const PinchGesture& pinch);
147 virtual void OnPan(const PanGesture& pan);
148 virtual void OnTap(const TapGesture& tap);
149 virtual void OnLongPress(const LongPressGesture& longPress);
151 private: // From CustomActorImpl
153 virtual void OnStageConnection( int depth );
154 virtual void OnStageDisconnection();
155 virtual void OnChildAdd(Actor& child);
156 virtual void OnChildRemove(Actor& child);
157 virtual void OnSizeSet(const Vector3& targetSize);
158 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
159 virtual bool OnTouchEvent(const TouchEvent& event);
160 virtual bool OnHoverEvent(const HoverEvent& event);
161 virtual bool OnWheelEvent(const WheelEvent& event);
162 virtual bool OnKeyEvent(const KeyEvent& event);
163 virtual void OnKeyInputFocusGained();
164 virtual void OnKeyInputFocusLost();
165 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
167 DALI_INTERNAL DummyControl( const DummyControl& );
168 DALI_INTERNAL DummyControl& operator=( const DummyControl& );
172 bool initializeCalled;
173 bool activatedCalled;
174 bool onAccTouchedCalled;
175 bool onAccValueChangeCalled;
176 bool themeChangeCalled;
177 bool fontChangeCalled;
181 bool longPressCalled;
182 bool stageConnectionCalled;
183 bool stageDisconnectionCalled;
185 bool childRemoveCalled;
187 bool sizeAnimationCalled;
188 bool touchEventCalled;
189 bool hoverEventCalled;
190 bool wheelEventCalled;
192 bool keyInputFocusGained;
193 bool keyInputFocusLost;
195 Property::Map mLayouts;
200 } // namespace Toolkit
204 #endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__