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/devel-api/styling/style-manager.h>
28 DummyControl::DummyControl()
32 DummyControl::DummyControl(const DummyControl& control)
37 DummyControl::~DummyControl()
41 DummyControl DummyControl::DownCast( BaseHandle handle )
43 return Control::DownCast<DummyControl, DummyControlImpl>(handle);
46 DummyControl& DummyControl::operator=(const DummyControl& control)
48 Control::operator=( control );
52 // Used to test signal connections
53 void DummyControlImpl::CustomSlot1( Actor actor )
55 mCustomSlot1Called = true;
58 DummyControl DummyControlImpl::New()
60 IntrusivePtr< DummyControlImpl > impl = new DummyControlImpl;
61 DummyControl control( *impl );
66 DummyControlImpl::DummyControlImpl()
67 : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_HOVER_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
68 mCustomSlot1Called(false)
73 DummyControlImpl::~DummyControlImpl()
77 DummyControl DummyControlImplOverride::New()
79 IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
80 DummyControl control( *impl );
86 DummyControlImplOverride::DummyControlImplOverride()
88 initializeCalled(false),
89 activatedCalled(false),
90 themeChangeCalled( false ),
91 fontChangeCalled( false ),
95 longPressCalled(false),
96 stageConnectionCalled(false),
97 stageDisconnectionCalled(false),
98 childAddCalled(false),
99 childRemoveCalled(false),
100 sizeSetCalled(false),
101 sizeAnimationCalled(false),
102 touchEventCalled(false),
103 hoverEventCalled(false),
104 wheelEventCalled(false),
105 keyEventCalled(false),
106 keyInputFocusGained(false),
107 keyInputFocusLost(false)
111 DummyControlImplOverride::~DummyControlImplOverride() { }
114 void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
115 bool DummyControlImplOverride::OnAccessibilityActivated() { activatedCalled = true; return true; }
116 void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
118 themeChangeCalled = change == StyleChange::THEME_CHANGE;
119 fontChangeCalled = change == StyleChange::DEFAULT_FONT_SIZE_CHANGE;
121 void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled = true; }
122 void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; }
123 void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; }
124 void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; }
125 void DummyControlImplOverride::OnStageConnection( int depth ) { stageConnectionCalled = true; }
126 void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; }
127 void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; }
128 void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; }
129 void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; }
130 void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; }
131 bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
132 bool DummyControlImplOverride::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; }
133 bool DummyControlImplOverride::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; }
134 bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
135 void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; }
136 void DummyControlImplOverride::OnKeyInputFocusLost() { keyInputFocusLost = true; }
138 DummyControl DummyControl::New( bool override )
140 DummyControl control;
144 control = DummyControlImplOverride::New();
148 control = DummyControlImpl::New();
154 DummyControl::DummyControl( DummyControlImpl& implementation )
155 : Control( implementation )
159 DummyControl::DummyControl( Dali::Internal::CustomActor* internal )
160 : Control( internal )
162 VerifyCustomActorPointer<DummyControlImpl>(internal);
165 } // namespace Toolkit