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 Internal::Control::New();
38 Control::Control(const Control& uiControl)
39 : CustomActor( uiControl ? static_cast< const Internal::Control& >( 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, Internal::Control >(handle);
61 Internal::Control& Control::GetImplementation()
63 return static_cast<Internal::Control&>(CustomActor::GetImplementation());
66 const Internal::Control& Control::GetImplementation() const
68 return static_cast<const Internal::Control&>(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 void Control::SetBackgroundColor( const Vector4& color )
153 GetImplementation().SetBackgroundColor( color );
156 Vector4 Control::GetBackgroundColor() const
158 return GetImplementation().GetBackgroundColor();
161 void Control::SetBackground( Image image )
163 GetImplementation().SetBackground( image );
166 void Control::ClearBackground()
168 GetImplementation().ClearBackground();
171 Actor Control::GetBackgroundActor() const
173 return GetImplementation().GetBackgroundActor();
176 Control::KeyEventSignalV2& Control::KeyEventSignal()
178 return GetImplementation().KeyEventSignal();
182 * @copydoc ConnectionTrackerInterface::SignalConnected
184 void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
186 GetImplementation().SignalConnected(slotObserver, callback );
190 * @copydoc ConnectionTrackerInterface::SignalDisconnected
192 void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback )
194 GetImplementation().SignalDisconnected(slotObserver, callback );
198 * @copydoc ConnectionTrackerInterface::GetConnectionCount
200 std::size_t Control::GetConnectionCount() const
202 return GetImplementation().GetConnectionCount( );
206 Control::Control(Internal::Control& implementation)
207 : CustomActor(implementation)
211 Control::Control(Dali::Internal::CustomActor* internal)
212 : CustomActor(internal)
214 VerifyCustomActorPointer<Internal::Control>(internal);
217 } // namespace Toolkit