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,
54 DummyControl(const DummyControl& control);
57 static DummyControl New( bool override = false );
59 static DummyControl DownCast( BaseHandle handle );
62 DummyControl& operator=(const DummyControl& control);
64 public: // Not intended for application developers
66 DummyControl( DummyControlImpl& implementation );
67 DummyControl( Dali::Internal::CustomActor* internal );
71 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
72 * This class does not override any of Internal::Control's behaviour.
74 class DummyControlImpl : public Toolkit::Internal::Control
78 static DummyControl New();
81 inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); }
82 inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); }
83 inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); }
84 inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); }
85 inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); }
86 inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); }
88 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual);
89 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled );
90 void UnregisterVisual( Property::Index index );
91 void EnableVisual( Property::Index index, bool enabled );
92 bool IsVisualEnabled( Property::Index indepx );
94 Toolkit::Visual::Base GetVisual( Property::Index index );
95 Animation CreateTransition( const Toolkit::TransitionData& transition );
97 static void SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
99 static Property::Value GetProperty( BaseObject* object, Dali::Property::Index propertyIndex );
101 // Used to test signal connections
102 void CustomSlot1( Actor actor );
104 bool mCustomSlot1Called;
105 typedef std::vector<Property::Index> VisualIndices;
106 VisualIndices mRegisteredVisualIndices;
112 virtual ~DummyControlImpl();
119 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
120 * This class DOES override Internal::Control's behaviour.
122 class DummyControl : public Toolkit::DummyControlImpl
126 static Toolkit::DummyControl New();
128 void SetLayout( Property::Index visualIndex, Property::Map& map );
134 virtual ~DummyControl();
136 private: // From Internal::Control
138 virtual void OnInitialize();
139 virtual bool OnAccessibilityActivated();
140 virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
141 virtual bool OnAccessibilityValueChange( bool isIncrease );
143 virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
144 virtual void OnPinch(const PinchGesture& pinch);
145 virtual void OnPan(const PanGesture& pan);
146 virtual void OnTap(const TapGesture& tap);
147 virtual void OnLongPress(const LongPressGesture& longPress);
149 private: // From CustomActorImpl
151 virtual void OnStageConnection( int depth );
152 virtual void OnStageDisconnection();
153 virtual void OnChildAdd(Actor& child);
154 virtual void OnChildRemove(Actor& child);
155 virtual void OnSizeSet(const Vector3& targetSize);
156 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
157 virtual bool OnTouchEvent(const TouchEvent& event);
158 virtual bool OnHoverEvent(const HoverEvent& event);
159 virtual bool OnWheelEvent(const WheelEvent& event);
160 virtual bool OnKeyEvent(const KeyEvent& event);
161 virtual void OnKeyInputFocusGained();
162 virtual void OnKeyInputFocusLost();
163 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
165 DALI_INTERNAL DummyControl( const DummyControl& );
166 DALI_INTERNAL DummyControl& operator=( const DummyControl& );
170 bool initializeCalled;
171 bool activatedCalled;
172 bool onAccTouchedCalled;
173 bool onAccValueChangeCalled;
174 bool themeChangeCalled;
175 bool fontChangeCalled;
179 bool longPressCalled;
180 bool stageConnectionCalled;
181 bool stageDisconnectionCalled;
183 bool childRemoveCalled;
185 bool sizeAnimationCalled;
186 bool touchEventCalled;
187 bool hoverEventCalled;
188 bool wheelEventCalled;
190 bool keyInputFocusGained;
191 bool keyInputFocusLost;
193 Property::Map mLayouts;
198 } // namespace Toolkit
202 #endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__