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"
26 DummyControl::DummyControl()
27 : mCustomSlot1Called(false)
31 DummyControl::DummyControl(const DummyControl& control)
33 mCustomSlot1Called(false),
34 mCustomSlot1Value(Vector3::ZERO)
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 DummyControl::CustomSlot1( Actor actor, const Vector3& value )
56 mCustomSlot1Called = true;
57 mCustomSlot1Value = value;
60 DummyControl DummyControlImpl::New()
62 IntrusivePtr< DummyControlImpl > impl = new DummyControlImpl;
63 DummyControl control( *impl );
68 DummyControlImpl::DummyControlImpl()
73 DummyControlImpl::~DummyControlImpl()
77 DummyControl DummyControlImplOverride::New()
79 IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
80 DummyControl control( *impl );
86 DummyControlImplOverride::DummyControlImplOverride()
88 initializeCalled(false),
89 styleChangeCalled(false),
93 longPressCalled(false),
94 stageConnectionCalled(false),
95 stageDisconnectionCalled(false),
96 childAddCalled(false),
97 childRemoveCalled(false),
99 sizeAnimationCalled(false),
100 touchEventCalled(false),
101 mouseWheelEventCalled(false),
102 keyEventCalled(false),
103 keyInputFocusGained(false),
104 keyInputFocusLost(false)
108 DummyControlImplOverride::~DummyControlImplOverride() { }
111 void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
112 void DummyControlImplOverride::OnStyleChange(StyleChange change) { styleChangeCalled = true;}
113 void DummyControlImplOverride::OnPinch(PinchGesture pinch) { pinchCalled = true; }
114 void DummyControlImplOverride::OnPan(PanGesture pan) { panCalled = true; }
115 void DummyControlImplOverride::OnTap(TapGesture tap) { tapCalled = true; }
116 void DummyControlImplOverride::OnLongPress(LongPressGesture longPress) { longPressCalled = true; }
117 void DummyControlImplOverride::OnStageConnection() { stageConnectionCalled = true; }
118 void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; }
119 void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; }
120 void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; }
121 void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; }
122 void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; }
123 bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
124 bool DummyControlImplOverride::OnMouseWheelEvent(const MouseWheelEvent& event) { mouseWheelEventCalled = true; return false; }
125 bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
126 void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; }
127 void DummyControlImplOverride::OnKeyInputFocusLost() { keyInputFocusLost = true; }
129 DummyControl DummyControl::New( bool override )
131 DummyControl control;
135 control = DummyControlImplOverride::New();
139 control = DummyControlImpl::New();
145 DummyControl::DummyControl( DummyControlImpl& implementation )
146 : Control( implementation ),
147 mCustomSlot1Called(false),
148 mCustomSlot1Value(Vector3::ZERO)
152 DummyControl::DummyControl( Dali::Internal::CustomActor* internal )
153 : Control( internal ),
154 mCustomSlot1Called(false),
155 mCustomSlot1Value(Vector3::ZERO)
157 VerifyCustomActorPointer<DummyControlImpl>(internal);
160 } // namespace Toolkit