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;
155 Interop.Actor.Add(SwigCPtr, View.getCPtr(child));
157 if (NDalicPINVOKE.SWIGPendingException.Pending)
158 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 if (ChildAdded != null)
163 ChildAddedEventArgs e = new ChildAddedEventArgs
170 AddChildBindableObject(child);
175 /// Removes a child view from this View. If the view was not a child of this view, this is a no-op.
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)
182 if (child == null || child.GetParent() == null) // Early out if child null.
185 if (child.GetParent() != this)
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.");
191 bool hasLayout = (layout != null);
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.
198 (layout as LayoutGroup)?.RemoveChildFromLayoutGroup(child);
205 /// Retrieves a child view by index.
207 /// <seealso cref="Container.GetChildAt" />
208 /// <since_tizen> 4 </since_tizen>
209 public override View GetChildAt(uint index)
211 if (index < Children.Count)
213 return Children[Convert.ToInt32(index)];
222 /// Retrieves the number of children held by the view.
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()
229 return Convert.ToUInt32(Children.Count);
233 /// Gets the views parent.
235 /// <seealso cref="Container.GetParent()" />
236 /// <since_tizen> 4 </since_tizen>
237 public override Container GetParent()
241 return this.InternalParent as Container;
247 /// Queries whether the view has a focus.
249 /// <returns>True if this view has a focus.</returns>
250 /// <since_tizen> 3 </since_tizen>
251 public bool HasFocus()
254 if (SwigCPtr.Handle != global::System.IntPtr.Zero)
256 ret = Interop.View.HasKeyInputFocus(SwigCPtr);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
261 Tizen.Log.Error("NUI", "swigCPtr of view is already disposed.");
267 /// Sets the name of the style to be applied to the view.
269 /// <param name="styleName">A string matching a style described in a stylesheet.</param>
270 /// <since_tizen> 3 </since_tizen>
271 [Obsolete("Deprecated in API9, will be removed in API11. Please use StyleName property instead!")]
272 public void SetStyleName(string styleName)
274 Interop.View.SetStyleName(SwigCPtr, styleName);
275 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279 /// Retrieves the name of the style to be applied to the view (if any).
281 /// <returns>A string matching a style, or an empty string.</returns>
282 /// <since_tizen> 3 </since_tizen>
283 [Obsolete("Deprecated in API9, will be removed in API11. Please use StyleName property instead!")]
284 public string GetStyleName()
286 string ret = Interop.View.GetStyleName(SwigCPtr);
287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
292 /// Clears the background.
294 /// <since_tizen> 3 </since_tizen>
295 public void ClearBackground()
297 Interop.View.ClearBackground(SwigCPtr);
298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305 /// This is an asynchronous method.
307 /// <since_tizen> 3 </since_tizen>
310 if (Accessibility.Accessibility.Enabled && ((AccessibilityCalculateStates() & AccessibilityStates.Modal) != 0))
322 /// This is an asynchronous method.
323 /// If the view is hidden, then the view and its children will not be rendered.
324 /// 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 /// <since_tizen> 3 </since_tizen>
331 if (Accessibility.Accessibility.Enabled && ((AccessibilityCalculateStates() & AccessibilityStates.Modal) != 0))
338 /// Raises the view above all other views.
341 /// Sibling order of views within the parent will be updated automatically.
342 /// Once a raise or lower API is used, that view will then have an exclusive sibling order independent of insertion.
344 /// <since_tizen> 3 </since_tizen>
345 public void RaiseToTop()
347 var parentChildren = GetParent()?.Children;
349 if (parentChildren != null)
351 parentChildren.Remove(this);
352 parentChildren.Add(this);
354 LayoutGroup layout = Layout as LayoutGroup;
355 layout?.ChangeLayoutSiblingOrder(parentChildren.Count - 1);
357 Interop.NDalic.RaiseToTop(SwigCPtr);
358 if (NDalicPINVOKE.SWIGPendingException.Pending)
359 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
365 /// Lowers the view to the bottom of all views.
368 /// The sibling order of views within the parent will be updated automatically.
369 /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
371 /// <since_tizen> 3 </since_tizen>
372 public void LowerToBottom()
374 var parentChildren = GetParent()?.Children;
376 if (parentChildren != null)
378 parentChildren.Remove(this);
379 parentChildren.Insert(0, this);
381 LayoutGroup layout = Layout as LayoutGroup;
382 layout?.ChangeLayoutSiblingOrder(0);
384 Interop.NDalic.LowerToBottom(SwigCPtr);
385 if (NDalicPINVOKE.SWIGPendingException.Pending)
386 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
391 /// Queries if all resources required by a view are loaded and ready.
393 /// <remarks>Most resources are only loaded when the control is placed on the stage.
395 /// <since_tizen> 3 </since_tizen>
396 public bool IsResourceReady()
398 bool ret = Interop.View.IsResourceReady(SwigCPtr);
399 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404 /// Gets the parent layer of this view.If a view has no parent, this method does not do anything.
406 /// <pre>The view has been initialized. </pre>
407 /// <returns>The parent layer of view </returns>
408 /// <since_tizen> 5 </since_tizen>
409 public Layer GetLayer()
411 //to fix memory leak issue, match the handle count with native side.
412 IntPtr cPtr = Interop.Actor.GetLayer(SwigCPtr);
413 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
414 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
419 /// Removes a view from its parent view or layer. If a view has no parent, this method does nothing.
421 /// <pre>The (child) view has been initialized. </pre>
422 /// <since_tizen> 4 </since_tizen>
423 public void Unparent()
425 GetParent()?.Remove(this);
429 /// Search through this view's hierarchy for a view with the given name.
430 /// The view itself is also considered in the search.
432 /// <pre>The view has been initialized.</pre>
433 /// <param name="viewName">The name of the view to find.</param>
434 /// <returns>A handle to the view if found, or an empty handle if not.</returns>
435 /// <since_tizen> 3 </since_tizen>
436 public View FindChildByName(string viewName)
438 //to fix memory leak issue, match the handle count with native side.
439 IntPtr cPtr = Interop.Actor.FindChildByName(SwigCPtr, viewName);
440 View ret = this.GetInstanceSafely<View>(cPtr);
441 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
446 /// Converts screen coordinates into the view's coordinate system using the default camera.
448 /// <pre>The view has been initialized.</pre>
449 /// <remarks>The view coordinates are relative to the top-left(0.0, 0.0, 0.5).</remarks>
450 /// <param name="localX">On return, the X-coordinate relative to the view.</param>
451 /// <param name="localY">On return, the Y-coordinate relative to the view.</param>
452 /// <param name="screenX">The screen X-coordinate.</param>
453 /// <param name="screenY">The screen Y-coordinate.</param>
454 /// <returns>True if the conversion succeeded.</returns>
455 /// <since_tizen> 3 </since_tizen>
456 public bool ScreenToLocal(out float localX, out float localY, float screenX, float screenY)
458 bool ret = Interop.Actor.ScreenToLocal(SwigCPtr, out localX, out localY, screenX, screenY);
459 if (NDalicPINVOKE.SWIGPendingException.Pending)
460 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
465 /// Sets the relative to parent size factor of the view.<br />
466 /// This factor is only used when ResizePolicy is set to either:
467 /// ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.<br />
468 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicy.<br />
470 /// <pre>The view has been initialized.</pre>
471 /// <param name="factor">A Vector3 representing the relative factor to be applied to each axis.</param>
472 /// <since_tizen> 3 </since_tizen>
473 public void SetSizeModeFactor(Vector3 factor)
475 Interop.Actor.SetSizeModeFactor(SwigCPtr, Vector3.getCPtr(factor));
476 if (NDalicPINVOKE.SWIGPendingException.Pending)
477 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
480 /// Calculates the height of the view given a width.<br />
481 /// The natural size is used for default calculation.<br />
482 /// Size 0 is treated as aspect ratio 1:1.<br />
484 /// <param name="width">The width to use.</param>
485 /// <returns>The height based on the width.</returns>
486 /// <since_tizen> 3 </since_tizen>
487 public float GetHeightForWidth(float width)
489 float ret = Interop.Actor.GetHeightForWidth(SwigCPtr, width);
490 if (NDalicPINVOKE.SWIGPendingException.Pending)
491 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
496 /// Calculates the width of the view given a height.<br />
497 /// The natural size is used for default calculation.<br />
498 /// Size 0 is treated as aspect ratio 1:1.<br />
500 /// <param name="height">The height to use.</param>
501 /// <returns>The width based on the height.</returns>
502 /// <since_tizen> 3 </since_tizen>
503 public float GetWidthForHeight(float height)
505 float ret = Interop.Actor.GetWidthForHeight(SwigCPtr, height);
506 if (NDalicPINVOKE.SWIGPendingException.Pending)
507 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
512 /// Return the amount of size allocated for relayout.
514 /// <param name="dimension">The dimension to retrieve.</param>
515 /// <returns>Return the size.</returns>
516 /// <since_tizen> 3 </since_tizen>
517 public float GetRelayoutSize(DimensionType dimension)
519 float ret = Interop.Actor.GetRelayoutSize(SwigCPtr, (int)dimension);
520 if (NDalicPINVOKE.SWIGPendingException.Pending)
521 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
526 /// Set the padding for the view.
528 /// <param name="padding">Padding for the view.</param>
529 /// <since_tizen> 3 </since_tizen>
530 // [Obsolete("Deprecated in API9, will be removed in API11. Please use Padding property instead!")]
531 public void SetPadding(PaddingType padding)
533 Interop.Actor.SetPadding(SwigCPtr, PaddingType.getCPtr(padding));
534 if (NDalicPINVOKE.SWIGPendingException.Pending)
535 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
539 /// Return the value of padding for the view.
541 /// <param name="paddingOut">the value of padding for the view</param>
542 /// <since_tizen> 3 </since_tizen>
543 [Obsolete("Deprecated in API9, will be removed in API11. Please use Padding property instead!")]
544 public void GetPadding(PaddingType paddingOut)
546 Interop.Actor.GetPadding(SwigCPtr, PaddingType.getCPtr(paddingOut));
547 if (NDalicPINVOKE.SWIGPendingException.Pending)
548 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
551 /// <since_tizen> 3 </since_tizen>
552 public uint AddRenderer(Renderer renderer)
554 uint ret = Interop.Actor.AddRenderer(SwigCPtr, Renderer.getCPtr(renderer));
555 if (NDalicPINVOKE.SWIGPendingException.Pending)
556 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
560 /// <since_tizen> 3 </since_tizen>
561 public Renderer GetRendererAt(uint index)
563 //to fix memory leak issue, match the handle count with native side.
564 IntPtr cPtr = Interop.Actor.GetRendererAt(SwigCPtr, index);
565 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
566 Renderer ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Renderer;
567 if (cPtr != null && ret == null)
569 ret = new Renderer(cPtr, false);
570 if (NDalicPINVOKE.SWIGPendingException.Pending)
571 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
574 Interop.BaseHandle.DeleteBaseHandle(CPtr);
575 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
577 if (NDalicPINVOKE.SWIGPendingException.Pending)
578 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
582 /// <since_tizen> 3 </since_tizen>
583 public void RemoveRenderer(Renderer renderer)
585 Interop.Actor.RemoveRenderer(SwigCPtr, Renderer.getCPtr(renderer));
586 if (NDalicPINVOKE.SWIGPendingException.Pending)
587 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590 /// <since_tizen> 3 </since_tizen>
591 public void RemoveRenderer(uint index)
593 Interop.Actor.RemoveRenderer(SwigCPtr, index);
594 if (NDalicPINVOKE.SWIGPendingException.Pending)
595 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
599 [EditorBrowsable(EditorBrowsableState.Never)]
600 public void RotateBy(Degree angle, Vector3 axis)
602 Interop.ActorInternal.RotateByDegree(SwigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
603 if (NDalicPINVOKE.SWIGPendingException.Pending)
604 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
607 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
608 [EditorBrowsable(EditorBrowsableState.Never)]
609 public void RotateBy(Radian angle, Vector3 axis)
611 Interop.ActorInternal.RotateByRadian(SwigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
612 if (NDalicPINVOKE.SWIGPendingException.Pending)
613 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
616 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
617 [EditorBrowsable(EditorBrowsableState.Never)]
618 public void RotateBy(Rotation relativeRotation)
620 Interop.ActorInternal.RotateByQuaternion(SwigCPtr, Rotation.getCPtr(relativeRotation));
621 if (NDalicPINVOKE.SWIGPendingException.Pending)
622 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
625 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
626 [EditorBrowsable(EditorBrowsableState.Never)]
627 public void ScaleBy(Vector3 relativeScale)
629 Interop.ActorInternal.ScaleBy(SwigCPtr, Vector3.getCPtr(relativeScale));
630 if (NDalicPINVOKE.SWIGPendingException.Pending)
631 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
634 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
635 [EditorBrowsable(EditorBrowsableState.Never)]
636 public void SetColorMode(ColorMode colorMode)
638 Interop.ActorInternal.SetColorMode(SwigCPtr, (int)colorMode);
639 if (NDalicPINVOKE.SWIGPendingException.Pending)
640 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
643 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
644 [EditorBrowsable(EditorBrowsableState.Never)]
645 public void ObjectDump()
647 if (0 == Children.Count)
649 Type type = this.GetType();
650 PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
651 foreach (var property in properties)
653 if (null != property && property.CanRead)
655 Tizen.Log.Fatal("NUI", $"{type.Name} {property.Name} ({property.PropertyType.Name}): {property.GetValueString(this, property.PropertyType)}");
661 foreach (View view in Children)
668 /// Search through this View's hierarchy for a View with the given unique ID.
670 /// <param name="id">The ID of the View to find.</param>
671 /// <returns>A handle to the View if found, or an empty handle if not.</returns>
672 /// <since_tizen> 9 </since_tizen>
673 public View FindDescendantByID(uint id)
675 return FindChildById(id);
679 /// Raise view above the next sibling view.
681 /// <since_tizen> 9 </since_tizen>
684 var parentChildren = GetParent()?.Children;
686 if (parentChildren != null)
688 int currentIndex = parentChildren.IndexOf(this);
690 // If the view is not already the last item in the list.
691 if (currentIndex >= 0 && currentIndex < parentChildren.Count - 1)
693 View temp = parentChildren[currentIndex + 1];
694 parentChildren[currentIndex + 1] = this;
695 parentChildren[currentIndex] = temp;
697 Interop.NDalic.Raise(SwigCPtr);
698 if (NDalicPINVOKE.SWIGPendingException.Pending)
699 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
705 /// Lower the view below the previous sibling view.
707 /// <since_tizen> 9 </since_tizen>
710 var parentChildren = GetParent()?.Children;
712 if (parentChildren != null)
714 int currentIndex = parentChildren.IndexOf(this);
716 // If the view is not already the first item in the list.
717 if (currentIndex > 0 && currentIndex < parentChildren.Count)
719 View temp = parentChildren[currentIndex - 1];
720 parentChildren[currentIndex - 1] = this;
721 parentChildren[currentIndex] = temp;
723 Interop.NDalic.Lower(SwigCPtr);
724 if (NDalicPINVOKE.SWIGPendingException.Pending)
725 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
731 /// Raises the view to above the target view.
733 /// <remarks>The sibling order of views within the parent will be updated automatically.
734 /// Views on the level above the target view will still be shown above this view.
735 /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
737 /// <param name="target">Will be raised above this view.</param>
738 /// <since_tizen> 9 </since_tizen>
739 public void RaiseAbove(View target)
741 var parentChildren = GetParent()?.Children;
743 if (parentChildren != null)
745 int currentIndex = parentChildren.IndexOf(this);
746 int targetIndex = parentChildren.IndexOf(target);
748 if (currentIndex < 0 || targetIndex < 0 ||
749 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
751 NUILog.Error("index should be bigger than 0 and less than children of layer count");
754 // If the currentIndex is less than the target index and the target has the same parent.
755 if (currentIndex < targetIndex)
757 parentChildren.Remove(this);
758 parentChildren.Insert(targetIndex, this);
760 Interop.NDalic.RaiseAbove(SwigCPtr, View.getCPtr(target));
761 if (NDalicPINVOKE.SWIGPendingException.Pending)
762 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769 /// Lowers the view to below the target view.
771 /// <remarks>The sibling order of views within the parent will be updated automatically.
772 /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
774 /// <param name="target">Will be lowered below this view.</param>
775 /// <since_tizen> 9 </since_tizen>
776 public void LowerBelow(View target)
778 var parentChildren = GetParent()?.Children;
780 if (parentChildren != null)
782 int currentIndex = parentChildren.IndexOf(this);
783 int targetIndex = parentChildren.IndexOf(target);
784 if (currentIndex < 0 || targetIndex < 0 ||
785 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
787 NUILog.Error("index should be bigger than 0 and less than children of layer count");
791 // If the currentIndex is not already the 0th index and the target has the same parent.
792 if ((currentIndex != 0) && (targetIndex != -1) &&
793 (currentIndex > targetIndex))
795 parentChildren.Remove(this);
796 parentChildren.Insert(targetIndex, this);
798 Interop.NDalic.LowerBelow(SwigCPtr, View.getCPtr(target));
799 if (NDalicPINVOKE.SWIGPendingException.Pending)
800 throw NDalicPINVOKE.SWIGPendingException.Retrieve();