[NUI] add NativeWindowSafeHandle & make GetParent() public 69/155969/2
authordongsug.song <dongsug.song@samsung.com>
Mon, 16 Oct 2017 17:11:25 +0000 (02:11 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Tue, 17 Oct 2017 02:28:40 +0000 (11:28 +0900)
Change-Id: I52fcc2f4c95746779d87c9c353ff2311d12a672f
Signed-off-by: dongsug.song <dongsug.song@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Container.cs
src/Tizen.NUI/src/public/Layer.cs
src/Tizen.NUI/src/public/Window.cs

index cd80218..02ff6ba 100755 (executable)
@@ -91,7 +91,7 @@ namespace Tizen.NUI.BaseComponents
         /// Retrieves the number of children held by the view.
         /// </summary>
         /// <seealso cref="Container.GetChildCount" />
-        protected override uint GetChildCount()
+        public override uint GetChildCount()
         {
             return Convert.ToUInt32(Children.Count);
         }
@@ -100,7 +100,7 @@ namespace Tizen.NUI.BaseComponents
         /// Gets the views parent.
         /// </summary>
         /// <seealso cref="Container.GetParent()" />
-        protected override Container GetParent()
+        public override Container GetParent()
         {
             IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
 
@@ -112,19 +112,9 @@ namespace Tizen.NUI.BaseComponents
             return basehandle as Container;
         }
 
-        /// <summary>
-        /// This is temporal API. Currently Parent returns View but Container class has been introduced so 'View Parent' will be changed 'Container Parent' later soon, then this will be removed
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
-        public Container GetContainerParent()
-        {
-            return this.GetParent();
-        }
-
         internal bool IsTopLevelView()
         {
-            if(GetContainerParent() is Layer)
+            if(GetParent() is Layer)
             {
                 return true;
             }
index 1dc767e..967c97a 100755 (executable)
@@ -93,14 +93,14 @@ namespace Tizen.NUI
         /// </summary>
         /// <pre>The child container has been initialized.</pre>
         /// <returns>The parent container.</returns>
-        protected abstract Container GetParent();
+        public abstract Container GetParent();
 
         /// <summary>
         /// Gets the number of children for this container.
         /// </summary>
         /// <pre>The container has been initialized.</pre>
         /// <returns>The number of children.</returns>
-        protected abstract UInt32 GetChildCount();
+        public abstract UInt32 GetChildCount();
 
         /// <summary>
         /// Gets the parent container.
index 4d60b43..94e8eef 100755 (executable)
@@ -94,7 +94,7 @@ namespace Tizen.NUI
         /// </summary>
         /// <returns>The view's container</returns>
         /// <since_tizen> 3 </since_tizen>
-        protected override Container GetParent()
+        public override Container GetParent()
         {
             return null;
         }
@@ -104,7 +104,7 @@ namespace Tizen.NUI
         /// </summary>
         /// <returns>The child count of the layer.</returns>
         /// <since_tizen> 3 </since_tizen>
-        protected override uint GetChildCount()
+        public override uint GetChildCount()
         {
             return Convert.ToUInt32(Children.Count);
         }
index 2ed4d93..ace40de 100755 (executable)
@@ -1628,5 +1628,54 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
+        /// <summary>
+        /// Contains and encapsulates Native Ecore Wayland Window handle.
+        /// </summary>
+        /// <remarks>
+        /// To get System.IntPtr of Native Ecore Wayland Window handle, <br />
+        /// DangerousGetHandle() method is used to get handle.
+        /// </remarks>
+        /// <since_tizen> 4 </since_tizen>
+        public class NativeWindowSafeHandle : SafeHandle
+        {
+            internal NativeWindowSafeHandle(IntPtr handle) : base(handle, true)
+            {
+            }
+            /// <summary>
+            /// Null check if the handle is valid or not.
+            /// </summary>
+            public override bool IsInvalid
+            {
+                get
+                {
+                    return this.handle == IntPtr.Zero;
+                }
+            }
+            /// <summary>
+            /// Release handle itself.
+            /// </summary>
+            /// <returns>true when released successfully.</returns>
+            /// <since_tizen> 4 </since_tizen>
+            protected override bool ReleaseHandle()
+            {
+                this.SetHandle(IntPtr.Zero);
+                return true;
+            }
+        }
+        /// <summary>
+        /// Gets Native Ecore Wayland Window handle.
+        /// </summary>
+        /// <remarks>
+        /// NativeWindowSafeHandle class contains System.IntPtr of Native Ecore Wayland Window handle, <br />
+        /// DangerousGetHandle() method is used to get handle.
+        /// </remarks>
+        /// <since_tizen> 4 </since_tizen>
+        public Window.NativeWindowSafeHandle NativeWindowHandle
+        {
+            get
+            {
+                return new NativeWindowSafeHandle(GetNativeWindowHandler());
+            }
+        }
     }
-}
\ No newline at end of file
+}