From d923c191ad162855c055c6c482110f15d2ec0693 Mon Sep 17 00:00:00 2001 From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Fri, 7 Aug 2020 12:36:16 +0900 Subject: [PATCH] [NUI] Binding FrameCallbackInterface (#1873) * [NUI] Add FrameCallbackInterface Signed-off-by: huiyu.eun * Modify patch Signed-off-by: huiyu.eun --- .../Interop/Interop.FrameCallbackInterface.cs | 63 +++++ src/Tizen.NUI/src/public/FrameCallbackInterface.cs | 263 +++++++++++++++++++++ src/Tizen.NUI/src/public/Window.cs | 18 ++ 3 files changed, 344 insertions(+) create mode 100755 src/Tizen.NUI/src/internal/Interop/Interop.FrameCallbackInterface.cs create mode 100755 src/Tizen.NUI/src/public/FrameCallbackInterface.cs diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.FrameCallbackInterface.cs b/src/Tizen.NUI/src/internal/Interop/Interop.FrameCallbackInterface.cs new file mode 100755 index 0000000..9f6a4e8 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.FrameCallbackInterface.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class FrameCallbackInterface + { + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_FrameCallbackInterface")] + public static extern global::System.IntPtr new_FrameCallbackInterface(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_director_connect")] + public static extern void FrameCallbackInterface_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, Tizen.NUI.FrameCallbackInterface.SwigDelegateFrameCallbackInterface delegate0); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_GetPosition")] + public static extern bool FraemCallbackInterface_GetPosition(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_SetPosition")] + public static extern bool FraemCallbackInterface_SetPosition(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_BakePosition")] + public static extern bool FraemCallbackInterface_BakePosition(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_GetPositionAndSize")] + public static extern bool FraemCallbackInterface_GetPositionAndSize(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector, global::System.Runtime.InteropServices.HandleRef vector2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_GetSize")] + public static extern bool FraemCallbackInterface_GetSize(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_SetSize")] + public static extern bool FraemCallbackInterface_SetSize(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_BakeSize")] + public static extern bool FraemCallbackInterface_BakeSize(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_GetScale")] + public static extern bool FraemCallbackInterface_GetScale(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_SetScale")] + public static extern bool FraemCallbackInterface_SetScale(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_BakeScale")] + public static extern bool FraemCallbackInterface_BakeScale(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_GetColor")] + public static extern bool FraemCallbackInterface_GetColor(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_SetColor")] + public static extern bool FraemCallbackInterface_SetColor(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_BakeColor")] + public static extern bool FraemCallbackInterface_BakeColor(global::System.IntPtr proxy, uint id, global::System.Runtime.InteropServices.HandleRef vector); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_AddFrameCallback")] + public static extern void FraemCallbackInterface_AddFrameCallback(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_FrameCallbackInterface_RemoveFrameCallback")] + public static extern void FraemCallbackInterface_RemoveFrameCallback(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + } + } +} diff --git a/src/Tizen.NUI/src/public/FrameCallbackInterface.cs b/src/Tizen.NUI/src/public/FrameCallbackInterface.cs new file mode 100755 index 0000000..f82726d --- /dev/null +++ b/src/Tizen.NUI/src/public/FrameCallbackInterface.cs @@ -0,0 +1,263 @@ +/* + * Copyright(c) 2020 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Reflection; +using System.Text; + +namespace Tizen.NUI +{ + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public class FrameCallbackInterface : Disposable + { + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + internal FrameCallbackInterface(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public FrameCallbackInterface() : this(Interop.FrameCallbackInterface.new_FrameCallbackInterface(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + SwigDirectorConnect(); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FrameCallbackInterface obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + private void SwigDirectorConnect() + { + swigDelegate0 = new SwigDelegateFrameCallbackInterface(SwigDirectorOnUpdate); + Interop.FrameCallbackInterface.FrameCallbackInterface_director_connect(swigCPtr, swigDelegate0); + } + + private global::System.IntPtr proxyIntPtr; + private void SwigDirectorOnUpdate(global::System.IntPtr proxy, float elapsedSeconds) + { + proxyIntPtr = proxy; + OnUpdate(elapsedSeconds); + return; + } + + internal delegate void SwigDelegateFrameCallbackInterface(global::System.IntPtr proxy, float elapsedSeconds); + private SwigDelegateFrameCallbackInterface swigDelegate0; + private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { typeof(IntPtr), typeof(float) }; + + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual void OnUpdate(float elapsedSeconds) + { + + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool GetPosition(uint id, Vector3 position) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_GetPosition(proxyIntPtr, id, Vector3.getCPtr(position)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool SetPosition(uint id, Vector3 position) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_SetPosition(proxyIntPtr, id, Vector3.getCPtr(position)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool BakePosition(uint id, Vector3 position) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_BakePosition(proxyIntPtr, id, Vector3.getCPtr(position)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool GetSize(uint id, Vector3 size) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_GetSize(proxyIntPtr, id, Vector3.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool SetSize(uint id, Vector3 size) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_SetSize(proxyIntPtr, id, Vector3.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool BakeSize(uint id, Vector3 size) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_BakeSize(proxyIntPtr, id, Vector3.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool SetScale(uint id, Vector3 scale) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_SetScale(proxyIntPtr, id, Vector3.getCPtr(scale)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool GetScale(uint id, Vector3 scale) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_SetScale(proxyIntPtr, id, Vector3.getCPtr(scale)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool BakeScale(uint id, Vector3 scale) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_BakeScale(proxyIntPtr, id, Vector3.getCPtr(scale)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool GetColor(uint id, Vector4 color) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_BakeScale(proxyIntPtr, id, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool SetColor(uint id, Vector4 color) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_BakeScale(proxyIntPtr, id, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool BakeColor(uint id, Vector4 color) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_BakeScale(proxyIntPtr, id, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool GetPositionAndSize(uint id, Vector3 Position, Vector3 Size) + { + if (proxyIntPtr == IntPtr.Zero) + { + return false; + } + bool ret = Interop.FrameCallbackInterface.FraemCallbackInterface_GetPositionAndSize(proxyIntPtr, id, Vector3.getCPtr(Position), Vector3.getCPtr(Size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void AddFrameCallback(global::System.Runtime.InteropServices.HandleRef windowCPtr, global::System.Runtime.InteropServices.HandleRef layerCPtr) + { + Interop.FrameCallbackInterface.FraemCallbackInterface_AddFrameCallback(windowCPtr, swigCPtr, layerCPtr); + } + + internal void RemoveFrameCallback(global::System.Runtime.InteropServices.HandleRef windowCPtr) + { + Interop.FrameCallbackInterface.FraemCallbackInterface_RemoveFrameCallback(windowCPtr, swigCPtr); + } + } +} \ No newline at end of file diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index 4d17177..49f14ef 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -1273,6 +1273,24 @@ namespace Tizen.NUI } /// + /// Add FrameCallback + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void AddFrameCallback(FrameCallbackInterface frameCallback) + { + frameCallback?.AddFrameCallback(stageCPtr, Layer.getCPtr(GetRootLayer())); + } + + /// + /// Remove FrameCallback + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void RemoveFrameCallback(FrameCallbackInterface frameCallback) + { + frameCallback?.RemoveFrameCallback(stageCPtr); + } + + /// /// Dispose for Window /// [EditorBrowsable(EditorBrowsableState.Never)] -- 2.7.4