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 <dali-toolkit/public-api/controls/control.h>
18 #include <dali-toolkit/public-api/controls/control-impl.h>
26 const char* const Control::ACTION_CONTROL_ACTIVATED = "control-activated";
27 const char* const Control::SIGNAL_KEY_EVENT = "key-event";
29 Control Control::New()
31 return ControlImpl::New();
38 Control::Control(const Control& uiControl)
39 : CustomActor( uiControl ? static_cast<const ControlImpl&>( uiControl.GetImplementation() ).GetOwner() : NULL)
47 Control& Control::operator=( const Control& handle )
51 CustomActor::operator=( handle );
56 Control Control::DownCast( BaseHandle handle )
58 return DownCast<Control, ControlImpl>(handle);
61 ControlImpl& Control::GetImplementation()
63 return static_cast<ControlImpl&>(CustomActor::GetImplementation());
66 const ControlImpl& Control::GetImplementation() const
68 return static_cast<const ControlImpl&>(CustomActor::GetImplementation());
71 void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy )
73 GetImplementation().SetSizePolicy( widthPolicy, heightPolicy );
76 void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const
78 GetImplementation().GetSizePolicy( widthPolicy, heightPolicy );
81 void Control::SetMinimumSize( const Vector3& size )
83 GetImplementation().SetMinimumSize( size );
86 const Vector3& Control::GetMinimumSize() const
88 return GetImplementation().GetMinimumSize();
91 void Control::SetMaximumSize( const Vector3& size )
93 GetImplementation().SetMaximumSize( size );
96 const Vector3& Control::GetMaximumSize() const
98 return GetImplementation().GetMaximumSize();
101 Vector3 Control::GetNaturalSize()
103 return GetImplementation().GetNaturalSize();
106 float Control::GetHeightForWidth( float width )
108 return GetImplementation().GetHeightForWidth( width );
111 float Control::GetWidthForHeight( float height )
113 return GetImplementation().GetWidthForHeight( height );
116 void Control::SetKeyInputFocus()
118 GetImplementation().SetKeyInputFocus();
121 bool Control::HasKeyInputFocus()
123 return GetImplementation().HasKeyInputFocus();
126 void Control::ClearKeyInputFocus()
128 GetImplementation().ClearKeyInputFocus();
131 PinchGestureDetector Control::GetPinchGestureDetector() const
133 return GetImplementation().GetPinchGestureDetector();
136 PanGestureDetector Control::GetPanGestureDetector() const
138 return GetImplementation().GetPanGestureDetector();
141 TapGestureDetector Control::GetTapGestureDetector() const
143 return GetImplementation().GetTapGestureDetector();
146 LongPressGestureDetector Control::GetLongPressGestureDetector() const
148 return GetImplementation().GetLongPressGestureDetector();
151 Control::KeyEventSignalV2& Control::KeyEventSignal()
153 return GetImplementation().KeyEventSignal();
157 * @copydoc ConnectionTrackerInterface::SignalConnected
159 void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
161 GetImplementation().SignalConnected(slotObserver, callback );
165 * @copydoc ConnectionTrackerInterface::SignalDisconnected
167 void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback )
169 GetImplementation().SignalDisconnected(slotObserver, callback );
173 * @copydoc ConnectionTrackerInterface::GetConnectionCount
175 std::size_t Control::GetConnectionCount() const
177 return GetImplementation().GetConnectionCount( );
181 Control::Control(ControlImpl& implementation)
182 : CustomActor(implementation)
186 Control::Control(Dali::Internal::CustomActor* internal)
187 : CustomActor(internal)
189 VerifyCustomActorPointer<ControlImpl>(internal);
192 } // namespace Toolkit