[Tizen][ATSPI] Accessibility initial implementation
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
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
18 // CLASS HEADER
19 #include <dali-toolkit/public-api/controls/control.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/controls/control-impl.h>
26 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 Control Control::New()
35 {
36   return Internal::Control::New();
37 }
38
39 Control::Control()
40 {
41 }
42
43 Control::Control( const Control& uiControl )
44 : CustomActor( uiControl  )
45 {
46 }
47
48 Control::~Control()
49 {
50 }
51
52 Control& Control::operator=( const Control& handle )
53 {
54   if( &handle != this )
55   {
56     CustomActor::operator=( handle );
57   }
58   return *this;
59 }
60
61 Control Control::DownCast( BaseHandle handle )
62 {
63   return DownCast< Control, Internal::Control >(handle);
64 }
65
66 void Control::SetKeyInputFocus()
67 {
68   Internal::GetImplementation(*this).SetKeyInputFocus();
69 }
70
71 bool Control::HasKeyInputFocus()
72 {
73   return Internal::GetImplementation(*this).HasKeyInputFocus();
74 }
75
76 void Control::ClearKeyInputFocus()
77 {
78   Internal::GetImplementation(*this).ClearKeyInputFocus();
79 }
80
81 PinchGestureDetector Control::GetPinchGestureDetector() const
82 {
83   return Internal::GetImplementation(*this).GetPinchGestureDetector();
84 }
85
86 PanGestureDetector Control::GetPanGestureDetector() const
87 {
88   return Internal::GetImplementation(*this).GetPanGestureDetector();
89 }
90
91 TapGestureDetector Control::GetTapGestureDetector() const
92 {
93   return Internal::GetImplementation(*this).GetTapGestureDetector();
94 }
95
96 LongPressGestureDetector Control::GetLongPressGestureDetector() const
97 {
98   return Internal::GetImplementation(*this).GetLongPressGestureDetector();
99 }
100
101 void Control::SetStyleName( const std::string& styleName )
102 {
103   Internal::GetImplementation(*this).SetStyleName( styleName );
104 }
105
106 const std::string& Control::GetStyleName() const
107 {
108   return Internal::GetImplementation(*this).GetStyleName();
109 }
110
111 void Control::SetBackgroundColor( const Vector4& color )
112 {
113   Internal::GetImplementation(*this).SetBackgroundColor( color );
114 }
115
116 Vector4 Control::GetBackgroundColor() const
117 {
118   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetBackgroundColor() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" );
119
120   return Internal::GetImplementation(*this).GetBackgroundColor();
121 }
122
123 void Control::SetBackgroundImage( Image image )
124 {
125   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release. use Property::BACKGROUND instead.\n" );
126
127   Internal::GetImplementation(*this).SetBackgroundImage( image );
128 }
129
130 void Control::ClearBackground()
131 {
132   Internal::GetImplementation(*this).ClearBackground();
133 }
134
135 bool Control::IsResourceReady() const
136 {
137   const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
138   const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl );
139
140   return controlDataImpl.IsResourceReady();
141 }
142
143 Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus( Dali::Property::Index index )
144 {
145   const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
146   const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl );
147   return controlDataImpl.GetVisualResourceStatus( index );
148 }
149
150 Control::KeyEventSignalType& Control::KeyEventSignal()
151 {
152   return Internal::GetImplementation(*this).KeyEventSignal();
153 }
154
155 Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
156 {
157   return Internal::GetImplementation(*this).KeyInputFocusGainedSignal();
158 }
159
160 Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
161 {
162   return Internal::GetImplementation(*this).KeyInputFocusLostSignal();
163 }
164
165 Control::ResourceReadySignalType&  Control::ResourceReadySignal()
166 {
167   Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
168   Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl );
169
170   return controlImpl.mResourceReadySignal;
171 }
172
173 Control::AccessibilityActivateSignalType& Control::AccessibilityActivateSignal()
174 {
175   return Internal::GetImplementation(*this).AccessibilityActivateSignal();
176 }
177
178
179 Control::Control(Internal::Control& implementation)
180 : CustomActor(implementation)
181 {
182 }
183
184 Control::Control(Dali::Internal::CustomActor* internal)
185 : CustomActor(internal)
186 {
187   VerifyCustomActorPointer<Internal::Control>(internal);
188 }
189
190 void Control::AccessibilitySetAttribute( const std::string& key,
191                                          const std::string value )
192 {
193   return Internal::GetImplementation( *this ).AccessibilitySetAttribute( key,
194                                                                          value );
195 }
196
197 std::string Control::AccessibilityGetAttribute( const std::string& key )
198 {
199   return Internal::GetImplementation( *this ).AccessibilityGetAttribute( key );
200 }
201
202 void Control::AccessibilityEraseAttribute( std::string& key )
203 {
204   return Internal::GetImplementation( *this ).AccessibilityEraseAttribute( key );
205 }
206
207 } // namespace Toolkit
208
209 } // namespace Dali