[NUI] Add FindDescendantByID(), Raise(), Lower(), and etc by request of user
author송동석/Tizen Platform Lab(SR)/Principal Engineer/삼성전자 <dongsug.song@RNDU18P-VM0144.tn.corp.samsungelectronics.net>
Thu, 5 Aug 2021 12:03:17 +0000 (21:03 +0900)
committerSeoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
Mon, 13 Sep 2021 07:33:23 +0000 (16:33 +0900)
src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs
src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs
src/Tizen.NUI/src/public/Images/ImageLoader.cs [moved from src/Tizen.NUI/src/public/Images/ImageLoading.cs with 97% similarity, mode: 0644]

index 62071e6..9c9c18b 100755 (executable)
@@ -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;
index 4f58fb4..214a0c9 100755 (executable)
@@ -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();
-                }
-            }
-        }
-
-        /// <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.
-        /// 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.
-        /// </remarks>
-        /// <param name="target">Will be raised above this view.</param>
-        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();
-                }
-            }
-
-        }
-
-        /// <summary>
-        /// Lowers the view to below the target view.
-        /// </summary>
-        /// <remarks>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.
-        /// </remarks>
-        /// <param name="target">Will be lowered below this view.</param>
-        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);
index ed23922..07076d7 100755 (executable)
@@ -666,17 +666,141 @@ namespace Tizen.NUI.BaseComponents
 
         /// <summary>
         /// Search through this View's hierarchy for a View with the given unique ID.
-        /// The View itself is also considered in the search.
         /// </summary>
-        /// <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)]
-        public View FindChildByID(uint id)
+        /// <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)
         {
-            IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
-            View ret = this.GetInstanceSafely<View>(cPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
+            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();
+                }
+            }
+
         }
 
     }
old mode 100755 (executable)
new mode 100644 (file)
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
@@ -21,13 +21,11 @@ namespace Tizen.NUI
 {
 
     /// <summary>
-    /// Loading an image.
+    /// A class containing methods providing image loading
     /// </summary>
-    /// <remarks>Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime.</remarks>
-    [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".
+    /// <since_tizen> 9 </since_tizen>
     [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1052:Static holder types should be Static or NotInheritable", Justification = "<Pending>")]
-    public class ImageLoading
+    public class ImageLoader
     {
         /// <summary>
         /// Load an image synchronously from local file.
@@ -495,25 +493,23 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Get the size of an original image consider rotation
+        /// Get the size of an original image rotated according to image metadata
         /// </summary>
         /// <param name="filename">The name of the image.</param>
         /// <returns>Dimension of the original image.</returns>
-        /// <remarks>Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime.</remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public static Size2D GetOriginalImageSize(string filename)
         {
             return GetOriginalImageSize(filename, true);
         }
 
         /// <summary>
-        /// Get the size of an original image consider rotation
+        /// Get the size of an original image rotated according to image metadata
         /// </summary>
         /// <param name="filename">The name of the image.</param>
         /// <param name="orientationCorrection">Reorient the image to respect any orientation metadata in its header.</param>
         /// <returns>Dimension of the original image.</returns>
-        /// <remarks>Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime.</remarks>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public static Size2D GetOriginalImageSize(string filename, bool orientationCorrection)
         {
             var val = new Uint16Pair(Interop.ImageLoading.GetOriginalImageSize(filename, orientationCorrection), true);