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 <dali-toolkit/public-api/controls/control.h>
19 #include <dali-toolkit/public-api/controls/control-impl.h>
27 const char* const Control::ACTION_CONTROL_ACTIVATED = "control-activated";
29 const char* const Control::SIGNAL_KEY_EVENT = "key-event";
30 const char* const Control::SIGNAL_TAPPED = "tapped";
31 const char* const Control::SIGNAL_PANNED = "panned";
32 const char* const Control::SIGNAL_PINCHED = "pinched";
33 const char* const Control::SIGNAL_LONG_PRESSED = "long-pressed";
35 Control Control::New()
37 return Internal::Control::New();
44 Control::Control(const Control& uiControl)
45 : CustomActor( uiControl ? static_cast< const Internal::Control& >( uiControl.GetImplementation() ).GetOwner() : NULL)
53 Control& Control::operator=( const Control& handle )
57 CustomActor::operator=( handle );
62 Control Control::DownCast( BaseHandle handle )
64 return DownCast< Control, Internal::Control >(handle);
67 Internal::Control& Control::GetImplementation()
69 return static_cast<Internal::Control&>(CustomActor::GetImplementation());
72 const Internal::Control& Control::GetImplementation() const
74 return static_cast<const Internal::Control&>(CustomActor::GetImplementation());
77 void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy )
79 GetImplementation().SetSizePolicy( widthPolicy, heightPolicy );
82 void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const
84 GetImplementation().GetSizePolicy( widthPolicy, heightPolicy );
87 void Control::SetMinimumSize( const Vector3& size )
89 GetImplementation().SetMinimumSize( size );
92 const Vector3& Control::GetMinimumSize() const
94 return GetImplementation().GetMinimumSize();
97 void Control::SetMaximumSize( const Vector3& size )
99 GetImplementation().SetMaximumSize( size );
102 const Vector3& Control::GetMaximumSize() const
104 return GetImplementation().GetMaximumSize();
107 Vector3 Control::GetNaturalSize()
109 return GetImplementation().GetNaturalSize();
112 float Control::GetHeightForWidth( float width )
114 return GetImplementation().GetHeightForWidth( width );
117 float Control::GetWidthForHeight( float height )
119 return GetImplementation().GetWidthForHeight( height );
122 void Control::SetKeyInputFocus()
124 GetImplementation().SetKeyInputFocus();
127 bool Control::HasKeyInputFocus()
129 return GetImplementation().HasKeyInputFocus();
132 void Control::ClearKeyInputFocus()
134 GetImplementation().ClearKeyInputFocus();
137 PinchGestureDetector Control::GetPinchGestureDetector() const
139 return GetImplementation().GetPinchGestureDetector();
142 PanGestureDetector Control::GetPanGestureDetector() const
144 return GetImplementation().GetPanGestureDetector();
147 TapGestureDetector Control::GetTapGestureDetector() const
149 return GetImplementation().GetTapGestureDetector();
152 LongPressGestureDetector Control::GetLongPressGestureDetector() const
154 return GetImplementation().GetLongPressGestureDetector();
157 void Control::SetBackgroundColor( const Vector4& color )
159 GetImplementation().SetBackgroundColor( color );
162 Vector4 Control::GetBackgroundColor() const
164 return GetImplementation().GetBackgroundColor();
167 void Control::SetBackground( Image image )
169 GetImplementation().SetBackground( image );
172 void Control::ClearBackground()
174 GetImplementation().ClearBackground();
177 Actor Control::GetBackgroundActor() const
179 return GetImplementation().GetBackgroundActor();
182 Control::KeyEventSignalV2& Control::KeyEventSignal()
184 return GetImplementation().KeyEventSignal();
187 Control::Control(Internal::Control& implementation)
188 : CustomActor(implementation)
192 Control::Control(Dali::Internal::CustomActor* internal)
193 : CustomActor(internal)
195 VerifyCustomActorPointer<Internal::Control>(internal);
198 } // namespace Toolkit