-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
oldParent.Remove(child);
}
child.InternalParent = this;
+ LayoutCount += child.LayoutCount;
Interop.Actor.Add(SwigCPtr, View.getCPtr(child));
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
Children.Add(child);
+ OnChildAdded(child);
if (ChildAdded != null)
{
};
ChildAdded(this, e);
}
- BindableObject.SetInheritedBindingContext(child, this?.BindingContext);
}
}
if (child.GetParent() != this)
{
- throw new System.InvalidOperationException("You have deleted a view that is not a child of this view.");
+ //throw new System.InvalidOperationException("You have deleted a view that is not a child of this view.");
+ Tizen.Log.Error("NUI", "You have deleted a view that is not a child of this view.");
+ return;
}
bool hasLayout = (layout != null);
/// <since_tizen> 4 </since_tizen>
public override Container GetParent()
{
- return this.InternalParent as Container;
+ return InternalParent as Container;
}
/// <summary>
}
else
{
- Tizen.Log.Error("NUI", "swigCPtr of view is aleady disposed.");
+ Tizen.Log.Error("NUI", "swigCPtr of view is already disposed.");
}
return ret;
}
public void Show()
{
SetVisible(true);
+
+ if (GetAccessibilityStates()[AccessibilityState.Modal])
+ {
+ RegisterDefaultLabel();
+
+ if (Accessibility.Accessibility.IsEnabled)
+ {
+ EmitAccessibilityStateChangedEvent(AccessibilityState.Showing, true);
+ }
+ }
}
/// <summary>
public void Hide()
{
SetVisible(false);
+
+ if (GetAccessibilityStates()[AccessibilityState.Modal])
+ {
+ UnregisterDefaultLabel();
+
+ if (Accessibility.Accessibility.IsEnabled)
+ {
+ EmitAccessibilityStateChangedEvent(AccessibilityState.Showing, false);
+ }
+ }
}
/// <summary>
/// <param name="width">The width to use.</param>
/// <returns>The height based on the width.</returns>
/// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API9, will be removed in API11. Please use HeightForWidth property instead!")]
public float GetHeightForWidth(float width)
{
float ret = Interop.Actor.GetHeightForWidth(SwigCPtr, width);
/// <param name="height">The height to use.</param>
/// <returns>The width based on the height.</returns>
/// <since_tizen> 3 </since_tizen>
- [Obsolete("Deprecated in API9, will be removed in API11. Please use WidthForHeight property instead!")]
public float GetWidthForHeight(float height)
{
float ret = Interop.Actor.GetWidthForHeight(SwigCPtr, height);
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
-
-
- /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Transition GetTransition(string transitionName)
- {
- Transition trans = null;
- transDictionary.TryGetValue(transitionName, out trans);
- return trans;
- }
-
/// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void ObjectDump()
/// <param name="id">The ID of the View to find</param>
/// <returns>A View if found or a null if not</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("This will be removed at API11! please use FindDescendantByID(uint id) instead!")]
public View FindChildByID(uint id)
{
IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
return ret;
}
+ /// <summary>
+ /// Search through this View's hierarchy for a View with the given unique ID.
+ /// </summary>
+ /// <param name="id">The ID of the View to find.</param>
+ /// <returns>A handle to the View if found, or an empty handle if not.</returns>
+ /// <since_tizen> 9 </since_tizen>
+ public View FindDescendantByID(uint id)
+ {
+ return FindChildById(id);
+ }
+
+ /// <summary>
+ /// Raise view above the next sibling view.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public void Raise()
+ {
+ var parentChildren = GetParent()?.Children;
+
+ if (parentChildren != null)
+ {
+ int currentIndex = parentChildren.IndexOf(this);
+
+ // If the view is not already the last item in the list.
+ if (currentIndex >= 0 && currentIndex < parentChildren.Count - 1)
+ {
+ View temp = parentChildren[currentIndex + 1];
+ parentChildren[currentIndex + 1] = this;
+ parentChildren[currentIndex] = temp;
+
+ Interop.NDalic.Raise(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Lower the view below the previous sibling view.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public void Lower()
+ {
+ var parentChildren = GetParent()?.Children;
+
+ if (parentChildren != null)
+ {
+ int currentIndex = parentChildren.IndexOf(this);
+
+ // If the view is not already the first item in the list.
+ if (currentIndex > 0 && currentIndex < parentChildren.Count)
+ {
+ View temp = parentChildren[currentIndex - 1];
+ parentChildren[currentIndex - 1] = this;
+ parentChildren[currentIndex] = temp;
+
+ Interop.NDalic.Lower(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Raises the view to above the target view.
+ /// </summary>
+ /// <remarks>The sibling order of views within the parent will be updated automatically.
+ /// Views on the level above the target view will still be shown above this view.
+ /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
+ /// </remarks>
+ /// <param name="target">Will be raised above this view.</param>
+ /// <since_tizen> 9 </since_tizen>
+ public void RaiseAbove(View target)
+ {
+ var parentChildren = GetParent()?.Children;
+
+ if (parentChildren != null)
+ {
+ int currentIndex = parentChildren.IndexOf(this);
+ int targetIndex = parentChildren.IndexOf(target);
+
+ if (currentIndex < 0 || targetIndex < 0 ||
+ currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
+ {
+ NUILog.Error("index should be bigger than 0 and less than children of layer count");
+ return;
+ }
+ // If the currentIndex is less than the target index and the target has the same parent.
+ if (currentIndex < targetIndex)
+ {
+ parentChildren.Remove(this);
+ parentChildren.Insert(targetIndex, this);
+
+ Interop.NDalic.RaiseAbove(SwigCPtr, View.getCPtr(target));
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Lowers the view to below the target view.
+ /// </summary>
+ /// <remarks>The sibling order of views within the parent will be updated automatically.
+ /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
+ /// </remarks>
+ /// <param name="target">Will be lowered below this view.</param>
+ /// <since_tizen> 9 </since_tizen>
+ public void LowerBelow(View target)
+ {
+ var parentChildren = GetParent()?.Children;
+
+ if (parentChildren != null)
+ {
+ int currentIndex = parentChildren.IndexOf(this);
+ int targetIndex = parentChildren.IndexOf(target);
+ if (currentIndex < 0 || targetIndex < 0 ||
+ currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
+ {
+ NUILog.Error("index should be bigger than 0 and less than children of layer count");
+ return;
+ }
+
+ // If the currentIndex is not already the 0th index and the target has the same parent.
+ if ((currentIndex != 0) && (targetIndex != -1) &&
+ (currentIndex > targetIndex))
+ {
+ parentChildren.Remove(this);
+ parentChildren.Insert(targetIndex, this);
+
+ Interop.NDalic.LowerBelow(SwigCPtr, View.getCPtr(target));
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+
+ }
+
}
}