(FocusManager) Updated Accessibility features (Part2)
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / control.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 #include <dali-toolkit/public-api/controls/control.h>
18 #include <dali-toolkit/public-api/controls/control-impl.h>
19
20 namespace Dali
21 {
22
23 namespace Toolkit
24 {
25
26 const char* const Control::ACTION_CONTROL_ACTIVATED = "control-activated";
27 const char* const Control::SIGNAL_KEY_EVENT = "key-event";
28
29 Control Control::New()
30 {
31   return Internal::Control::New();
32 }
33
34 Control::Control()
35 {
36 }
37
38 Control::Control(const Control& uiControl)
39 : CustomActor( uiControl ? static_cast< const Internal::Control& >( uiControl.GetImplementation() ).GetOwner() : NULL)
40 {
41 }
42
43 Control::~Control()
44 {
45 }
46
47 Control& Control::operator=( const Control& handle )
48 {
49   if( &handle != this )
50   {
51     CustomActor::operator=( handle );
52   }
53   return *this;
54 }
55
56 Control Control::DownCast( BaseHandle handle )
57 {
58   return DownCast< Control, Internal::Control >(handle);
59 }
60
61 Internal::Control& Control::GetImplementation()
62 {
63   return static_cast<Internal::Control&>(CustomActor::GetImplementation());
64 }
65
66 const Internal::Control& Control::GetImplementation() const
67 {
68   return static_cast<const Internal::Control&>(CustomActor::GetImplementation());
69 }
70
71 void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy )
72 {
73   GetImplementation().SetSizePolicy( widthPolicy, heightPolicy );
74 }
75
76 void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const
77 {
78   GetImplementation().GetSizePolicy( widthPolicy, heightPolicy );
79 }
80
81 void Control::SetMinimumSize( const Vector3& size )
82 {
83   GetImplementation().SetMinimumSize( size );
84 }
85
86 const Vector3& Control::GetMinimumSize() const
87 {
88   return GetImplementation().GetMinimumSize();
89 }
90
91 void Control::SetMaximumSize( const Vector3& size )
92 {
93   GetImplementation().SetMaximumSize( size );
94 }
95
96 const Vector3& Control::GetMaximumSize() const
97 {
98   return GetImplementation().GetMaximumSize();
99 }
100
101 Vector3 Control::GetNaturalSize()
102 {
103   return GetImplementation().GetNaturalSize();
104 }
105
106 float Control::GetHeightForWidth( float width )
107 {
108   return GetImplementation().GetHeightForWidth( width );
109 }
110
111 float Control::GetWidthForHeight( float height )
112 {
113   return GetImplementation().GetWidthForHeight( height );
114 }
115
116 void Control::SetKeyInputFocus()
117 {
118   GetImplementation().SetKeyInputFocus();
119 }
120
121 bool Control::HasKeyInputFocus()
122 {
123   return GetImplementation().HasKeyInputFocus();
124 }
125
126 void Control::ClearKeyInputFocus()
127 {
128   GetImplementation().ClearKeyInputFocus();
129 }
130
131 PinchGestureDetector Control::GetPinchGestureDetector() const
132 {
133   return GetImplementation().GetPinchGestureDetector();
134 }
135
136 PanGestureDetector Control::GetPanGestureDetector() const
137 {
138   return GetImplementation().GetPanGestureDetector();
139 }
140
141 TapGestureDetector Control::GetTapGestureDetector() const
142 {
143   return GetImplementation().GetTapGestureDetector();
144 }
145
146 LongPressGestureDetector Control::GetLongPressGestureDetector() const
147 {
148   return GetImplementation().GetLongPressGestureDetector();
149 }
150
151 void Control::SetBackgroundColor( const Vector4& color )
152 {
153   GetImplementation().SetBackgroundColor( color );
154 }
155
156 Vector4 Control::GetBackgroundColor() const
157 {
158   return GetImplementation().GetBackgroundColor();
159 }
160
161 void Control::SetBackground( Image image )
162 {
163   GetImplementation().SetBackground( image );
164 }
165
166 void Control::ClearBackground()
167 {
168   GetImplementation().ClearBackground();
169 }
170
171 Actor Control::GetBackgroundActor() const
172 {
173   return GetImplementation().GetBackgroundActor();
174 }
175
176 Control::KeyEventSignalV2& Control::KeyEventSignal()
177 {
178   return GetImplementation().KeyEventSignal();
179 }
180
181 /**
182  * @copydoc ConnectionTrackerInterface::SignalConnected
183  */
184 void Control::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
185 {
186   GetImplementation().SignalConnected(slotObserver, callback );
187 }
188
189 /**
190  * @copydoc ConnectionTrackerInterface::SignalDisconnected
191  */
192 void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback )
193 {
194   GetImplementation().SignalDisconnected(slotObserver, callback );
195 }
196
197 /**
198  * @copydoc ConnectionTrackerInterface::GetConnectionCount
199  */
200 std::size_t Control::GetConnectionCount() const
201 {
202   return GetImplementation().GetConnectionCount( );
203 }
204
205
206 Control::Control(Internal::Control& implementation)
207 : CustomActor(implementation)
208 {
209 }
210
211 Control::Control(Dali::Internal::CustomActor* internal)
212 : CustomActor(internal)
213 {
214   VerifyCustomActorPointer<Internal::Control>(internal);
215 }
216
217 } // namespace Toolkit
218
219 } // namespace Dali