From: 송동석/Tizen Platform Lab(SR)/Principal Engineer/삼성전자 Date: Thu, 5 Aug 2021 12:03:17 +0000 (+0900) Subject: [NUI] Add FindDescendantByID(), Raise(), Lower(), and etc by request of user X-Git-Tag: accepted/tizen/unified/20231205.024657~1458 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e6a5476cc2fb4058825cdd85c926b0122e9211c;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add FindDescendantByID(), Raise(), Lower(), and etc by request of user --- diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 62071e6..9c9c18b 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -1369,7 +1369,7 @@ namespace Tizen.NUI.BaseComponents { if (_resourceUrl != null) { - Size2D imageSize = ImageLoading.GetOriginalImageSize(_resourceUrl, true); + Size2D imageSize = ImageLoader.GetOriginalImageSize(_resourceUrl, true); if( imageSize.Height > 0 && imageSize.Width > 0 && _desired_width > 0 && _desired_height > 0 ) { int adjustedDesiredWidth, adjustedDesiredHeight; diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index 4f58fb4..214a0c9 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -402,126 +402,6 @@ namespace Tizen.NUI.BaseComponents } } - internal 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(); - } - } - } - - internal 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(); - } - } - } - - /// - /// Raises the view to above the target view. - /// - /// 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. - /// Raising this view above views with the same sibling order as each other will raise this view above them. - /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion. - /// - /// Will be raised above this view. - internal 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(); - } - } - - } - - /// - /// Lowers the view to below the target view. - /// - /// The sibling order of views within the parent will be updated automatically. - /// Lowering this view below views with the same sibling order as each other will lower this view above them. - /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion. - /// - /// Will be lowered below this view. - internal 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(); - } - } - - } - internal string GetName() { string ret = Interop.Actor.GetName(SwigCPtr); diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs index ed23922..07076d7 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs @@ -666,17 +666,141 @@ namespace Tizen.NUI.BaseComponents /// /// Search through this View's hierarchy for a View with the given unique ID. - /// The View itself is also considered in the search. /// - /// The ID of the View to find - /// A View if found or a null if not - [EditorBrowsable(EditorBrowsableState.Never)] - public View FindChildByID(uint id) + /// The ID of the View to find. + /// A handle to the View if found, or an empty handle if not. + /// 9 + public View FindDescendantByID(uint id) { - IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id); - View ret = this.GetInstanceSafely(cPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + return FindChildById(id); + } + + /// + /// Raise view above the next sibling view. + /// + /// 9 + 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(); + } + } + } + + /// + /// Lower the view below the previous sibling view. + /// + /// 9 + 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(); + } + } + } + + /// + /// Raises the view to above the target view. + /// + /// 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. + /// + /// Will be raised above this view. + /// 9 + 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(); + } + } + + } + + /// + /// Lowers the view to below the target view. + /// + /// 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. + /// + /// Will be lowered below this view. + /// 9 + 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(); + } + } + } } diff --git a/src/Tizen.NUI/src/public/Images/ImageLoading.cs b/src/Tizen.NUI/src/public/Images/ImageLoader.cs old mode 100755 new mode 100644 similarity index 97% rename from src/Tizen.NUI/src/public/Images/ImageLoading.cs rename to src/Tizen.NUI/src/public/Images/ImageLoader.cs index b4cddcc..8cc0f7e --- a/src/Tizen.NUI/src/public/Images/ImageLoading.cs +++ b/src/Tizen.NUI/src/public/Images/ImageLoader.cs @@ -21,13 +21,11 @@ namespace Tizen.NUI { /// - /// Loading an image. + /// A class containing methods providing image loading /// - /// Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime. - [EditorBrowsable(EditorBrowsableState.Never)] - // in API6 ~ API8, this has been "public class", not "public static class". to support not-rebuilt API6~API8's Application, this is reverted bact to "public class". + /// 9 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1052:Static holder types should be Static or NotInheritable", Justification = "")] - public class ImageLoading + public class ImageLoader { /// /// Load an image synchronously from local file. @@ -495,25 +493,23 @@ namespace Tizen.NUI } /// - /// Get the size of an original image consider rotation + /// Get the size of an original image rotated according to image metadata /// /// The name of the image. /// Dimension of the original image. - /// Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public static Size2D GetOriginalImageSize(string filename) { return GetOriginalImageSize(filename, true); } /// - /// Get the size of an original image consider rotation + /// Get the size of an original image rotated according to image metadata /// /// The name of the image. /// Reorient the image to respect any orientation metadata in its header. /// Dimension of the original image. - /// Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 9 public static Size2D GetOriginalImageSize(string filename, bool orientationCorrection) { var val = new Uint16Pair(Interop.ImageLoading.GetOriginalImageSize(filename, orientationCorrection), true);