2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "dummy-control.h"
20 #include <dali-toolkit/dali-toolkit.h>
21 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
29 DummyControl::DummyControl()
33 DummyControl::DummyControl(const DummyControl& control)
38 DummyControl::~DummyControl()
42 DummyControl DummyControl::DownCast( BaseHandle handle )
44 return Control::DownCast<DummyControl, DummyControlImpl>(handle);
47 DummyControl& DummyControl::operator=(const DummyControl& control)
49 Control::operator=( control );
53 // Used to test signal connections
54 void DummyControlImpl::CustomSlot1( Actor actor )
56 mCustomSlot1Called = true;
59 DummyControl DummyControlImpl::New()
61 IntrusivePtr< DummyControlImpl > impl = new DummyControlImpl;
62 DummyControl control( *impl );
67 DummyControlImpl::DummyControlImpl()
68 : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_HOVER_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
69 mCustomSlot1Called(false)
73 DummyControlImpl::~DummyControlImpl()
77 void DummyControlImpl::RegisterVisual( Property::Index index, Actor placementActor, Toolkit::Visual::Base visual )
79 Control::RegisterVisual( index, placementActor, visual );
82 void DummyControlImpl::RegisterVisual( Property::Index index, Actor placementActor, Toolkit::Visual::Base visual, bool enabled )
84 Control::RegisterVisual( index, placementActor, visual, enabled );
87 void DummyControlImpl::UnregisterVisual( Property::Index index )
89 Control::UnregisterVisual( index );
92 Toolkit::Visual::Base DummyControlImpl::GetVisual( Property::Index index )
94 return Control::GetVisual( index );
97 void DummyControlImpl::EnableVisual( Property::Index index, bool enabled )
99 Control::EnableVisual( index, enabled );
102 bool DummyControlImpl::IsVisualEnabled( Property::Index index )
104 return Control::IsVisualEnabled( index );
107 Actor DummyControlImpl::GetPlacementActor( Property::Index index )
109 return Control::GetPlacementActor( index );
112 Animation DummyControlImpl::CreateTransition( const Toolkit::TransitionData& transition )
114 return Control::CreateTransition( transition );
117 DummyControl DummyControlImplOverride::New()
119 IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
120 DummyControl control( *impl );
126 DummyControlImplOverride::DummyControlImplOverride()
127 : DummyControlImpl(),
128 initializeCalled(false),
129 activatedCalled(false),
130 onAccTouchedCalled(false),
131 onAccValueChangeCalled(false),
132 themeChangeCalled(false),
133 fontChangeCalled(false),
137 longPressCalled(false),
138 stageConnectionCalled(false),
139 stageDisconnectionCalled(false),
140 childAddCalled(false),
141 childRemoveCalled(false),
142 sizeSetCalled(false),
143 sizeAnimationCalled(false),
144 touchEventCalled(false),
145 hoverEventCalled(false),
146 wheelEventCalled(false),
147 keyEventCalled(false),
148 keyInputFocusGained(false),
149 keyInputFocusLost(false)
153 DummyControlImplOverride::~DummyControlImplOverride() { }
156 void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
157 bool DummyControlImplOverride::OnAccessibilityActivated() { activatedCalled = true; return true; }
158 bool DummyControlImplOverride::OnAccessibilityTouch(const TouchEvent& touchEvent) { onAccTouchedCalled = true; return true; }
159 bool DummyControlImplOverride::OnAccessibilityValueChange( bool isIncrease )
161 onAccValueChangeCalled = true; return true;
164 void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
166 themeChangeCalled = change == StyleChange::THEME_CHANGE;
167 fontChangeCalled = change == StyleChange::DEFAULT_FONT_SIZE_CHANGE;
169 void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled = true; }
170 void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; }
171 void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; }
172 void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; }
173 void DummyControlImplOverride::OnStageConnection( int depth ) { Control::OnStageConnection( depth ); stageConnectionCalled = true; }
174 void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; Control::OnStageDisconnection(); }
175 void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; }
176 void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; }
177 void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; }
178 void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; }
179 bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
180 bool DummyControlImplOverride::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; }
181 bool DummyControlImplOverride::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; }
182 bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
183 void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; }
184 void DummyControlImplOverride::OnKeyInputFocusLost() { keyInputFocusLost = true; }
186 DummyControl DummyControl::New( bool override )
188 DummyControl control;
192 control = DummyControlImplOverride::New();
196 control = DummyControlImpl::New();
202 DummyControl::DummyControl( DummyControlImpl& implementation )
203 : Control( implementation )
207 DummyControl::DummyControl( Dali::Internal::CustomActor* internal )
208 : Control( internal )
210 VerifyCustomActorPointer<DummyControlImpl>(internal);
213 } // namespace Toolkit