2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
17 #include "dummy-control.h"
25 DummyControl::DummyControl()
26 : mCustomSlot1Called(false)
30 DummyControl::DummyControl(const DummyControl& control)
32 mCustomSlot1Called(false),
33 mCustomSlot1Value(Vector3::ZERO)
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 DummyControl::CustomSlot1( Actor actor, const Vector3& value )
55 mCustomSlot1Called = true;
56 mCustomSlot1Value = value;
59 DummyControl DummyControlImpl::New()
61 IntrusivePtr< DummyControlImpl > impl = new DummyControlImpl;
62 DummyControl control( *impl );
67 DummyControlImpl::DummyControlImpl()
72 DummyControlImpl::~DummyControlImpl()
76 DummyControl DummyControlImplOverride::New()
78 IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
79 DummyControl control( *impl );
85 DummyControlImplOverride::DummyControlImplOverride()
87 initializeCalled(false),
88 styleChangeCalled(false),
92 longPressCalled(false),
93 stageConnectionCalled(false),
94 stageDisconnectionCalled(false),
95 childAddCalled(false),
96 childRemoveCalled(false),
98 sizeAnimationCalled(false),
99 touchEventCalled(false),
100 mouseWheelEventCalled(false),
101 keyEventCalled(false),
102 keyInputFocusGained(false),
103 keyInputFocusLost(false)
107 DummyControlImplOverride::~DummyControlImplOverride() { }
110 void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
111 void DummyControlImplOverride::OnStyleChange(StyleChange change) { styleChangeCalled = true;}
112 void DummyControlImplOverride::OnPinch(PinchGesture pinch) { pinchCalled = true; }
113 void DummyControlImplOverride::OnPan(PanGesture pan) { panCalled = true; }
114 void DummyControlImplOverride::OnTap(TapGesture tap) { tapCalled = true; }
115 void DummyControlImplOverride::OnLongPress(LongPressGesture longPress) { longPressCalled = true; }
116 void DummyControlImplOverride::OnStageConnection() { stageConnectionCalled = true; }
117 void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; }
118 void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; }
119 void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; }
120 void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; }
121 void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; }
122 bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
123 bool DummyControlImplOverride::OnMouseWheelEvent(const MouseWheelEvent& event) { mouseWheelEventCalled = true; return false; }
124 bool DummyControlImplOverride::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
125 void DummyControlImplOverride::OnKeyInputFocusGained() { keyInputFocusGained = true; }
126 void DummyControlImplOverride::OnKeyInputFocusLost() { keyInputFocusLost = true; }
128 DummyControl DummyControl::New( bool override )
130 DummyControl control;
134 control = DummyControlImplOverride::New();
138 control = DummyControlImpl::New();
144 DummyControl::DummyControl( DummyControlImpl& implementation )
145 : Control( implementation ),
146 mCustomSlot1Called(false),
147 mCustomSlot1Value(Vector3::ZERO)
151 DummyControl::DummyControl( Dali::Internal::CustomActor* internal )
152 : Control( internal ),
153 mCustomSlot1Called(false),
154 mCustomSlot1Value(Vector3::ZERO)
156 VerifyCustomActorPointer<DummyControlImpl>(internal);
159 } // namespace Toolkit