1 #ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
2 #define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
5 * Copyright (c) 2017 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>
33 class DummyControlImpl;
42 * Control does not have a New method so use this dummy class for the handle.
44 class DummyControl : public Control
49 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
50 PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property index
57 TEST_VISUAL = PROPERTY_START_INDEX,
66 DummyControl(const DummyControl& control);
69 static DummyControl New( bool override = false );
71 static DummyControl DownCast( BaseHandle handle );
74 DummyControl& operator=(const DummyControl& control);
76 public: // Not intended for application developers
78 DummyControl( DummyControlImpl& implementation );
79 DummyControl( Dali::Internal::CustomActor* internal );
83 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
84 * This class does not override any of Internal::Control's behaviour.
86 class DummyControlImpl : public Toolkit::Internal::Control
90 static DummyControl New();
93 inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); }
94 inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); }
95 inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); }
96 inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); }
97 inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); }
98 inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); }
100 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual);
101 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled );
102 void UnregisterVisual( Property::Index index );
103 void EnableVisual( Property::Index index, bool enabled );
104 bool IsVisualEnabled( Property::Index index );
105 int GetVisualCount();
106 Toolkit::Visual::Base GetVisual( Property::Index index );
107 Animation CreateTransition( const Toolkit::TransitionData& transition );
109 static void SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
111 static Property::Value GetProperty( BaseObject* object, Dali::Property::Index propertyIndex );
113 // Used to test signal connections
114 void CustomSlot1( Actor actor );
116 bool mCustomSlot1Called;
117 typedef std::vector<Property::Index> VisualIndices;
118 VisualIndices mRegisteredVisualIndices;
124 virtual ~DummyControlImpl();
131 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
132 * This class DOES override Internal::Control's behaviour.
134 class DummyControl : public Toolkit::DummyControlImpl
138 typedef std::function<void( Size )> RelayoutCallbackFunc;
140 static Toolkit::DummyControl New();
142 void SetLayout( Property::Index visualIndex, Property::Map& map );
144 void SetRelayoutCallback( RelayoutCallbackFunc callback );
150 virtual ~DummyControl();
152 private: // From Internal::Control
154 virtual void OnInitialize();
155 virtual bool OnAccessibilityActivated();
156 virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
157 virtual bool OnAccessibilityValueChange( bool isIncrease );
159 virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
160 virtual void OnPinch(const PinchGesture& pinch);
161 virtual void OnPan(const PanGesture& pan);
162 virtual void OnTap(const TapGesture& tap);
163 virtual void OnLongPress(const LongPressGesture& longPress);
165 private: // From CustomActorImpl
167 virtual void OnStageConnection( int depth );
168 virtual void OnStageDisconnection();
169 virtual void OnChildAdd(Actor& child);
170 virtual void OnChildRemove(Actor& child);
171 virtual void OnSizeSet(const Vector3& targetSize);
172 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
173 virtual bool OnTouchEvent(const TouchEvent& event);
174 virtual bool OnHoverEvent(const HoverEvent& event);
175 virtual bool OnWheelEvent(const WheelEvent& event);
176 virtual bool OnKeyEvent(const KeyEvent& event);
177 virtual void OnKeyInputFocusGained();
178 virtual void OnKeyInputFocusLost();
179 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
181 DALI_INTERNAL DummyControl( const DummyControl& );
182 DALI_INTERNAL DummyControl& operator=( const DummyControl& );
186 bool initializeCalled;
187 bool activatedCalled;
188 bool onAccTouchedCalled;
189 bool onAccValueChangeCalled;
190 bool themeChangeCalled;
191 bool fontChangeCalled;
195 bool longPressCalled;
196 bool stageConnectionCalled;
197 bool stageDisconnectionCalled;
199 bool childRemoveCalled;
201 bool sizeAnimationCalled;
202 bool touchEventCalled;
203 bool hoverEventCalled;
204 bool wheelEventCalled;
206 bool keyInputFocusGained;
207 bool keyInputFocusLost;
209 Property::Map mLayouts;
210 RelayoutCallbackFunc mRelayoutCallback;
216 } // namespace Toolkit
220 #endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__