[Tizen] Temporary Fix to return the Layer as a View when Parent is a Layer.
authorminho.sun <minho.sun@samsung.com>
Tue, 1 Aug 2017 01:35:53 +0000 (10:35 +0900)
committerminho.sun <minho.sun@samsung.com>
Tue, 1 Aug 2017 01:35:56 +0000 (10:35 +0900)
This reverts commit dc68938a07760478612d940acb3587fe5e0311c2.

Change-Id: If348cf028e63d95e1daa050286d54a6b151d578c

src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseHandle.cs

index 9b7911f..da95366 100755 (executable)
@@ -2125,7 +2125,7 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
-        internal View GetParent()
+        /*internal View GetParent()
         {
             View ret;
             IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
@@ -2144,6 +2144,26 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending)
                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
+        }*/
+
+        internal View GetParent()
+        {
+            View ret;
+            IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
+
+            BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr);
+
+            if(basehandle is Layer)
+            {
+                View ret2 = new View(cPtr,false);
+                return ret2;
+            }
+
+            ret = basehandle as View;
+
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
         }
 
         internal void SetParentOrigin(Vector3 origin)
index 69d904e..3088fb7 100755 (executable)
@@ -26,6 +26,7 @@ namespace Tizen.NUI
         internal BaseHandle(global::System.IntPtr cPtr, bool cMemoryOwn)
         {
             _registerMe = swigCMemOwn = cMemoryOwn;
+
             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
 
             // using copy constructor to create another native handle so Registry.Unregister works fine.
@@ -41,18 +42,22 @@ namespace Tizen.NUI
         internal BaseHandle(global::System.IntPtr cPtr)
         {
             _registerMe = swigCMemOwn = true;
+
             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
 
             // using copy constructor to create another native handle so Registry.Unregister works fine.
             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.new_BaseHandle__SWIG_2(swigCPtr));
 
-            // Register this instance of BaseHandle in the registry.
-            Registry.Register(this);
+            if (_registerMe)
+            {
+                // Register this instance of BaseHandle in the registry.
+                Registry.Register(this);
+            }
         }
 
         internal BaseHandle(global::System.IntPtr cPtr)
         {
-            swigCMemOwn = true;
+            _registerMe = swigCMemOwn = true;
             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
 
             // Register this instance of BaseHandle in the registry.