[Tizen](ATSPI) squashed implementation
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control.cpp
1 /*
2  * Copyright (c) 2019 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 Control Control::New()
34 {
35   return Internal::Control::New();
36 }
37
38 Control::Control()
39 {
40 }
41
42 Control::Control( const Control& uiControl )
43 : CustomActor( uiControl  )
44 {
45 }
46
47 Control::~Control()
48 {
49 }
50
51 Control& Control::operator=( const Control& handle )
52 {
53   if( &handle != this )
54   {
55     CustomActor::operator=( handle );
56   }
57   return *this;
58 }
59
60 Control Control::DownCast( BaseHandle handle )
61 {
62   return DownCast< Control, Internal::Control >(handle);
63 }
64
65 void Control::SetKeyInputFocus()
66 {
67   Internal::GetImplementation(*this).SetKeyInputFocus();
68 }
69
70 bool Control::HasKeyInputFocus()
71 {
72   return Internal::GetImplementation(*this).HasKeyInputFocus();
73 }
74
75 void Control::ClearKeyInputFocus()
76 {
77   Internal::GetImplementation(*this).ClearKeyInputFocus();
78 }
79
80 PinchGestureDetector Control::GetPinchGestureDetector() const
81 {
82   return Internal::GetImplementation(*this).GetPinchGestureDetector();
83 }
84
85 PanGestureDetector Control::GetPanGestureDetector() const
86 {
87   return Internal::GetImplementation(*this).GetPanGestureDetector();
88 }
89
90 TapGestureDetector Control::GetTapGestureDetector() const
91 {
92   return Internal::GetImplementation(*this).GetTapGestureDetector();
93 }
94
95 LongPressGestureDetector Control::GetLongPressGestureDetector() const
96 {
97   return Internal::GetImplementation(*this).GetLongPressGestureDetector();
98 }
99
100 void Control::SetStyleName( const std::string& styleName )
101 {
102   Internal::GetImplementation(*this).SetStyleName( styleName );
103 }
104
105 const std::string& Control::GetStyleName() const
106 {
107   return Internal::GetImplementation(*this).GetStyleName();
108 }
109
110 void Control::SetBackgroundColor( const Vector4& color )
111 {
112   Internal::GetImplementation(*this).SetBackgroundColor( color );
113 }
114
115 void Control::ClearBackground()
116 {
117   Internal::GetImplementation(*this).ClearBackground();
118 }
119
120 bool Control::IsResourceReady() const
121 {
122   const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
123   const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl );
124
125   return controlDataImpl.IsResourceReady();
126 }
127
128 Toolkit::Visual::ResourceStatus Control::GetVisualResourceStatus( Dali::Property::Index index )
129 {
130   const Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
131   const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( internalControl );
132   return controlDataImpl.GetVisualResourceStatus( index );
133 }
134
135 Control::KeyEventSignalType& Control::KeyEventSignal()
136 {
137   return Internal::GetImplementation(*this).KeyEventSignal();
138 }
139
140 Control::KeyInputFocusSignalType& Control::KeyInputFocusGainedSignal()
141 {
142   return Internal::GetImplementation(*this).KeyInputFocusGainedSignal();
143 }
144
145 Control::KeyInputFocusSignalType& Control::KeyInputFocusLostSignal()
146 {
147   return Internal::GetImplementation(*this).KeyInputFocusLostSignal();
148 }
149
150 Control::ResourceReadySignalType&  Control::ResourceReadySignal()
151 {
152   Internal::Control& internalControl = Toolkit::Internal::GetImplementation( *this );
153   Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl );
154
155   return controlImpl.mResourceReadySignal;
156 }
157
158 Control::Control(Internal::Control& implementation)
159 : CustomActor(implementation)
160 {
161 }
162
163 Control::Control(Dali::Internal::CustomActor* internal)
164 : CustomActor(internal)
165 {
166   VerifyCustomActorPointer<Internal::Control>(internal);
167 }
168
169 } // namespace Toolkit
170
171 } // namespace Dali