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>
30 class DummyControlImpl;
39 * Control does not have a New method so use this dummy class for the handle.
41 class DummyControl : public Control
46 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
47 PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property index
54 TEST_VISUAL = PROPERTY_START_INDEX,
63 DummyControl(const DummyControl& control);
66 static DummyControl New( bool override = false );
68 static DummyControl DownCast( BaseHandle handle );
71 DummyControl& operator=(const DummyControl& control);
73 public: // Not intended for application developers
75 DummyControl( DummyControlImpl& implementation );
76 DummyControl( Dali::Internal::CustomActor* internal );
80 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
81 * This class does not override any of Internal::Control's behaviour.
83 class DummyControlImpl : public Toolkit::Internal::Control
87 static DummyControl New();
90 inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); }
91 inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); }
92 inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); }
93 inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); }
94 inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); }
95 inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); }
97 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual);
98 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled );
99 void UnregisterVisual( Property::Index index );
100 void EnableVisual( Property::Index index, bool enabled );
101 bool IsVisualEnabled( Property::Index index );
102 int GetVisualCount();
103 Toolkit::Visual::Base GetVisual( Property::Index index );
104 Animation CreateTransition( const Toolkit::TransitionData& transition );
106 static void SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
108 static Property::Value GetProperty( BaseObject* object, Dali::Property::Index propertyIndex );
110 // Used to test signal connections
111 void CustomSlot1( Actor actor );
113 bool mCustomSlot1Called;
114 typedef std::vector<Property::Index> VisualIndices;
115 VisualIndices mRegisteredVisualIndices;
121 virtual ~DummyControlImpl();
128 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
129 * This class DOES override Internal::Control's behaviour.
131 class DummyControl : public Toolkit::DummyControlImpl
135 static Toolkit::DummyControl New();
137 void SetLayout( Property::Index visualIndex, Property::Map& map );
143 virtual ~DummyControl();
145 private: // From Internal::Control
147 virtual void OnInitialize();
148 virtual bool OnAccessibilityActivated();
149 virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
150 virtual bool OnAccessibilityValueChange( bool isIncrease );
152 virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
153 virtual void OnPinch(const PinchGesture& pinch);
154 virtual void OnPan(const PanGesture& pan);
155 virtual void OnTap(const TapGesture& tap);
156 virtual void OnLongPress(const LongPressGesture& longPress);
158 private: // From CustomActorImpl
160 virtual void OnStageConnection( int depth );
161 virtual void OnStageDisconnection();
162 virtual void OnChildAdd(Actor& child);
163 virtual void OnChildRemove(Actor& child);
164 virtual void OnSizeSet(const Vector3& targetSize);
165 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
166 virtual bool OnTouchEvent(const TouchEvent& event);
167 virtual bool OnHoverEvent(const HoverEvent& event);
168 virtual bool OnWheelEvent(const WheelEvent& event);
169 virtual bool OnKeyEvent(const KeyEvent& event);
170 virtual void OnKeyInputFocusGained();
171 virtual void OnKeyInputFocusLost();
172 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
174 DALI_INTERNAL DummyControl( const DummyControl& );
175 DALI_INTERNAL DummyControl& operator=( const DummyControl& );
179 bool initializeCalled;
180 bool activatedCalled;
181 bool onAccTouchedCalled;
182 bool onAccValueChangeCalled;
183 bool themeChangeCalled;
184 bool fontChangeCalled;
188 bool longPressCalled;
189 bool stageConnectionCalled;
190 bool stageDisconnectionCalled;
192 bool childRemoveCalled;
194 bool sizeAnimationCalled;
195 bool touchEventCalled;
196 bool hoverEventCalled;
197 bool wheelEventCalled;
199 bool keyInputFocusGained;
200 bool keyInputFocusLost;
202 Property::Map mLayouts;
207 } // namespace Toolkit
211 #endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__