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
53 DummyControl(const DummyControl& control);
56 static DummyControl New( bool override = false );
58 static DummyControl DownCast( BaseHandle handle );
61 DummyControl& operator=(const DummyControl& control);
63 public: // Not intended for application developers
65 DummyControl( DummyControlImpl& implementation );
66 DummyControl( Dali::Internal::CustomActor* internal );
70 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
71 * This class does not override any of Internal::Control's behaviour.
73 class DummyControlImpl : public Internal::Control
77 static DummyControl New();
80 inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); }
81 inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); }
82 inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); }
83 inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); }
84 inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); }
85 inline LongPressGestureDetector GetLongPressGestureDetector() const { return Internal::Control::GetLongPressGestureDetector(); }
87 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual);
88 void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled );
89 void UnregisterVisual( Property::Index index );
90 void EnableVisual( Property::Index index, bool enabled );
91 bool IsVisualEnabled( Property::Index indepx );
93 Toolkit::Visual::Base GetVisual( Property::Index index );
94 Animation CreateTransition( const Toolkit::TransitionData& transition );
96 static void SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
98 static Property::Value GetProperty( BaseObject* object, Dali::Property::Index propertyIndex );
100 // Used to test signal connections
101 void CustomSlot1( Actor actor );
103 bool mCustomSlot1Called;
104 typedef std::vector<Property::Index> VisualIndices;
105 VisualIndices mRegisteredVisualIndices;
111 virtual ~DummyControlImpl();
115 * Cannot create an instance of Internal::Control, so use this dummy class for the implementation.
116 * This class DOES override Internal::Control's behaviour.
118 class DummyControlImplOverride : public DummyControlImpl
122 static DummyControl New();
126 DummyControlImplOverride();
128 virtual ~DummyControlImplOverride();
130 private: // From Internal::Control
132 virtual void OnInitialize();
133 virtual bool OnAccessibilityActivated();
134 virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
135 virtual bool OnAccessibilityValueChange( bool isIncrease );
137 virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
138 virtual void OnPinch(const PinchGesture& pinch);
139 virtual void OnPan(const PanGesture& pan);
140 virtual void OnTap(const TapGesture& tap);
141 virtual void OnLongPress(const LongPressGesture& longPress);
143 private: // From CustomActorImpl
145 virtual void OnStageConnection( int depth );
146 virtual void OnStageDisconnection();
147 virtual void OnChildAdd(Actor& child);
148 virtual void OnChildRemove(Actor& child);
149 virtual void OnSizeSet(const Vector3& targetSize);
150 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
151 virtual bool OnTouchEvent(const TouchEvent& event);
152 virtual bool OnHoverEvent(const HoverEvent& event);
153 virtual bool OnWheelEvent(const WheelEvent& event);
154 virtual bool OnKeyEvent(const KeyEvent& event);
155 virtual void OnKeyInputFocusGained();
156 virtual void OnKeyInputFocusLost();
157 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
161 bool initializeCalled;
162 bool activatedCalled;
163 bool onAccTouchedCalled;
164 bool onAccValueChangeCalled;
165 bool themeChangeCalled;
166 bool fontChangeCalled;
170 bool longPressCalled;
171 bool stageConnectionCalled;
172 bool stageDisconnectionCalled;
174 bool childRemoveCalled;
176 bool sizeAnimationCalled;
177 bool touchEventCalled;
178 bool hoverEventCalled;
179 bool wheelEventCalled;
181 bool keyInputFocusGained;
182 bool keyInputFocusLost;
185 } // namespace Toolkit
189 #endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__