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)
74 DummyControlImpl::~DummyControlImpl()
78 void DummyControlImpl::RegisterVisual( Property::Index index, Actor placementActor, Toolkit::Visual::Base visual )
80 Control::RegisterVisual( index, placementActor, visual );
83 void DummyControlImpl::UnregisterVisual( Property::Index index )
85 Control::UnregisterVisual( index );
88 DummyControl DummyControlImplOverride::New()
90 IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
91 DummyControl control( *impl );
97 DummyControlImplOverride::DummyControlImplOverride()
99 initializeCalled(false),
100 activatedCalled(false),
101 onAccTouchedCalled(false),
102 onAccValueChangeCalled(false),
103 themeChangeCalled(false),
104 fontChangeCalled(false),
108 longPressCalled(false),
109 stageConnectionCalled(false),
110 stageDisconnectionCalled(false),
111 childAddCalled(false),
112 childRemoveCalled(false),
113 sizeSetCalled(false),
114 sizeAnimationCalled(false),
115 touchEventCalled(false),
116 hoverEventCalled(false),
117 wheelEventCalled(false),
118 keyEventCalled(false),
119 keyInputFocusGained(false),
120 keyInputFocusLost(false)
124 DummyControlImplOverride::~DummyControlImplOverride() { }
127 void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
128 bool DummyControlImplOverride::OnAccessibilityActivated() { activatedCalled = true; return true; }
129 bool DummyControlImplOverride::OnAccessibilityTouch(const TouchEvent& touchEvent) { onAccTouchedCalled = true; return true; }
130 bool DummyControlImplOverride::OnAccessibilityValueChange( bool isIncrease )
132 onAccValueChangeCalled = true; return true;
135 void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
137 themeChangeCalled = change == StyleChange::THEME_CHANGE;
138 fontChangeCalled = change == StyleChange::DEFAULT_FONT_SIZE_CHANGE;
140 void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled = true; }
141 void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; }
142 void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; }
143 void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; }
144 void DummyControlImplOverride::OnStageConnection( int depth ) { Control::OnStageConnection( depth ); stageConnectionCalled = true; }
145 void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; Control::OnStageDisconnection(); }
146 void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; }
147 void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; }
148 void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; }
149 void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; }
150 bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
151 bool DummyControlImplOverride::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; }
152 bool DummyControlImplOverride::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; }
153 bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
154 void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; }
155 void DummyControlImplOverride::OnKeyInputFocusLost() { keyInputFocusLost = true; }
157 DummyControl DummyControl::New( bool override )
159 DummyControl control;
163 control = DummyControlImplOverride::New();
167 control = DummyControlImpl::New();
173 DummyControl::DummyControl( DummyControlImpl& implementation )
174 : Control( implementation )
178 DummyControl::DummyControl( Dali::Internal::CustomActor* internal )
179 : Control( internal )
181 VerifyCustomActorPointer<DummyControlImpl>(internal);
184 } // namespace Toolkit