[ATSPI] Fix for DefaultLabel
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / ViewPublicMethods.cs
1 /*
2  * Copyright(c) 2020 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 using System;
19 using System.ComponentModel;
20 using System.Reflection;
21 using System.Runtime.InteropServices;
22 using Tizen.NUI.Binding;
23
24 namespace Tizen.NUI.BaseComponents
25 {
26     /// <summary>
27     /// View is the base class for all views.
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     public partial class View
31     {
32         /// <summary>
33         /// Perform an action on a visual registered to this view. <br />
34         /// Visuals will have actions. This API is used to perform one of these actions with the given attributes.
35         /// </summary>
36         /// <param name="propertyIndexOfVisual">The Property index of the visual.</param>
37         /// <param name="propertyIndexOfActionId">The action to perform. See Visual to find the supported actions.</param>
38         /// <param name="attributes">Optional attributes for the action.</param>
39         /// <since_tizen> 5 </since_tizen>
40         public void DoAction(int propertyIndexOfVisual, int propertyIndexOfActionId, PropertyValue attributes)
41         {
42             Interop.View.DoAction(SwigCPtr, propertyIndexOfVisual, propertyIndexOfActionId, PropertyValue.getCPtr(attributes));
43             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
44         }
45
46         /// <summary>
47         /// Creates an animation to animate the background color visual. If there is no
48         /// background visual, creates one with transparent black as it's mixColor.
49         /// </summary>
50         /// <since_tizen> 3 </since_tizen>
51         public Animation AnimateBackgroundColor(object destinationValue,
52                                                  int startTime,
53                                                  int endTime,
54                                                  AlphaFunction.BuiltinFunctions? alphaFunction = null,
55                                                  object initialValue = null)
56         {
57             Tizen.NUI.PropertyMap background = Background;
58
59             if (background.Empty())
60             {
61                 // If there is no background yet, ensure there is a transparent
62                 // color visual
63                 BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
64                 background = Background;
65             }
66             return AnimateColor("background", destinationValue, startTime, endTime, alphaFunction, initialValue);
67         }
68
69         /// <summary>
70         /// Creates an animation to animate the mixColor of the named visual.
71         /// </summary>
72         /// <since_tizen> 3 </since_tizen>
73         public Animation AnimateColor(string targetVisual, object destinationColor, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialColor = null)
74         {
75             Animation animation = null;
76             using (PropertyMap animator = new PropertyMap())
77             using (PropertyMap timePeriod = new PropertyMap())
78             using (PropertyValue pvDuration = new PropertyValue((endTime - startTime) / 1000.0f))
79             using (PropertyValue pvDelay = new PropertyValue(startTime / 1000.0f))
80             using (PropertyMap transition = new PropertyMap())
81             using (PropertyValue pvTarget = new PropertyValue(targetVisual))
82             using (PropertyValue pvProperty = new PropertyValue("mixColor"))
83             using (PropertyValue destValue = PropertyValue.CreateFromObject(destinationColor))
84             {
85                 if (alphaFunction != null)
86                 {
87                     using (PropertyValue pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(alphaFunction)))
88                     {
89                         animator.Add("alphaFunction", pvAlpha);
90                     }
91                 }
92
93                 timePeriod.Add("duration", pvDuration);
94                 timePeriod.Add("delay", pvDelay);
95                 using (PropertyValue pvTimePeriod = new PropertyValue(timePeriod))
96                 {
97                     animator.Add("timePeriod", pvTimePeriod);
98                 }
99                 using (PropertyValue pvAnimator = new PropertyValue(animator))
100                 {
101                     transition.Add("animator", pvAnimator);
102                 }
103                 transition.Add("target", pvTarget);
104                 transition.Add("property", pvProperty);
105
106                 if (initialColor != null)
107                 {
108                     using (PropertyValue initValue = PropertyValue.CreateFromObject(initialColor))
109                     {
110                         transition.Add("initialValue", initValue);
111                     }
112                 }
113
114                 transition.Add("targetValue", destValue);
115                 using (TransitionData transitionData = new TransitionData(transition))
116                 {
117                     animation = new Animation(Interop.View.CreateTransition(SwigCPtr, TransitionData.getCPtr(transitionData)), true);
118                 }
119                 if (NDalicPINVOKE.SWIGPendingException.Pending)
120                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121             }
122             return animation;
123         }
124
125         // From Container Base class
126         /// <summary>
127         /// Adds a child view to this view.
128         /// </summary>
129         /// <seealso cref="Container.Add" />
130         /// <since_tizen> 4 </since_tizen>
131         public override void Add(View child)
132         {
133             bool hasLayout = (layout != null);
134
135             if (null == child)
136             {
137                 Tizen.Log.Fatal("NUI", "Child is null");
138                 return;
139             }
140
141             Container oldParent = child.GetParent();
142             if (oldParent != this)
143             {
144                 // If child already has a parent then re-parent child
145                 if (oldParent != null)
146                 {
147                     if (child.Layout != null)
148                     {
149                         child.Layout.SetReplaceFlag();
150                     }
151                     oldParent.Remove(child);
152                 }
153                 child.InternalParent = this;
154
155                 Interop.Actor.Add(SwigCPtr, View.getCPtr(child));
156
157                 if (NDalicPINVOKE.SWIGPendingException.Pending)
158                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159                 Children.Add(child);
160
161                 if (ChildAdded != null)
162                 {
163                     ChildAddedEventArgs e = new ChildAddedEventArgs
164                     {
165                         Added = child
166                     };
167                     ChildAdded(this, e);
168                 }
169
170                 AddChildBindableObject(child);
171             }
172         }
173
174         /// <summary>
175         /// Removes a child view from this View. If the view was not a child of this view, this is a no-op.
176         /// </summary>
177         /// <seealso cref="Container.Remove" />
178         /// <since_tizen> 4 </since_tizen>
179         /// <exception cref="InvalidOperationException">Thrown when deleting a view that is not a child of this view</exception>
180         public override void Remove(View child)
181         {
182             if (child == null || child.GetParent() == null) // Early out if child null.
183                 return;
184
185             if (child.GetParent() != this)
186             {
187                 //throw new System.InvalidOperationException("You have deleted a view that is not a child of this view.");
188                 Tizen.Log.Error("NUI", "You have deleted a view that is not a child of this view.");
189             }
190
191             bool hasLayout = (layout != null);
192
193             // If View has a layout then do a deferred child removal
194             // Actual child removal is performed by the layouting system so
195             // transitions can be completed.
196             if (hasLayout)
197             {
198                 (layout as LayoutGroup)?.RemoveChildFromLayoutGroup(child);
199             }
200
201             RemoveChild(child);
202         }
203
204         /// <summary>
205         /// Retrieves a child view by index.
206         /// </summary>
207         /// <seealso cref="Container.GetChildAt" />
208         /// <since_tizen> 4 </since_tizen>
209         public override View GetChildAt(uint index)
210         {
211             if (index < Children.Count)
212             {
213                 return Children[Convert.ToInt32(index)];
214             }
215             else
216             {
217                 return null;
218             }
219         }
220
221         /// <summary>
222         /// Retrieves the number of children held by the view.
223         /// </summary>
224         /// <seealso cref="Container.GetChildCount" />
225         /// <since_tizen> 4 </since_tizen>
226         [Obsolete("Deprecated in API9, will be removed in API11. Please use ChildCount property instead!")]
227         public override uint GetChildCount()
228         {
229             return Convert.ToUInt32(Children.Count);
230         }
231
232         /// <summary>
233         /// Gets the views parent.
234         /// </summary>
235         /// <seealso cref="Container.GetParent()" />
236         /// <since_tizen> 4 </since_tizen>
237         public override Container GetParent()
238         {
239             return InternalParent as Container;
240         }
241
242         /// <summary>
243         /// Queries whether the view has a focus.
244         /// </summary>
245         /// <returns>True if this view has a focus.</returns>
246         /// <since_tizen> 3 </since_tizen>
247         public bool HasFocus()
248         {
249             bool ret = false;
250             if (SwigCPtr.Handle != global::System.IntPtr.Zero)
251             {
252                 ret = Interop.View.HasKeyInputFocus(SwigCPtr);
253                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254             }
255             else
256             {
257                 Tizen.Log.Error("NUI", "swigCPtr of view is already disposed.");
258             }
259             return ret;
260         }
261
262         /// <summary>
263         /// Sets the name of the style to be applied to the view.
264         /// </summary>
265         /// <param name="styleName">A string matching a style described in a stylesheet.</param>
266         /// <since_tizen> 3 </since_tizen>
267         [Obsolete("Deprecated in API9, will be removed in API11. Please use StyleName property instead!")]
268         public void SetStyleName(string styleName)
269         {
270             Interop.View.SetStyleName(SwigCPtr, styleName);
271             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272         }
273
274         /// <summary>
275         /// Retrieves the name of the style to be applied to the view (if any).
276         /// </summary>
277         /// <returns>A string matching a style, or an empty string.</returns>
278         /// <since_tizen> 3 </since_tizen>
279         [Obsolete("Deprecated in API9, will be removed in API11. Please use StyleName property instead!")]
280         public string GetStyleName()
281         {
282             string ret = Interop.View.GetStyleName(SwigCPtr);
283             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284             return ret;
285         }
286
287         /// <summary>
288         /// Clears the background.
289         /// </summary>
290         /// <since_tizen> 3 </since_tizen>
291         public void ClearBackground()
292         {
293             Interop.View.ClearBackground(SwigCPtr);
294             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295         }
296
297         /// <summary>
298         /// Shows the view.
299         /// </summary>
300         /// <remarks>
301         /// This is an asynchronous method.
302         /// </remarks>
303         /// <since_tizen> 3 </since_tizen>
304         public void Show()
305         {
306             SetVisible(true);
307
308             if (((GetAccessibilityStates() & AccessibilityStates.Modal) != 0))
309             {
310                 RegisterDefaultLabel();
311
312                 if (Accessibility.Accessibility.Enabled)
313                 {
314                     EmitAccessibilityStatesChangedEvent(AccessibilityStates.Showing, true);
315                 }
316             }
317         }
318
319         /// <summary>
320         /// Hides the view.
321         /// </summary>
322         /// <remarks>
323         /// This is an asynchronous method.
324         /// If the view is hidden, then the view and its children will not be rendered.
325         /// This is regardless of the individual visibility of the children, i.e., the view will only be rendered if all of its parents are shown.
326         /// </remarks>
327         /// <since_tizen> 3 </since_tizen>
328         public void Hide()
329         {
330             SetVisible(false);
331
332             if (((GetAccessibilityStates() & AccessibilityStates.Modal) != 0))
333             {
334                 UnregisterDefaultLabel();
335
336                 if (Accessibility.Accessibility.Enabled)
337                 {
338                     EmitAccessibilityStatesChangedEvent(AccessibilityStates.Showing, false);
339                 }
340             }
341         }
342
343         /// <summary>
344         /// Raises the view above all other views.
345         /// </summary>
346         /// <remarks>
347         /// Sibling order of views within the parent will be updated automatically.
348         /// Once a raise or lower API is used, that view will then have an exclusive sibling order independent of insertion.
349         /// </remarks>
350         /// <since_tizen> 3 </since_tizen>
351         public void RaiseToTop()
352         {
353             var parentChildren = GetParent()?.Children;
354
355             if (parentChildren != null)
356             {
357                 parentChildren.Remove(this);
358                 parentChildren.Add(this);
359
360                 LayoutGroup layout = Layout as LayoutGroup;
361                 layout?.ChangeLayoutSiblingOrder(parentChildren.Count - 1);
362
363                 Interop.NDalic.RaiseToTop(SwigCPtr);
364                 if (NDalicPINVOKE.SWIGPendingException.Pending)
365                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
366             }
367
368         }
369
370         /// <summary>
371         /// Lowers the view to the bottom of all views.
372         /// </summary>
373         /// <remarks>
374         /// The sibling order of views within the parent will be updated automatically.
375         /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
376         /// </remarks>
377         /// <since_tizen> 3 </since_tizen>
378         public void LowerToBottom()
379         {
380             var parentChildren = GetParent()?.Children;
381
382             if (parentChildren != null)
383             {
384                 parentChildren.Remove(this);
385                 parentChildren.Insert(0, this);
386
387                 LayoutGroup layout = Layout as LayoutGroup;
388                 layout?.ChangeLayoutSiblingOrder(0);
389
390                 Interop.NDalic.LowerToBottom(SwigCPtr);
391                 if (NDalicPINVOKE.SWIGPendingException.Pending)
392                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393             }
394         }
395
396         /// <summary>
397         /// Queries if all resources required by a view are loaded and ready.
398         /// </summary>
399         /// <remarks>Most resources are only loaded when the control is placed on the stage.
400         /// </remarks>
401         /// <since_tizen> 3 </since_tizen>
402         public bool IsResourceReady()
403         {
404             bool ret = Interop.View.IsResourceReady(SwigCPtr);
405             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
406             return ret;
407         }
408
409         /// <summary>
410         /// Gets the parent layer of this view.If a view has no parent, this method does not do anything.
411         /// </summary>
412         /// <pre>The view has been initialized. </pre>
413         /// <returns>The parent layer of view </returns>
414         /// <since_tizen> 5 </since_tizen>
415         public Layer GetLayer()
416         {
417             //to fix memory leak issue, match the handle count with native side.
418             IntPtr cPtr = Interop.Actor.GetLayer(SwigCPtr);
419             Layer ret = this.GetInstanceSafely<Layer>(cPtr);
420             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421             return ret;
422         }
423
424         /// <summary>
425         /// Removes a view from its parent view or layer. If a view has no parent, this method does nothing.
426         /// </summary>
427         /// <pre>The (child) view has been initialized. </pre>
428         /// <since_tizen> 4 </since_tizen>
429         public void Unparent()
430         {
431             GetParent()?.Remove(this);
432         }
433
434         /// <summary>
435         /// Search through this view's hierarchy for a view with the given name.
436         /// The view itself is also considered in the search.
437         /// </summary>
438         /// <pre>The view has been initialized.</pre>
439         /// <param name="viewName">The name of the view to find.</param>
440         /// <returns>A handle to the view if found, or an empty handle if not.</returns>
441         /// <since_tizen> 3 </since_tizen>
442         public View FindChildByName(string viewName)
443         {
444             //to fix memory leak issue, match the handle count with native side.
445             IntPtr cPtr = Interop.Actor.FindChildByName(SwigCPtr, viewName);
446             View ret = this.GetInstanceSafely<View>(cPtr);
447             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
448             return ret;
449         }
450
451         /// <summary>
452         /// Converts screen coordinates into the view's coordinate system using the default camera.
453         /// </summary>
454         /// <pre>The view has been initialized.</pre>
455         /// <remarks>The view coordinates are relative to the top-left(0.0, 0.0, 0.5).</remarks>
456         /// <param name="localX">On return, the X-coordinate relative to the view.</param>
457         /// <param name="localY">On return, the Y-coordinate relative to the view.</param>
458         /// <param name="screenX">The screen X-coordinate.</param>
459         /// <param name="screenY">The screen Y-coordinate.</param>
460         /// <returns>True if the conversion succeeded.</returns>
461         /// <since_tizen> 3 </since_tizen>
462         public bool ScreenToLocal(out float localX, out float localY, float screenX, float screenY)
463         {
464             bool ret = Interop.Actor.ScreenToLocal(SwigCPtr, out localX, out localY, screenX, screenY);
465             if (NDalicPINVOKE.SWIGPendingException.Pending)
466                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
467             return ret;
468         }
469
470         /// <summary>
471         /// Sets the relative to parent size factor of the view.<br />
472         /// This factor is only used when ResizePolicy is set to either:
473         /// ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.<br />
474         /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicy.<br />
475         /// </summary>
476         /// <pre>The view has been initialized.</pre>
477         /// <param name="factor">A Vector3 representing the relative factor to be applied to each axis.</param>
478         /// <since_tizen> 3 </since_tizen>
479         public void SetSizeModeFactor(Vector3 factor)
480         {
481             Interop.Actor.SetSizeModeFactor(SwigCPtr, Vector3.getCPtr(factor));
482             if (NDalicPINVOKE.SWIGPendingException.Pending)
483                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
484         }
485         /// <summary>
486         /// Calculates the height of the view given a width.<br />
487         /// The natural size is used for default calculation.<br />
488         /// Size 0 is treated as aspect ratio 1:1.<br />
489         /// </summary>
490         /// <param name="width">The width to use.</param>
491         /// <returns>The height based on the width.</returns>
492         /// <since_tizen> 3 </since_tizen>
493         public float GetHeightForWidth(float width)
494         {
495             float ret = Interop.Actor.GetHeightForWidth(SwigCPtr, width);
496             if (NDalicPINVOKE.SWIGPendingException.Pending)
497                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
498             return ret;
499         }
500
501         /// <summary>
502         /// Calculates the width of the view given a height.<br />
503         /// The natural size is used for default calculation.<br />
504         /// Size 0 is treated as aspect ratio 1:1.<br />
505         /// </summary>
506         /// <param name="height">The height to use.</param>
507         /// <returns>The width based on the height.</returns>
508         /// <since_tizen> 3 </since_tizen>
509         public float GetWidthForHeight(float height)
510         {
511             float ret = Interop.Actor.GetWidthForHeight(SwigCPtr, height);
512             if (NDalicPINVOKE.SWIGPendingException.Pending)
513                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
514             return ret;
515         }
516
517         /// <summary>
518         /// Return the amount of size allocated for relayout.
519         /// </summary>
520         /// <param name="dimension">The dimension to retrieve.</param>
521         /// <returns>Return the size.</returns>
522         /// <since_tizen> 3 </since_tizen>
523         public float GetRelayoutSize(DimensionType dimension)
524         {
525             float ret = Interop.Actor.GetRelayoutSize(SwigCPtr, (int)dimension);
526             if (NDalicPINVOKE.SWIGPendingException.Pending)
527                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
528             return ret;
529         }
530
531         /// <summary>
532         /// Set the padding for the view.
533         /// </summary>
534         /// <param name="padding">Padding for the view.</param>
535         /// <since_tizen> 3 </since_tizen>
536         // [Obsolete("Deprecated in API9, will be removed in API11. Please use Padding property instead!")]
537         public void SetPadding(PaddingType padding)
538         {
539             Interop.Actor.SetPadding(SwigCPtr, PaddingType.getCPtr(padding));
540             if (NDalicPINVOKE.SWIGPendingException.Pending)
541                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542         }
543
544         /// <summary>
545         /// Return the value of padding for the view.
546         /// </summary>
547         /// <param name="paddingOut">the value of padding for the view</param>
548         /// <since_tizen> 3 </since_tizen>
549         [Obsolete("Deprecated in API9, will be removed in API11. Please use Padding property instead!")]
550         public void GetPadding(PaddingType paddingOut)
551         {
552             Interop.Actor.GetPadding(SwigCPtr, PaddingType.getCPtr(paddingOut));
553             if (NDalicPINVOKE.SWIGPendingException.Pending)
554                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
555         }
556
557         /// <since_tizen> 3 </since_tizen>
558         public uint AddRenderer(Renderer renderer)
559         {
560             uint ret = Interop.Actor.AddRenderer(SwigCPtr, Renderer.getCPtr(renderer));
561             if (NDalicPINVOKE.SWIGPendingException.Pending)
562                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
563             return ret;
564         }
565
566         /// <since_tizen> 3 </since_tizen>
567         public Renderer GetRendererAt(uint index)
568         {
569             //to fix memory leak issue, match the handle count with native side.
570             IntPtr cPtr = Interop.Actor.GetRendererAt(SwigCPtr, index);
571             HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
572             Renderer ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Renderer;
573             if (cPtr != null && ret == null)
574             {
575                 ret = new Renderer(cPtr, false);
576                 if (NDalicPINVOKE.SWIGPendingException.Pending)
577                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
578                 return ret;
579             }
580             Interop.BaseHandle.DeleteBaseHandle(CPtr);
581             CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
582
583             if (NDalicPINVOKE.SWIGPendingException.Pending)
584                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
585             return ret;
586         }
587
588         /// <since_tizen> 3 </since_tizen>
589         public void RemoveRenderer(Renderer renderer)
590         {
591             Interop.Actor.RemoveRenderer(SwigCPtr, Renderer.getCPtr(renderer));
592             if (NDalicPINVOKE.SWIGPendingException.Pending)
593                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
594         }
595
596         /// <since_tizen> 3 </since_tizen>
597         public void RemoveRenderer(uint index)
598         {
599             Interop.Actor.RemoveRenderer(SwigCPtr, index);
600             if (NDalicPINVOKE.SWIGPendingException.Pending)
601                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
602         }
603
604         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
605         [EditorBrowsable(EditorBrowsableState.Never)]
606         public void RotateBy(Degree angle, Vector3 axis)
607         {
608             Interop.ActorInternal.RotateByDegree(SwigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
609             if (NDalicPINVOKE.SWIGPendingException.Pending)
610                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
611         }
612
613         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
614         [EditorBrowsable(EditorBrowsableState.Never)]
615         public void RotateBy(Radian angle, Vector3 axis)
616         {
617             Interop.ActorInternal.RotateByRadian(SwigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
618             if (NDalicPINVOKE.SWIGPendingException.Pending)
619                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620         }
621
622         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
623         [EditorBrowsable(EditorBrowsableState.Never)]
624         public void RotateBy(Rotation relativeRotation)
625         {
626             Interop.ActorInternal.RotateByQuaternion(SwigCPtr, Rotation.getCPtr(relativeRotation));
627             if (NDalicPINVOKE.SWIGPendingException.Pending)
628                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
629         }
630
631         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
632         [EditorBrowsable(EditorBrowsableState.Never)]
633         public void ScaleBy(Vector3 relativeScale)
634         {
635             Interop.ActorInternal.ScaleBy(SwigCPtr, Vector3.getCPtr(relativeScale));
636             if (NDalicPINVOKE.SWIGPendingException.Pending)
637                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
638         }
639
640         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
641         [EditorBrowsable(EditorBrowsableState.Never)]
642         public void SetColorMode(ColorMode colorMode)
643         {
644             Interop.ActorInternal.SetColorMode(SwigCPtr, (int)colorMode);
645             if (NDalicPINVOKE.SWIGPendingException.Pending)
646                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
647         }
648
649         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
650         [EditorBrowsable(EditorBrowsableState.Never)]
651         public void ObjectDump()
652         {
653             if (0 == Children.Count)
654             {
655                 Type type = this.GetType();
656                 PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
657                 foreach (var property in properties)
658                 {
659                     if (null != property && property.CanRead)
660                     {
661                         Tizen.Log.Fatal("NUI", $"{type.Name} {property.Name} ({property.PropertyType.Name}): {property.GetValueString(this, property.PropertyType)}");
662                     }
663                 }
664                 return;
665             }
666
667             foreach (View view in Children)
668             {
669                 view.ObjectDump();
670             }
671         }
672
673         /// <summary>
674         /// Search through this View's hierarchy for a View with the given unique ID.
675         /// The View itself is also considered in the search.
676         /// </summary>
677         /// <param name="id">The ID of the View to find</param>
678         /// <returns>A View if found or a null if not</returns>
679         [EditorBrowsable(EditorBrowsableState.Never)]
680         [Obsolete("This will be removed at API11! please use FindDescendantByID(uint id) instead!")]
681         public View FindChildByID(uint id)
682         {
683             IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
684             View ret = this.GetInstanceSafely<View>(cPtr);
685             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
686             return ret;
687         }
688
689         /// <summary>
690         /// Search through this View's hierarchy for a View with the given unique ID.
691         /// </summary>
692         /// <param name="id">The ID of the View to find.</param>
693         /// <returns>A handle to the View if found, or an empty handle if not.</returns>
694         /// <since_tizen> 9 </since_tizen>
695         public View FindDescendantByID(uint id)
696         {
697             return FindChildById(id);
698         }
699
700         /// <summary>
701         /// Raise view above the next sibling view.
702         /// </summary>
703         /// <since_tizen> 9 </since_tizen>
704         public void Raise()
705         {
706             var parentChildren = GetParent()?.Children;
707
708             if (parentChildren != null)
709             {
710                 int currentIndex = parentChildren.IndexOf(this);
711
712                 // If the view is not already the last item in the list.
713                 if (currentIndex >= 0 && currentIndex < parentChildren.Count - 1)
714                 {
715                     View temp = parentChildren[currentIndex + 1];
716                     parentChildren[currentIndex + 1] = this;
717                     parentChildren[currentIndex] = temp;
718
719                     Interop.NDalic.Raise(SwigCPtr);
720                     if (NDalicPINVOKE.SWIGPendingException.Pending)
721                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
722                 }
723             }
724         }
725
726         /// <summary>
727         /// Lower the view below the previous sibling view.
728         /// </summary>
729         /// <since_tizen> 9 </since_tizen>
730         public void Lower()
731         {
732             var parentChildren = GetParent()?.Children;
733
734             if (parentChildren != null)
735             {
736                 int currentIndex = parentChildren.IndexOf(this);
737
738                 // If the view is not already the first item in the list.
739                 if (currentIndex > 0 && currentIndex < parentChildren.Count)
740                 {
741                     View temp = parentChildren[currentIndex - 1];
742                     parentChildren[currentIndex - 1] = this;
743                     parentChildren[currentIndex] = temp;
744
745                     Interop.NDalic.Lower(SwigCPtr);
746                     if (NDalicPINVOKE.SWIGPendingException.Pending)
747                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
748                 }
749             }
750         }
751
752         /// <summary>
753         /// Raises the view to above the target view.
754         /// </summary>
755         /// <remarks>The sibling order of views within the parent will be updated automatically.
756         /// Views on the level above the target view will still be shown above this view.
757         /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
758         /// </remarks>
759         /// <param name="target">Will be raised above this view.</param>
760         /// <since_tizen> 9 </since_tizen>
761         public void RaiseAbove(View target)
762         {
763             var parentChildren = GetParent()?.Children;
764
765             if (parentChildren != null)
766             {
767                 int currentIndex = parentChildren.IndexOf(this);
768                 int targetIndex = parentChildren.IndexOf(target);
769
770                 if (currentIndex < 0 || targetIndex < 0 ||
771                     currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
772                 {
773                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
774                     return;
775                 }
776                 // If the currentIndex is less than the target index and the target has the same parent.
777                 if (currentIndex < targetIndex)
778                 {
779                     parentChildren.Remove(this);
780                     parentChildren.Insert(targetIndex, this);
781
782                     Interop.NDalic.RaiseAbove(SwigCPtr, View.getCPtr(target));
783                     if (NDalicPINVOKE.SWIGPendingException.Pending)
784                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
785                 }
786             }
787
788         }
789
790         /// <summary>
791         /// Lowers the view to below the target view.
792         /// </summary>
793         /// <remarks>The sibling order of views within the parent will be updated automatically.
794         /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
795         /// </remarks>
796         /// <param name="target">Will be lowered below this view.</param>
797         /// <since_tizen> 9 </since_tizen>
798         public void LowerBelow(View target)
799         {
800             var parentChildren = GetParent()?.Children;
801
802             if (parentChildren != null)
803             {
804                 int currentIndex = parentChildren.IndexOf(this);
805                 int targetIndex = parentChildren.IndexOf(target);
806                 if (currentIndex < 0 || targetIndex < 0 ||
807                    currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
808                 {
809                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
810                     return;
811                 }
812
813                 // If the currentIndex is not already the 0th index and the target has the same parent.
814                 if ((currentIndex != 0) && (targetIndex != -1) &&
815                     (currentIndex > targetIndex))
816                 {
817                     parentChildren.Remove(this);
818                     parentChildren.Insert(targetIndex, this);
819
820                     Interop.NDalic.LowerBelow(SwigCPtr, View.getCPtr(target));
821                     if (NDalicPINVOKE.SWIGPendingException.Pending)
822                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823                 }
824             }
825
826         }
827
828     }
829 }