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,
57 DummyControl(const DummyControl& control);
60 static DummyControl New( bool override = false );
62 static DummyControl DownCast( BaseHandle handle );
65 DummyControl& operator=(const DummyControl& control);
67 public: // Not intended for application developers
69 DummyControl( DummyControlImpl& implementation );
70 DummyControl( Dali::Internal::CustomActor* internal );
74 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
75 * This class does not override any of Internal::Control's behaviour.
77 class DummyControlImpl : public Toolkit::Internal::Control
81 static DummyControl New();
84 inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); }
85 inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); }
86 inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); }
87 inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); }
88 inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); }
89 inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); }
91 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual);
92 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled );
93 void UnregisterVisual( Property::Index index );
94 void EnableVisual( Property::Index index, bool enabled );
95 bool IsVisualEnabled( Property::Index index );
97 Toolkit::Visual::Base GetVisual( Property::Index index );
98 Animation CreateTransition( const Toolkit::TransitionData& transition );
100 static void SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
102 static Property::Value GetProperty( BaseObject* object, Dali::Property::Index propertyIndex );
104 // Used to test signal connections
105 void CustomSlot1( Actor actor );
107 bool mCustomSlot1Called;
108 typedef std::vector<Property::Index> VisualIndices;
109 VisualIndices mRegisteredVisualIndices;
115 virtual ~DummyControlImpl();
122 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
123 * This class DOES override Internal::Control's behaviour.
125 class DummyControl : public Toolkit::DummyControlImpl
129 static Toolkit::DummyControl New();
131 void SetLayout( Property::Index visualIndex, Property::Map& map );
137 virtual ~DummyControl();
139 private: // From Internal::Control
141 virtual void OnInitialize();
142 virtual bool OnAccessibilityActivated();
143 virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
144 virtual bool OnAccessibilityValueChange( bool isIncrease );
146 virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
147 virtual void OnPinch(const PinchGesture& pinch);
148 virtual void OnPan(const PanGesture& pan);
149 virtual void OnTap(const TapGesture& tap);
150 virtual void OnLongPress(const LongPressGesture& longPress);
152 private: // From CustomActorImpl
154 virtual void OnStageConnection( int depth );
155 virtual void OnStageDisconnection();
156 virtual void OnChildAdd(Actor& child);
157 virtual void OnChildRemove(Actor& child);
158 virtual void OnSizeSet(const Vector3& targetSize);
159 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
160 virtual bool OnTouchEvent(const TouchEvent& event);
161 virtual bool OnHoverEvent(const HoverEvent& event);
162 virtual bool OnWheelEvent(const WheelEvent& event);
163 virtual bool OnKeyEvent(const KeyEvent& event);
164 virtual void OnKeyInputFocusGained();
165 virtual void OnKeyInputFocusLost();
166 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
168 DALI_INTERNAL DummyControl( const DummyControl& );
169 DALI_INTERNAL DummyControl& operator=( const DummyControl& );
173 bool initializeCalled;
174 bool activatedCalled;
175 bool onAccTouchedCalled;
176 bool onAccValueChangeCalled;
177 bool themeChangeCalled;
178 bool fontChangeCalled;
182 bool longPressCalled;
183 bool stageConnectionCalled;
184 bool stageDisconnectionCalled;
186 bool childRemoveCalled;
188 bool sizeAnimationCalled;
189 bool touchEventCalled;
190 bool hoverEventCalled;
191 bool wheelEventCalled;
193 bool keyInputFocusGained;
194 bool keyInputFocusLost;
196 Property::Map mLayouts;
201 } // namespace Toolkit
205 #endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__