2 * Copyright(c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.ComponentModel;
20 using System.Reflection;
21 using System.Runtime.InteropServices;
22 using Tizen.NUI.Binding;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View
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.
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)
42 Interop.View.DoAction(SwigCPtr, propertyIndexOfVisual, propertyIndexOfActionId, PropertyValue.getCPtr(attributes));
43 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.
50 /// <since_tizen> 3 </since_tizen>
51 public Animation AnimateBackgroundColor(object destinationValue,
54 AlphaFunction.BuiltinFunctions? alphaFunction = null,
55 object initialValue = null)
57 Tizen.NUI.PropertyMap background = Background;
59 if (background.Empty())
61 // If there is no background yet, ensure there is a transparent
63 BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
64 background = Background;
66 return AnimateColor("background", destinationValue, startTime, endTime, alphaFunction, initialValue);
70 /// Creates an animation to animate the mixColor of the named visual.
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)
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))
85 if (alphaFunction != null)
87 using (PropertyValue pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(alphaFunction)))
89 animator.Add("alphaFunction", pvAlpha);
93 timePeriod.Add("duration", pvDuration);
94 timePeriod.Add("delay", pvDelay);
95 using (PropertyValue pvTimePeriod = new PropertyValue(timePeriod))
97 animator.Add("timePeriod", pvTimePeriod);
99 using (PropertyValue pvAnimator = new PropertyValue(animator))
101 transition.Add("animator", pvAnimator);
103 transition.Add("target", pvTarget);
104 transition.Add("property", pvProperty);
106 if (initialColor != null)
108 using (PropertyValue initValue = PropertyValue.CreateFromObject(initialColor))
110 transition.Add("initialValue", initValue);
114 transition.Add("targetValue", destValue);
115 using (TransitionData transitionData = new TransitionData(transition))
117 animation = new Animation(Interop.View.CreateTransition(SwigCPtr, TransitionData.getCPtr(transitionData)), true);
119 if (NDalicPINVOKE.SWIGPendingException.Pending)
120 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125 // From Container Base class
127 /// Adds a child view to this view.
129 /// <seealso cref="Container.Add" />
130 /// <since_tizen> 4 </since_tizen>
131 public override void Add(View child)
133 bool hasLayout = (layout != null);
137 Tizen.Log.Fatal("NUI", "Child is null");
141 Container oldParent = child.GetParent();
142 if (oldParent != this)
144 // If child already has a parent then re-parent child
145 if (oldParent != null)
147 if (child.Layout != null)
149 child.Layout.SetReplaceFlag();
151 oldParent.Remove(child);
153 child.InternalParent = this;
154 LayoutCount += child.LayoutCount;
156 Interop.Actor.Add(SwigCPtr, View.getCPtr(child));
158 if (NDalicPINVOKE.SWIGPendingException.Pending)
159 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162 if (ChildAdded != null)
164 ChildAddedEventArgs e = new ChildAddedEventArgs
171 AddChildBindableObject(child);
176 /// Removes a child view from this View. If the view was not a child of this view, this is a no-op.
178 /// <seealso cref="Container.Remove" />
179 /// <since_tizen> 4 </since_tizen>
180 /// <exception cref="InvalidOperationException">Thrown when deleting a view that is not a child of this view</exception>
181 public override void Remove(View child)
183 if (child == null || child.GetParent() == null) // Early out if child null.
186 if (child.GetParent() != this)
188 //throw new System.InvalidOperationException("You have deleted a view that is not a child of this view.");
189 Tizen.Log.Error("NUI", "You have deleted a view that is not a child of this view.");
193 bool hasLayout = (layout != null);
195 // If View has a layout then do a deferred child removal
196 // Actual child removal is performed by the layouting system so
197 // transitions can be completed.
200 (layout as LayoutGroup)?.RemoveChildFromLayoutGroup(child);
207 /// Retrieves a child view by index.
209 /// <seealso cref="Container.GetChildAt" />
210 /// <since_tizen> 4 </since_tizen>
211 public override View GetChildAt(uint index)
213 if (index < Children.Count)
215 return Children[Convert.ToInt32(index)];
224 /// Retrieves the number of children held by the view.
226 /// <seealso cref="Container.GetChildCount" />
227 /// <since_tizen> 4 </since_tizen>
228 [Obsolete("Deprecated in API9, will be removed in API11. Please use ChildCount property instead!")]
229 public override uint GetChildCount()
231 return Convert.ToUInt32(Children.Count);
235 /// Gets the views parent.
237 /// <seealso cref="Container.GetParent()" />
238 /// <since_tizen> 4 </since_tizen>
239 public override Container GetParent()
241 return InternalParent as Container;
245 /// Queries whether the view has a focus.
247 /// <returns>True if this view has a focus.</returns>
248 /// <since_tizen> 3 </since_tizen>
249 public bool HasFocus()
252 if (SwigCPtr.Handle != global::System.IntPtr.Zero)
254 ret = Interop.View.HasKeyInputFocus(SwigCPtr);
255 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259 Tizen.Log.Error("NUI", "swigCPtr of view is already disposed.");
265 /// Sets the name of the style to be applied to the view.
267 /// <param name="styleName">A string matching a style described in a stylesheet.</param>
268 /// <since_tizen> 3 </since_tizen>
269 [Obsolete("Deprecated in API9, will be removed in API11. Please use StyleName property instead!")]
270 public void SetStyleName(string styleName)
272 Interop.View.SetStyleName(SwigCPtr, styleName);
273 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277 /// Retrieves the name of the style to be applied to the view (if any).
279 /// <returns>A string matching a style, or an empty string.</returns>
280 /// <since_tizen> 3 </since_tizen>
281 [Obsolete("Deprecated in API9, will be removed in API11. Please use StyleName property instead!")]
282 public string GetStyleName()
284 string ret = Interop.View.GetStyleName(SwigCPtr);
285 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290 /// Clears the background.
292 /// <since_tizen> 3 </since_tizen>
293 public void ClearBackground()
295 Interop.View.ClearBackground(SwigCPtr);
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303 /// This is an asynchronous method.
305 /// <since_tizen> 3 </since_tizen>
310 if (((GetAccessibilityStates() & AccessibilityStates.Modal) != 0))
312 RegisterDefaultLabel();
314 if (Accessibility.Accessibility.IsEnabled)
316 EmitAccessibilityStatesChangedEvent(AccessibilityStates.Showing, true);
325 /// This is an asynchronous method.
326 /// If the view is hidden, then the view and its children will not be rendered.
327 /// 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.
329 /// <since_tizen> 3 </since_tizen>
334 if (((GetAccessibilityStates() & AccessibilityStates.Modal) != 0))
336 UnregisterDefaultLabel();
338 if (Accessibility.Accessibility.IsEnabled)
340 EmitAccessibilityStatesChangedEvent(AccessibilityStates.Showing, false);
346 /// Raises the view above all other views.
349 /// Sibling order of views within the parent will be updated automatically.
350 /// Once a raise or lower API is used, that view will then have an exclusive sibling order independent of insertion.
352 /// <since_tizen> 3 </since_tizen>
353 public void RaiseToTop()
355 var parentChildren = GetParent()?.Children;
357 if (parentChildren != null)
359 parentChildren.Remove(this);
360 parentChildren.Add(this);
362 LayoutGroup layout = Layout as LayoutGroup;
363 layout?.ChangeLayoutSiblingOrder(parentChildren.Count - 1);
365 Interop.NDalic.RaiseToTop(SwigCPtr);
366 if (NDalicPINVOKE.SWIGPendingException.Pending)
367 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
373 /// Lowers the view to the bottom of all views.
376 /// The sibling order of views within the parent will be updated automatically.
377 /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
379 /// <since_tizen> 3 </since_tizen>
380 public void LowerToBottom()
382 var parentChildren = GetParent()?.Children;
384 if (parentChildren != null)
386 parentChildren.Remove(this);
387 parentChildren.Insert(0, this);
389 LayoutGroup layout = Layout as LayoutGroup;
390 layout?.ChangeLayoutSiblingOrder(0);
392 Interop.NDalic.LowerToBottom(SwigCPtr);
393 if (NDalicPINVOKE.SWIGPendingException.Pending)
394 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
399 /// Queries if all resources required by a view are loaded and ready.
401 /// <remarks>Most resources are only loaded when the control is placed on the stage.
403 /// <since_tizen> 3 </since_tizen>
404 public bool IsResourceReady()
406 bool ret = Interop.View.IsResourceReady(SwigCPtr);
407 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
412 /// Gets the parent layer of this view.If a view has no parent, this method does not do anything.
414 /// <pre>The view has been initialized. </pre>
415 /// <returns>The parent layer of view </returns>
416 /// <since_tizen> 5 </since_tizen>
417 public Layer GetLayer()
419 //to fix memory leak issue, match the handle count with native side.
420 IntPtr cPtr = Interop.Actor.GetLayer(SwigCPtr);
421 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
422 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427 /// Removes a view from its parent view or layer. If a view has no parent, this method does nothing.
429 /// <pre>The (child) view has been initialized. </pre>
430 /// <since_tizen> 4 </since_tizen>
431 public void Unparent()
433 GetParent()?.Remove(this);
437 /// Search through this view's hierarchy for a view with the given name.
438 /// The view itself is also considered in the search.
440 /// <pre>The view has been initialized.</pre>
441 /// <param name="viewName">The name of the view to find.</param>
442 /// <returns>A handle to the view if found, or an empty handle if not.</returns>
443 /// <since_tizen> 3 </since_tizen>
444 public View FindChildByName(string viewName)
446 //to fix memory leak issue, match the handle count with native side.
447 IntPtr cPtr = Interop.Actor.FindChildByName(SwigCPtr, viewName);
448 View ret = this.GetInstanceSafely<View>(cPtr);
449 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
454 /// Converts screen coordinates into the view's coordinate system using the default camera.
456 /// <pre>The view has been initialized.</pre>
457 /// <remarks>The view coordinates are relative to the top-left(0.0, 0.0, 0.5).</remarks>
458 /// <param name="localX">On return, the X-coordinate relative to the view.</param>
459 /// <param name="localY">On return, the Y-coordinate relative to the view.</param>
460 /// <param name="screenX">The screen X-coordinate.</param>
461 /// <param name="screenY">The screen Y-coordinate.</param>
462 /// <returns>True if the conversion succeeded.</returns>
463 /// <since_tizen> 3 </since_tizen>
464 public bool ScreenToLocal(out float localX, out float localY, float screenX, float screenY)
466 bool ret = Interop.Actor.ScreenToLocal(SwigCPtr, out localX, out localY, screenX, screenY);
467 if (NDalicPINVOKE.SWIGPendingException.Pending)
468 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
473 /// Sets the relative to parent size factor of the view.<br />
474 /// This factor is only used when ResizePolicy is set to either:
475 /// ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.<br />
476 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicy.<br />
478 /// <pre>The view has been initialized.</pre>
479 /// <param name="factor">A Vector3 representing the relative factor to be applied to each axis.</param>
480 /// <since_tizen> 3 </since_tizen>
481 public void SetSizeModeFactor(Vector3 factor)
483 Interop.Actor.SetSizeModeFactor(SwigCPtr, Vector3.getCPtr(factor));
484 if (NDalicPINVOKE.SWIGPendingException.Pending)
485 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
488 /// Calculates the height of the view given a width.<br />
489 /// The natural size is used for default calculation.<br />
490 /// Size 0 is treated as aspect ratio 1:1.<br />
492 /// <param name="width">The width to use.</param>
493 /// <returns>The height based on the width.</returns>
494 /// <since_tizen> 3 </since_tizen>
495 public float GetHeightForWidth(float width)
497 float ret = Interop.Actor.GetHeightForWidth(SwigCPtr, width);
498 if (NDalicPINVOKE.SWIGPendingException.Pending)
499 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
504 /// Calculates the width of the view given a height.<br />
505 /// The natural size is used for default calculation.<br />
506 /// Size 0 is treated as aspect ratio 1:1.<br />
508 /// <param name="height">The height to use.</param>
509 /// <returns>The width based on the height.</returns>
510 /// <since_tizen> 3 </since_tizen>
511 public float GetWidthForHeight(float height)
513 float ret = Interop.Actor.GetWidthForHeight(SwigCPtr, height);
514 if (NDalicPINVOKE.SWIGPendingException.Pending)
515 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
520 /// Return the amount of size allocated for relayout.
522 /// <param name="dimension">The dimension to retrieve.</param>
523 /// <returns>Return the size.</returns>
524 /// <since_tizen> 3 </since_tizen>
525 public float GetRelayoutSize(DimensionType dimension)
527 float ret = Interop.Actor.GetRelayoutSize(SwigCPtr, (int)dimension);
528 if (NDalicPINVOKE.SWIGPendingException.Pending)
529 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
534 /// Set the padding for the view.
536 /// <param name="padding">Padding for the view.</param>
537 /// <since_tizen> 3 </since_tizen>
538 // [Obsolete("Deprecated in API9, will be removed in API11. Please use Padding property instead!")]
539 public void SetPadding(PaddingType padding)
541 Interop.Actor.SetPadding(SwigCPtr, PaddingType.getCPtr(padding));
542 if (NDalicPINVOKE.SWIGPendingException.Pending)
543 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
547 /// Return the value of padding for the view.
549 /// <param name="paddingOut">the value of padding for the view</param>
550 /// <since_tizen> 3 </since_tizen>
551 [Obsolete("Deprecated in API9, will be removed in API11. Please use Padding property instead!")]
552 public void GetPadding(PaddingType paddingOut)
554 Interop.Actor.GetPadding(SwigCPtr, PaddingType.getCPtr(paddingOut));
555 if (NDalicPINVOKE.SWIGPendingException.Pending)
556 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
559 /// <since_tizen> 3 </since_tizen>
560 public uint AddRenderer(Renderer renderer)
562 uint ret = Interop.Actor.AddRenderer(SwigCPtr, Renderer.getCPtr(renderer));
563 if (NDalicPINVOKE.SWIGPendingException.Pending)
564 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
568 /// <since_tizen> 3 </since_tizen>
569 public Renderer GetRendererAt(uint index)
571 //to fix memory leak issue, match the handle count with native side.
572 IntPtr cPtr = Interop.Actor.GetRendererAt(SwigCPtr, index);
573 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
574 Renderer ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Renderer;
575 if (cPtr != null && ret == null)
577 ret = new Renderer(cPtr, false);
578 if (NDalicPINVOKE.SWIGPendingException.Pending)
579 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
582 Interop.BaseHandle.DeleteBaseHandle(CPtr);
583 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
585 if (NDalicPINVOKE.SWIGPendingException.Pending)
586 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590 /// <since_tizen> 3 </since_tizen>
591 public void RemoveRenderer(Renderer renderer)
593 Interop.Actor.RemoveRenderer(SwigCPtr, Renderer.getCPtr(renderer));
594 if (NDalicPINVOKE.SWIGPendingException.Pending)
595 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598 /// <since_tizen> 3 </since_tizen>
599 public void RemoveRenderer(uint index)
601 Interop.Actor.RemoveRenderer(SwigCPtr, index);
602 if (NDalicPINVOKE.SWIGPendingException.Pending)
603 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
606 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
607 [EditorBrowsable(EditorBrowsableState.Never)]
608 public void RotateBy(Degree angle, Vector3 axis)
610 Interop.ActorInternal.RotateByDegree(SwigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
611 if (NDalicPINVOKE.SWIGPendingException.Pending)
612 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
615 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
616 [EditorBrowsable(EditorBrowsableState.Never)]
617 public void RotateBy(Radian angle, Vector3 axis)
619 Interop.ActorInternal.RotateByRadian(SwigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
620 if (NDalicPINVOKE.SWIGPendingException.Pending)
621 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
624 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
625 [EditorBrowsable(EditorBrowsableState.Never)]
626 public void RotateBy(Rotation relativeRotation)
628 Interop.ActorInternal.RotateByQuaternion(SwigCPtr, Rotation.getCPtr(relativeRotation));
629 if (NDalicPINVOKE.SWIGPendingException.Pending)
630 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
633 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
634 [EditorBrowsable(EditorBrowsableState.Never)]
635 public void ScaleBy(Vector3 relativeScale)
637 Interop.ActorInternal.ScaleBy(SwigCPtr, Vector3.getCPtr(relativeScale));
638 if (NDalicPINVOKE.SWIGPendingException.Pending)
639 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
642 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
643 [EditorBrowsable(EditorBrowsableState.Never)]
644 public void SetColorMode(ColorMode colorMode)
646 Interop.ActorInternal.SetColorMode(SwigCPtr, (int)colorMode);
647 if (NDalicPINVOKE.SWIGPendingException.Pending)
648 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
651 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
652 [EditorBrowsable(EditorBrowsableState.Never)]
653 public void ObjectDump()
655 if (0 == Children.Count)
657 Type type = this.GetType();
658 PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
659 foreach (var property in properties)
661 if (null != property && property.CanRead)
663 Tizen.Log.Fatal("NUI", $"{type.Name} {property.Name} ({property.PropertyType.Name}): {property.GetValueString(this, property.PropertyType)}");
669 foreach (View view in Children)
676 /// Search through this View's hierarchy for a View with the given unique ID.
677 /// The View itself is also considered in the search.
679 /// <param name="id">The ID of the View to find</param>
680 /// <returns>A View if found or a null if not</returns>
681 [EditorBrowsable(EditorBrowsableState.Never)]
682 [Obsolete("This will be removed at API11! please use FindDescendantByID(uint id) instead!")]
683 public View FindChildByID(uint id)
685 IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
686 View ret = this.GetInstanceSafely<View>(cPtr);
687 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
692 /// Search through this View's hierarchy for a View with the given unique ID.
694 /// <param name="id">The ID of the View to find.</param>
695 /// <returns>A handle to the View if found, or an empty handle if not.</returns>
696 /// <since_tizen> 9 </since_tizen>
697 public View FindDescendantByID(uint id)
699 return FindChildById(id);
703 /// Raise view above the next sibling view.
705 /// <since_tizen> 9 </since_tizen>
708 var parentChildren = GetParent()?.Children;
710 if (parentChildren != null)
712 int currentIndex = parentChildren.IndexOf(this);
714 // If the view is not already the last item in the list.
715 if (currentIndex >= 0 && currentIndex < parentChildren.Count - 1)
717 View temp = parentChildren[currentIndex + 1];
718 parentChildren[currentIndex + 1] = this;
719 parentChildren[currentIndex] = temp;
721 Interop.NDalic.Raise(SwigCPtr);
722 if (NDalicPINVOKE.SWIGPendingException.Pending)
723 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
729 /// Lower the view below the previous sibling view.
731 /// <since_tizen> 9 </since_tizen>
734 var parentChildren = GetParent()?.Children;
736 if (parentChildren != null)
738 int currentIndex = parentChildren.IndexOf(this);
740 // If the view is not already the first item in the list.
741 if (currentIndex > 0 && currentIndex < parentChildren.Count)
743 View temp = parentChildren[currentIndex - 1];
744 parentChildren[currentIndex - 1] = this;
745 parentChildren[currentIndex] = temp;
747 Interop.NDalic.Lower(SwigCPtr);
748 if (NDalicPINVOKE.SWIGPendingException.Pending)
749 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
755 /// Raises the view to above the target view.
757 /// <remarks>The sibling order of views within the parent will be updated automatically.
758 /// Views on the level above the target view will still be shown above this view.
759 /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
761 /// <param name="target">Will be raised above this view.</param>
762 /// <since_tizen> 9 </since_tizen>
763 public void RaiseAbove(View target)
765 var parentChildren = GetParent()?.Children;
767 if (parentChildren != null)
769 int currentIndex = parentChildren.IndexOf(this);
770 int targetIndex = parentChildren.IndexOf(target);
772 if (currentIndex < 0 || targetIndex < 0 ||
773 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
775 NUILog.Error("index should be bigger than 0 and less than children of layer count");
778 // If the currentIndex is less than the target index and the target has the same parent.
779 if (currentIndex < targetIndex)
781 parentChildren.Remove(this);
782 parentChildren.Insert(targetIndex, this);
784 Interop.NDalic.RaiseAbove(SwigCPtr, View.getCPtr(target));
785 if (NDalicPINVOKE.SWIGPendingException.Pending)
786 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
793 /// Lowers the view to below the target view.
795 /// <remarks>The sibling order of views within the parent will be updated automatically.
796 /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
798 /// <param name="target">Will be lowered below this view.</param>
799 /// <since_tizen> 9 </since_tizen>
800 public void LowerBelow(View target)
802 var parentChildren = GetParent()?.Children;
804 if (parentChildren != null)
806 int currentIndex = parentChildren.IndexOf(this);
807 int targetIndex = parentChildren.IndexOf(target);
808 if (currentIndex < 0 || targetIndex < 0 ||
809 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
811 NUILog.Error("index should be bigger than 0 and less than children of layer count");
815 // If the currentIndex is not already the 0th index and the target has the same parent.
816 if ((currentIndex != 0) && (targetIndex != -1) &&
817 (currentIndex > targetIndex))
819 parentChildren.Remove(this);
820 parentChildren.Insert(targetIndex, this);
822 Interop.NDalic.LowerBelow(SwigCPtr, View.getCPtr(target));
823 if (NDalicPINVOKE.SWIGPendingException.Pending)
824 throw NDalicPINVOKE.SWIGPendingException.Retrieve();