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, Toolkit::Visual::Base visual )
79 Control::RegisterVisual( index, visual );
82 void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled )
84 Control::RegisterVisual( index, 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 Animation DummyControlImpl::CreateTransition( const Toolkit::TransitionData& transition )
109 return Control::CreateTransition( transition );
112 DummyControl DummyControlImplOverride::New()
114 IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
115 DummyControl control( *impl );
121 DummyControlImplOverride::DummyControlImplOverride()
122 : DummyControlImpl(),
123 initializeCalled(false),
124 activatedCalled(false),
125 onAccTouchedCalled(false),
126 onAccValueChangeCalled(false),
127 themeChangeCalled(false),
128 fontChangeCalled(false),
132 longPressCalled(false),
133 stageConnectionCalled(false),
134 stageDisconnectionCalled(false),
135 childAddCalled(false),
136 childRemoveCalled(false),
137 sizeSetCalled(false),
138 sizeAnimationCalled(false),
139 touchEventCalled(false),
140 hoverEventCalled(false),
141 wheelEventCalled(false),
142 keyEventCalled(false),
143 keyInputFocusGained(false),
144 keyInputFocusLost(false)
148 DummyControlImplOverride::~DummyControlImplOverride() { }
151 void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
152 bool DummyControlImplOverride::OnAccessibilityActivated() { activatedCalled = true; return true; }
153 bool DummyControlImplOverride::OnAccessibilityTouch(const TouchEvent& touchEvent) { onAccTouchedCalled = true; return true; }
154 bool DummyControlImplOverride::OnAccessibilityValueChange( bool isIncrease )
156 onAccValueChangeCalled = true; return true;
159 void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
161 themeChangeCalled = change == StyleChange::THEME_CHANGE;
162 fontChangeCalled = change == StyleChange::DEFAULT_FONT_SIZE_CHANGE;
164 void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled = true; }
165 void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; }
166 void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; }
167 void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; }
168 void DummyControlImplOverride::OnStageConnection( int depth ) { Control::OnStageConnection( depth ); stageConnectionCalled = true; }
169 void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; Control::OnStageDisconnection(); }
170 void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; }
171 void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; }
172 void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; }
173 void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; }
174 bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
175 bool DummyControlImplOverride::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; }
176 bool DummyControlImplOverride::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; }
177 bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
178 void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; }
179 void DummyControlImplOverride::OnKeyInputFocusLost() { keyInputFocusLost = true; }
181 DummyControl DummyControl::New( bool override )
183 DummyControl control;
187 control = DummyControlImplOverride::New();
191 control = DummyControlImpl::New();
197 DummyControl::DummyControl( DummyControlImpl& implementation )
198 : Control( implementation )
202 DummyControl::DummyControl( Dali::Internal::CustomActor* internal )
203 : Control( internal )
205 VerifyCustomActorPointer<DummyControlImpl>(internal);
208 } // namespace Toolkit