From 56cf609246e678c5cad9d37e3a6c4278ffbba424 Mon Sep 17 00:00:00 2001 From: "minho.sun" Date: Mon, 14 Aug 2017 17:11:22 +0900 Subject: [PATCH] [Tizen] Temporary Fix to return the Layer as a View when Parent is a Layer This reverts commit 9619bcec429c7e5fd2460d891d6df480c4e92b36. Change-Id: I8be7d86f65db5b617a3e06c6bbb0bf37838f6673 --- src/Tizen.NUI/src/public/BaseComponents/View.cs | 41 +++++++++++++++++++++++++ src/Tizen.NUI/src/public/BaseHandle.cs | 11 +++++-- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 472e3a0..3c2f63f 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -2220,6 +2220,47 @@ namespace Tizen.NUI.BaseComponents return ret; } + /*internal View GetParent() + { + View ret; + IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr); + + BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr); + + if(basehandle is Layer) + { + ret = new View(cPtr,false); + } + else + { + ret = basehandle as View; + } + + 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) { NDalicPINVOKE.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(origin)); diff --git a/src/Tizen.NUI/src/public/BaseHandle.cs b/src/Tizen.NUI/src/public/BaseHandle.cs index 69d904e..3088fb7 100755 --- a/src/Tizen.NUI/src/public/BaseHandle.cs +++ b/src/Tizen.NUI/src/public/BaseHandle.cs @@ -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. -- 2.7.4