[Tizen] Add deprecated logs to Scene and Actor
[platform/core/uifw/dali-core-legacy.git] / dali / public-api / actors / actor.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/public-api/actors/actor.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/actors/layer.h>
23 #include <dali/public-api/animation/constraint.h>
24 #include <dali/public-api/common/dali-common.h>
25 #include <dali/public-api/math/radian.h>
26 #include <dali/public-api/math/vector2.h>
27
28 #include <dali/internal/event/actors/actor-impl.h>
29 #include <dali/internal/event/actors/layer-impl.h>
30 #include <dali/internal/event/rendering/renderer-impl.h>
31 #include <dali/internal/event/animation/constraint-impl.h>
32 #include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
33
34 namespace Dali
35 {
36
37 Actor::Actor()
38 {
39 }
40
41 Actor Actor::New()
42 {
43   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
44   Internal::ActorPtr internal = Internal::Actor::New();
45
46   return Actor(internal.Get());
47 }
48
49 Actor Actor::DownCast( BaseHandle handle )
50 {
51   return Actor( dynamic_cast<Dali::Internal::Actor*>(handle.GetObjectPtr()) );
52 }
53
54 Actor::~Actor()
55 {
56 }
57
58 Actor::Actor(const Actor& copy)
59 : Handle(copy)
60 {
61 }
62
63 Actor& Actor::operator=(const Actor& rhs)
64 {
65   BaseHandle::operator=(rhs);
66   return *this;
67 }
68
69 const std::string& Actor::GetName() const
70 {
71   return GetImplementation(*this).GetName();
72 }
73
74 void Actor::SetName(const std::string& name)
75 {
76   GetImplementation(*this).SetName(name);
77 }
78
79 uint32_t Actor::GetId() const
80 {
81   return GetImplementation(*this).GetId();
82 }
83
84 bool Actor::IsRoot() const
85 {
86   return GetImplementation(*this).IsRoot();
87 }
88
89 bool Actor::OnStage() const
90 {
91   return GetImplementation(*this).OnStage();
92 }
93
94 bool Actor::IsLayer() const
95 {
96   return GetImplementation(*this).IsLayer();
97 }
98
99 Layer Actor::GetLayer()
100 {
101   return GetImplementation(*this).GetLayer();
102 }
103
104 void Actor::Add(Actor actor)
105 {
106   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
107   GetImplementation(*this).Add(GetImplementation(actor));
108 }
109
110 void Actor::Remove(Actor actor)
111 {
112   GetImplementation(*this).Remove(GetImplementation(actor));
113 }
114
115 void Actor::Unparent()
116 {
117   GetImplementation(*this).Unparent();
118 }
119
120 uint32_t Actor::GetChildCount() const
121 {
122   return GetImplementation(*this).GetChildCount();
123 }
124
125 Actor Actor::GetChildAt( uint32_t index ) const
126 {
127   Internal::ActorPtr child = GetImplementation(*this).GetChildAt( index );
128   return Actor( child.Get() );
129 }
130
131 Actor Actor::FindChildByName(const std::string& actorName)
132 {
133   Internal::ActorPtr child = GetImplementation(*this).FindChildByName( actorName );
134   return Actor( child.Get() );
135 }
136
137 Actor Actor::FindChildById( const uint32_t id )
138 {
139   Internal::ActorPtr child = GetImplementation(*this).FindChildById( id );
140   return Actor( child.Get() );
141 }
142
143 Actor Actor::GetParent() const
144 {
145   Internal::Actor* parent = GetImplementation(*this).GetParent();
146
147   return Actor(parent);
148 }
149
150 void Actor::SetParentOrigin(const Vector3& origin)
151 {
152   GetImplementation(*this).SetParentOrigin(origin);
153 }
154
155 Vector3 Actor::GetCurrentParentOrigin() const
156 {
157   return GetImplementation(*this).GetCurrentParentOrigin();
158 }
159
160 void Actor::SetAnchorPoint(const Vector3& anchorPoint)
161 {
162   GetImplementation(*this).SetAnchorPoint(anchorPoint);
163 }
164
165 Vector3 Actor::GetCurrentAnchorPoint() const
166 {
167   return GetImplementation(*this).GetCurrentAnchorPoint();
168 }
169
170 void Actor::SetSize(float width, float height)
171 {
172   GetImplementation(*this).SetSize(width, height);
173 }
174
175 void Actor::SetSize(float width, float height, float depth)
176 {
177   GetImplementation(*this).SetSize(width, height, depth);
178 }
179
180 void Actor::SetSize(const Vector2& size)
181 {
182   GetImplementation(*this).SetSize( size );
183 }
184
185 void Actor::SetSize(const Vector3& size)
186 {
187   GetImplementation(*this).SetSize( size );
188 }
189
190 Vector3 Actor::GetTargetSize() const
191 {
192   return GetImplementation(*this).GetTargetSize();
193 }
194
195 Vector3 Actor::GetCurrentSize() const
196 {
197   return GetImplementation(*this).GetCurrentSize();
198 }
199
200 Vector3 Actor::GetNaturalSize() const
201 {
202   return GetImplementation(*this).GetNaturalSize();
203 }
204
205 void Actor::SetPosition(float x, float y)
206 {
207   GetImplementation(*this).SetPosition(x, y);
208 }
209
210 void Actor::SetPosition(float x, float y, float z)
211 {
212   GetImplementation(*this).SetPosition(x, y, z);
213 }
214
215 void Actor::SetPosition(const Vector3& position)
216 {
217   GetImplementation(*this).SetPosition(position);
218 }
219
220 void Actor::SetX(float x)
221 {
222   GetImplementation(*this).SetX(x);
223 }
224
225 void Actor::SetY(float y)
226 {
227   GetImplementation(*this).SetY(y);
228 }
229
230 void Actor::SetZ(float z)
231 {
232   GetImplementation(*this).SetZ(z);
233 }
234
235 void Actor::TranslateBy(const Vector3& distance)
236 {
237   GetImplementation(*this).TranslateBy(distance);
238 }
239
240 Vector3 Actor::GetCurrentPosition() const
241 {
242   return GetImplementation(*this).GetCurrentPosition();
243 }
244
245 Vector3 Actor::GetCurrentWorldPosition() const
246 {
247   return GetImplementation(*this).GetCurrentWorldPosition();
248 }
249
250 void Actor::SetOrientation(const Radian& angle, const Vector3& axis)
251 {
252   GetImplementation(*this).SetOrientation(angle, axis);
253 }
254
255 void Actor::SetOrientation(const Quaternion& orientation)
256 {
257   GetImplementation(*this).SetOrientation(orientation);
258 }
259
260 void Actor::RotateBy(const Radian& angle, const Vector3& axis)
261 {
262   GetImplementation(*this).RotateBy(angle, axis);
263 }
264
265 void Actor::RotateBy(const Quaternion& relativeRotation)
266 {
267   GetImplementation(*this).RotateBy(relativeRotation);
268 }
269
270 Quaternion Actor::GetCurrentOrientation() const
271 {
272   return GetImplementation(*this).GetCurrentOrientation();
273 }
274
275 void Actor::SetInheritOrientation(bool inherit)
276 {
277   GetImplementation(*this).SetInheritOrientation(inherit);
278 }
279
280 bool Actor::IsOrientationInherited() const
281 {
282   return GetImplementation(*this).IsOrientationInherited();
283 }
284
285 Quaternion Actor::GetCurrentWorldOrientation() const
286 {
287   return GetImplementation(*this).GetCurrentWorldOrientation();
288 }
289
290 void Actor::SetScale(float scale)
291 {
292   GetImplementation(*this).SetScale(scale);
293 }
294
295 void Actor::SetScale(float scaleX, float scaleY, float scaleZ)
296 {
297   GetImplementation(*this).SetScale(scaleX, scaleY, scaleZ);
298 }
299
300 void Actor::SetScale(const Vector3& scale)
301 {
302   GetImplementation(*this).SetScale(scale);
303 }
304
305 void Actor::ScaleBy(const Vector3& relativeScale)
306 {
307   GetImplementation(*this).ScaleBy(relativeScale);
308 }
309
310 Vector3 Actor::GetCurrentScale() const
311 {
312   return GetImplementation(*this).GetCurrentScale();
313 }
314
315 Vector3 Actor::GetCurrentWorldScale() const
316 {
317   return GetImplementation(*this).GetCurrentWorldScale();
318 }
319
320 void Actor::SetInheritScale( bool inherit )
321 {
322   GetImplementation(*this).SetInheritScale( inherit );
323 }
324
325 bool Actor::IsScaleInherited() const
326 {
327   return GetImplementation(*this).IsScaleInherited();
328 }
329
330 void Actor::SetSizeModeFactor(const Vector3& factor)
331 {
332   GetImplementation(*this).SetSizeModeFactor(factor);
333 }
334
335 Vector3 Actor::GetSizeModeFactor() const
336 {
337   return GetImplementation(*this).GetSizeModeFactor();
338 }
339
340 Matrix Actor::GetCurrentWorldMatrix() const
341 {
342   return GetImplementation(*this).GetCurrentWorldMatrix();
343 }
344
345 void Actor::SetVisible(bool visible)
346 {
347   GetImplementation(*this).SetVisible(visible);
348 }
349
350 bool Actor::IsVisible() const
351 {
352   return GetImplementation(*this).IsVisible();
353 }
354
355 void Actor::SetOpacity(float opacity)
356 {
357   GetImplementation(*this).SetOpacity(opacity);
358 }
359
360 float Actor::GetCurrentOpacity() const
361 {
362   return GetImplementation(*this).GetCurrentOpacity();
363 }
364
365 void Actor::SetColor(const Vector4& color)
366 {
367   GetImplementation(*this).SetColor(color);
368 }
369
370 Vector4 Actor::GetCurrentColor() const
371 {
372   return GetImplementation(*this).GetCurrentColor();
373 }
374
375 void Actor::SetColorMode( ColorMode colorMode )
376 {
377   GetImplementation(*this).SetColorMode(colorMode);
378 }
379
380 ColorMode Actor::GetColorMode() const
381 {
382   return GetImplementation(*this).GetColorMode();
383 }
384
385 Vector4 Actor::GetCurrentWorldColor() const
386 {
387   return GetImplementation(*this).GetCurrentWorldColor();
388 }
389
390 void Actor::SetDrawMode( DrawMode::Type drawMode )
391 {
392   GetImplementation(*this).SetDrawMode( drawMode );
393 }
394
395 DrawMode::Type Actor::GetDrawMode() const
396 {
397   return GetImplementation(*this).GetDrawMode();
398 }
399
400 void Actor::SetSensitive(bool sensitive)
401 {
402   GetImplementation(*this).SetSensitive(sensitive);
403 }
404
405 bool Actor::IsSensitive() const
406 {
407   return GetImplementation(*this).IsSensitive();
408 }
409
410 bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const
411 {
412   return GetImplementation(*this).ScreenToLocal(localX, localY, screenX, screenY);
413 }
414
415 void Actor::SetLeaveRequired(bool required)
416 {
417   GetImplementation(*this).SetLeaveRequired(required);
418 }
419
420 bool Actor::GetLeaveRequired() const
421 {
422   return GetImplementation(*this).GetLeaveRequired();
423 }
424
425 void Actor::SetKeyboardFocusable( bool focusable )
426 {
427   GetImplementation(*this).SetKeyboardFocusable(focusable);
428 }
429
430 bool Actor::IsKeyboardFocusable() const
431 {
432   return GetImplementation(*this).IsKeyboardFocusable();
433 }
434
435 void Actor::Raise()
436 {
437   GetImplementation( *this ).Raise();
438 }
439
440 void Actor::Lower()
441 {
442   GetImplementation( *this ).Lower();
443 }
444
445 void Actor::RaiseToTop()
446 {
447   GetImplementation( *this ).RaiseToTop();
448 }
449
450 void Actor::LowerToBottom()
451 {
452   GetImplementation( *this ).LowerToBottom();
453 }
454
455 void Actor::RaiseAbove( Actor target )
456 {
457   GetImplementation( *this ).RaiseAbove( GetImplementation( target ) );
458 }
459
460 void Actor::LowerBelow( Actor target )
461 {
462   GetImplementation( *this ).LowerBelow( GetImplementation( target ) );
463 }
464
465 void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
466 {
467   GetImplementation(*this).SetResizePolicy( policy, dimension );
468 }
469
470 ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
471 {
472   return GetImplementation(*this).GetResizePolicy( dimension );
473 }
474
475 void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy )
476 {
477   GetImplementation(*this).SetSizeScalePolicy( policy );
478 }
479
480 SizeScalePolicy::Type Actor::GetSizeScalePolicy() const
481 {
482   return GetImplementation(*this).GetSizeScalePolicy();
483 }
484
485 float Actor::GetHeightForWidth( float width )
486 {
487   return GetImplementation(*this).GetHeightForWidth( width );
488 }
489
490 float Actor::GetWidthForHeight( float height )
491 {
492   return GetImplementation(*this).GetWidthForHeight( height );
493 }
494
495 float Actor::GetRelayoutSize( Dimension::Type dimension ) const
496 {
497   return GetImplementation(*this).GetRelayoutSize( dimension );
498 }
499
500 void Actor::SetPadding( const Padding& padding )
501 {
502   Internal::Actor& impl = GetImplementation(*this);
503
504   Vector2 widthPadding( padding.left, padding.right );
505   impl.SetPadding( widthPadding, Dimension::WIDTH );
506
507   Vector2 heightPadding( padding.bottom, padding.top );
508   impl.SetPadding( heightPadding, Dimension::HEIGHT );
509 }
510
511 void Actor::GetPadding( Padding& paddingOut ) const
512 {
513   const Internal::Actor& impl = GetImplementation(*this);
514
515   Vector2 widthPadding = impl.GetPadding( Dimension::WIDTH );
516   Vector2 heightPadding = impl.GetPadding( Dimension::HEIGHT );
517
518   paddingOut.left = widthPadding.x;
519   paddingOut.right = widthPadding.y;
520   paddingOut.bottom = heightPadding.x;
521   paddingOut.top = heightPadding.y;
522 }
523
524 void Actor::SetMinimumSize( const Vector2& size )
525 {
526   Internal::Actor& impl = GetImplementation(*this);
527
528   impl.SetMinimumSize( size.x, Dimension::WIDTH );
529   impl.SetMinimumSize( size.y, Dimension::HEIGHT );
530 }
531
532 Vector2 Actor::GetMinimumSize()
533 {
534   Internal::Actor& impl = GetImplementation(*this);
535
536   return Vector2( impl.GetMinimumSize( Dimension::WIDTH ), impl.GetMinimumSize( Dimension::HEIGHT ) );
537 }
538
539 void Actor::SetMaximumSize( const Vector2& size )
540 {
541   Internal::Actor& impl = GetImplementation(*this);
542
543   impl.SetMaximumSize( size.x, Dimension::WIDTH );
544   impl.SetMaximumSize( size.y, Dimension::HEIGHT );
545 }
546
547 Vector2 Actor::GetMaximumSize()
548 {
549   Internal::Actor& impl = GetImplementation(*this);
550
551   return Vector2( impl.GetMaximumSize( Dimension::WIDTH ), impl.GetMaximumSize( Dimension::HEIGHT ) );
552 }
553
554 int32_t Actor::GetHierarchyDepth()
555 {
556   return GetImplementation(*this).GetHierarchyDepth();
557 }
558
559 Actor::TouchSignalType& Actor::TouchedSignal()
560 {
561   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: TouchedSignal() is deprecated and will be removed from next release. Use TouchSignal() instead.\n" );
562
563   return GetImplementation(*this).TouchedSignal();
564 }
565
566 Actor::TouchDataSignalType& Actor::TouchSignal()
567 {
568   return GetImplementation( *this ).TouchSignal();
569 }
570
571 Actor::HoverSignalType& Actor::HoveredSignal()
572 {
573   return GetImplementation(*this).HoveredSignal();
574 }
575
576 Actor::WheelEventSignalType& Actor::WheelEventSignal()
577 {
578   return GetImplementation(*this).WheelEventSignal();
579 }
580
581 Actor::OnStageSignalType& Actor::OnStageSignal()
582 {
583   return GetImplementation(*this).OnStageSignal();
584 }
585
586 Actor::OffStageSignalType& Actor::OffStageSignal()
587 {
588   return GetImplementation(*this).OffStageSignal();
589 }
590
591 uint32_t Actor::AddRenderer( Renderer& renderer )
592 {
593   return GetImplementation(*this).AddRenderer( GetImplementation( renderer ) );
594 }
595
596 uint32_t Actor::GetRendererCount() const
597 {
598   return GetImplementation(*this).GetRendererCount();
599 }
600
601 Renderer Actor::GetRendererAt( uint32_t index )
602 {
603   Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt( index );
604   return Renderer( renderer.Get() );
605 }
606
607 void Actor::RemoveRenderer( Renderer& renderer )
608 {
609   GetImplementation(*this).RemoveRenderer( GetImplementation( renderer ) );
610 }
611
612 void Actor::RemoveRenderer( uint32_t index )
613 {
614   GetImplementation(*this).RemoveRenderer( index );
615 }
616
617 Actor::OnRelayoutSignalType& Actor::OnRelayoutSignal()
618 {
619   return GetImplementation(*this).OnRelayoutSignal();
620 }
621
622 Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal()
623 {
624   return GetImplementation( *this ).LayoutDirectionChangedSignal();
625 }
626
627 Actor::Actor(Internal::Actor* internal)
628 : Handle(internal)
629 {
630 }
631
632 } // namespace Dali