From: dkdk-ryu <38246983+dkdk-ryu@users.noreply.github.com> Date: Thu, 3 Sep 2020 06:19:14 +0000 (+0900) Subject: [NUI] Add GLWindow (#1945) X-Git-Tag: accepted/tizen/unified/20210219.040944~440 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31a08c4e214d7bd51511238e4b162baf6e4bd8e2;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add GLWindow (#1945) GLWindow allows you to render scenes with OpenGL ES. --- diff --git a/src/Tizen.NUI/src/internal/GLWindowResizedSignal.cs b/src/Tizen.NUI/src/internal/GLWindowResizedSignal.cs new file mode 100755 index 0000000..76dd3b7 --- /dev/null +++ b/src/Tizen.NUI/src/internal/GLWindowResizedSignal.cs @@ -0,0 +1,75 @@ +/* + * 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. + * + */ + +namespace Tizen.NUI +{ + internal class GLWindowResizedSignal : Disposable + { + + internal GLWindowResizedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.GLWindowResizedSignal.GlWindow_delete_ResizedSignal(swigCPtr); + } + + public bool Empty() + { + bool ret = Interop.GLWindowResizedSignal.GlWindow_ResizedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = Interop.GLWindowResizedSignal.GlWindow_ResizedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.GLWindowResizedSignal.GlWindow_ResizedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.GLWindowResizedSignal.GlWindow_ResizedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Size2D arg) + { + Interop.GLWindowResizedSignal.GlWindow_ResizedSignal_Emit(swigCPtr, Size2D.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public GLWindowResizedSignal() : this(Interop.GLWindowResizedSignal.new_GlWindow_ResizedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } +} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.GLWindow.cs b/src/Tizen.NUI/src/internal/Interop/Interop.GLWindow.cs new file mode 100644 index 0000000..c6831b6 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.GLWindow.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.Text; +using global::System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class GLWindow + { + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_New__SWIG_0")] + public static extern global::System.IntPtr GlWindow_New__SWIG_0(); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_New__SWIG_1")] + public static extern global::System.IntPtr GlWindow_New__SWIG_1(HandleRef jarg1, string jarg2, string jarg3, bool jarg4 ); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_GlWindow__SWIG_0")] + public static extern global::System.IntPtr new_GlWindow__SWIG_0(); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_GlWindow")] + public static extern void delete_GlWindow(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_GlWindow__SWIG_1")] + public static extern global::System.IntPtr new_GlWindow__SWIG_1(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Assign")] + public static extern global::System.IntPtr GlWindow_Assign(HandleRef jarg1, HandleRef jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_SetEglConfig")] + public static extern global::System.IntPtr GlWindow_SetEglConfig(HandleRef jarg1, bool jarg2, bool jarg3, int jarg4, int jarg5); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Raise")] + public static extern void GlWindow_Raise(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Lower")] + public static extern void GlWindow_Lower(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Activate")] + public static extern void GlWindow_Activate(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Show")] + public static extern void GlWindow_Show(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Hide")] + public static extern void GlWindow_Hide(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_SetPositionSize")] + public static extern void GlWindow_SetPositionSize(HandleRef jarg1, HandleRef jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_GetPositionSize")] + public static extern global::System.IntPtr GlWindow_GetPositionSize(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_GetSupportedAuxiliaryHintCount")] + public static extern uint GlWindow_GetSupportedAuxiliaryHintCount(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_GetSupportedAuxiliaryHint")] + public static extern string GlWindow_GetSupportedAuxiliaryHint(HandleRef jarg1, uint jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_AddAuxiliaryHint")] + public static extern uint GlWindow_AddAuxiliaryHint(HandleRef jarg1, string jarg2, string jarg3); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_RemoveAuxiliaryHint")] + public static extern bool GlWindow_RemoveAuxiliaryHint(HandleRef jarg1, uint jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_SetAuxiliaryHintValue")] + public static extern bool GlWindow_SetAuxiliaryHintValue(HandleRef jarg1, uint jarg2, string jarg3); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_GetAuxiliaryHintValue")] + public static extern string GlWindow_GetAuxiliaryHintValue(HandleRef jarg1, uint jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_GetAuxiliaryHintId")] + public static extern uint GlWindow_GetAuxiliaryHintId(HandleRef jarg1, string jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_SetInputRegion")] + public static extern void GlWindow_SetInputRegion(HandleRef jarg1, HandleRef jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_SetOpaqueState")] + public static extern void GlWindow_SetOpaqueState(HandleRef jarg1, bool jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_IsOpaqueState")] + public static extern bool GlWindow_IsOpaqueState(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_GetCurrentOrientation")] + public static extern int GlWindow_GetCurrentOrientation(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_SetAvailableOrientations")] + public static extern void GlWindow_SetAvailableOrientations(HandleRef jarg1, HandleRef jarg2, int jarg3); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_SetPreferredOrientation")] + public static extern void GlWindow_SetPreferredOrientation(HandleRef jarg1, int jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_RegisterGlCallback")] + public static extern void GlWindow_RegisterGlCallback(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_RenderOnce")] + public static extern void GlWindow_RenderOnce(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_SWIGUpcast")] + public static extern global::System.IntPtr GlWindow_SWIGUpcast(global::System.IntPtr jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_TouchSignal")] + public static extern global::System.IntPtr GlWindow_TouchSignal(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_FocusChangedSignal")] + public static extern global::System.IntPtr GlWindow_FocusChangedSignal(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_KeyEventSignal")] + public static extern global::System.IntPtr GlWindow_KeyEventSignal(HandleRef jarg1); + + // For windows resized signal + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_ResizedSignal")] + public static extern global::System.IntPtr GlWindow_ResizedSignal(HandleRef jarg1); + + } + } +} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.GLWindowFocusChangeSignal.cs b/src/Tizen.NUI/src/internal/Interop/Interop.GLWindowFocusChangeSignal.cs new file mode 100644 index 0000000..29df9c9 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.GLWindowFocusChangeSignal.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; +using global::System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class GLWindowFocusSignalType + { + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_FocusSignalType_Empty")] + public static extern bool GlWindow_FocusSignalType_Empty(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_FocusSignalType_GetConnectionCount")] + public static extern uint GlWindow_FocusSignalType_GetConnectionCount(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_FocusSignalType_Connect")] + public static extern void GlWindow_FocusSignalType_Connect(HandleRef jarg1, HandleRef jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_FocusSignalType_Disconnect")] + public static extern void GlWindow_FocusSignalType_Disconnect(HandleRef jarg1, HandleRef jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_FocusSignalType_Emit")] + public static extern void GlWindow_FocusSignalType_Emit(HandleRef signalType, HandleRef window, bool focusIn); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_GlWindow_FocusSignalType")] + public static extern global::System.IntPtr new_GlWindow_FocusSignalType(); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_GlWindow_FocusSignalType")] + public static extern void delete_GlWindow_FocusSignalType(HandleRef jarg1); + } + } +} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.GLWindowResizedSignal.cs b/src/Tizen.NUI/src/internal/Interop/Interop.GLWindowResizedSignal.cs new file mode 100644 index 0000000..7e9ad1e --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.GLWindowResizedSignal.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; +using global::System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class GLWindowResizedSignal + { + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_ResizedSignal_Empty")] + public static extern bool GlWindow_ResizedSignal_Empty(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_ResizedSignal_GetConnectionCount")] + public static extern uint GlWindow_ResizedSignal_GetConnectionCount(HandleRef jarg1); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_ResizedSignal_Connect")] + public static extern void GlWindow_ResizedSignal_Connect(HandleRef jarg1, HandleRef jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_ResizedSignal_Disconnect")] + public static extern void GlWindow_ResizedSignal_Disconnect(HandleRef jarg1, HandleRef jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_ResizedSignal_Emit")] + public static extern void GlWindow_ResizedSignal_Emit(HandleRef jarg1, HandleRef jarg2); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_GlWindow_ResizedSignal")] + public static extern global::System.IntPtr new_GlWindow_ResizedSignal(); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_delete_ResizedSignal")] + public static extern void GlWindow_delete_ResizedSignal(HandleRef jarg1); + } + } +} diff --git a/src/Tizen.NUI/src/internal/Interop/interop.GLWindowVisibilityChangedSignal.cs b/src/Tizen.NUI/src/internal/Interop/interop.GLWindowVisibilityChangedSignal.cs new file mode 100644 index 0000000..29a4672 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/interop.GLWindowVisibilityChangedSignal.cs @@ -0,0 +1,32 @@ +using System; +using global::System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class GLWindowVisibilityChangedSignal + { + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Visibility_Changed_Signal")] + public static extern global::System.IntPtr GetSignal(HandleRef glWindow); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Visibility_Changed_Signal_Empty")] + public static extern bool Empty(HandleRef signalType); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Visibility_Changed_Signal_GetConnectionCount")] + public static extern uint GetConnectionCount(HandleRef signalType); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Visibility_Changed_Signal_Connect")] + public static extern void Connect(HandleRef signalType, HandleRef callback); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Visibility_Changed_Signal_Disconnect")] + public static extern void Disconnect(HandleRef signalType, HandleRef callback); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Visibility_Changed_Signal_Emit")] + public static extern void Emit(HandleRef signalType, HandleRef window, bool visibility); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GlWindow_Visibility_Changed_Signal_delete")] + public static extern void DeleteSignal(HandleRef signalType); + } + } +} diff --git a/src/Tizen.NUI/src/public/GLWindow.cs b/src/Tizen.NUI/src/public/GLWindow.cs new file mode 100644 index 0000000..9fd5359 --- /dev/null +++ b/src/Tizen.NUI/src/public/GLWindow.cs @@ -0,0 +1,497 @@ +/* + * 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. + * + */ + +extern alias TizenSystemInformation; +using TizenSystemInformation.Tizen.System; +using global::System; +using System.ComponentModel; +using System.Collections.Generic; +using global::System.Runtime.InteropServices; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + /// + /// The GLWindow class is to draw with native GLES.
+ /// This class is the special window. It is for native GLES application.
+ /// So, some special funtions and type are supported.
+ /// In addition, basic window's functions are supported, too.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public partial class GLWindow : BaseHandle + { + internal GLWindow(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.GLWindow.GlWindow_SWIGUpcast(cPtr), cMemoryOwn) + { + + } + + /// + /// Creates an initialized handle to a new GLWindow.
+ /// This creates an GLWindow with default options.!--
+ ///
+ /// A new GLWindow. + [EditorBrowsable(EditorBrowsableState.Never)] + public GLWindow() : this(Interop.GLWindow.GlWindow_New__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates an initialized handle to a new GLWindow.
+ /// This API can create GLWindow with specifc option.
+ ///
+ /// The name for GL window. + /// The position and size of the Window. + /// Whether Window is translucent. + /// A new Window. + [EditorBrowsable(EditorBrowsableState.Never)] + public GLWindow(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.GLWindow.GlWindow_New__SWIG_1( Rectangle.getCPtr(windowPosition), name, "", isTranslucent), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public enum GLWindowOrientation + { + /// + /// Portrait orientation. The height of the display area is greater than the width. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Portrait = 0, + + /// + /// Landscape orientation. A wide view area is needed. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Landscape = 1, + + /// + /// Portrait inverse orientation. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + PortraitInverse = 2, + + /// + /// Landscape inverse orientation. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + LandscapeInverse = 3, + + /// + /// No orientation. It is for the preferred orientation + /// Especially, NoOrientationPreference only has the effect for the preferred orientation. + /// It is used to unset the preferred orientation with SetPreferredOrientation. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + NoOrientationPreference = -1 + } + + /// + /// Gets or sets a size of the window. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public Size2D WindowSize + { + get + { + var val = new Rectangle(Interop.GLWindow.GlWindow_GetPositionSize(swigCPtr), true); + Size2D ret = new Size2D(val.Width, val.Height); + + return ret; + } + set + { + var val = new Rectangle(Interop.GLWindow.GlWindow_GetPositionSize(swigCPtr), true); + Rectangle ret = new Rectangle(val.X, val.Y, value.Width, value.Height ); + + Interop.GLWindow.GlWindow_SetPositionSize(swigCPtr, Rectangle.getCPtr(ret)); + } + } + + /// + /// This Enumeration is used the GLES version for EGL configuration.
+ /// If the device can not support GLES version 3.0 over, the version will be chosen with GLES version 2.0
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public enum GLESVersion + { + /// + /// GLES version 2.0 + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Version_2_0 = 0, + + /// + /// GLES version 3.0 + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Version_3_0 + } + + /// + /// Sets egl configuration for GLWindow + /// + /// The flag of depth buffer. If true is set, 24bit depth buffer is enabled. + /// The flag of stencil. it true is set, 8bit stencil buffer is enabled. + /// The bit of msaa. + /// The GLES version. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetEglConfig( bool depth, bool stencil, int msaa, GLESVersion version ) + { + Interop.GLWindow.GlWindow_SetEglConfig(swigCPtr, depth, stencil, msaa, (int)version); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Shows the GLWindow if it is hidden. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Show() + { + Interop.GLWindow.GlWindow_Show(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Hides the GLWindow if it is showing. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Hide() + { + Interop.GLWindow.GlWindow_Hide(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Raises the window to the top of the window stack. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Raise() + { + Interop.GLWindow.GlWindow_Raise(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Lowers the window to the bottom of the window stack. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Lower() + { + Interop.GLWindow.GlWindow_Lower(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Activates the window to the top of the window stack even it is iconified. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Activate() + { + Interop.GLWindow.GlWindow_Activate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets position and size of the window. This API guarantees that + /// both moving and resizing of window will appear on the screen at once. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public Rectangle WindowPositionSize + { + get + { + Rectangle val = new Rectangle(Interop.GLWindow.GlWindow_GetPositionSize(swigCPtr), true); + Rectangle ret = new Rectangle(val.X, val.Y, val.Width, val.Height ); + + return ret; + } + set + { + Interop.GLWindow.GlWindow_SetPositionSize(swigCPtr, Rectangle.getCPtr(value)); + } + } + + /// + /// Gets the count of supported auxiliary hints of the GLWindow. + /// + /// The number of supported auxiliary hints. + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetSupportedAuxiliaryHintCount() + { + uint ret = Interop.GLWindow.GlWindow_GetSupportedAuxiliaryHintCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the supported auxiliary hint string of the GLWindow. + /// + /// The index of the supported auxiliary hint lists. + /// The auxiliary hint string of the index. + [EditorBrowsable(EditorBrowsableState.Never)] + public string GetSupportedAuxiliaryHint(uint index) + { + string ret = Interop.GLWindow.GlWindow_GetSupportedAuxiliaryHint(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Creates an auxiliary hint of the GLWindow. + /// + /// The auxiliary hint string. + /// The value string. + /// The ID of created auxiliary hint, or 0 on failure. + [EditorBrowsable(EditorBrowsableState.Never)] + public uint AddAuxiliaryHint(string hint, string value) + { + uint ret = Interop.GLWindow.GlWindow_AddAuxiliaryHint(swigCPtr, hint, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Removes an auxiliary hint of the GLWindow. + /// + /// The ID of the auxiliary hint. + /// True if no error occurred, false otherwise. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool RemoveAuxiliaryHint(uint id) + { + bool ret = Interop.GLWindow.GlWindow_RemoveAuxiliaryHint(swigCPtr, id); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Changes a value of the auxiliary hint. + /// + /// The auxiliary hint ID. + /// The value string to be set. + /// True if no error occurred, false otherwise. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool SetAuxiliaryHintValue(uint id, string value) + { + bool ret = Interop.GLWindow.GlWindow_SetAuxiliaryHintValue(swigCPtr, id, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets a value of the auxiliary hint. + /// + /// The auxiliary hint ID. + /// The string value of the auxiliary hint ID, or an empty string if none exists. + [EditorBrowsable(EditorBrowsableState.Never)] + public string GetAuxiliaryHintValue(uint id) + { + string ret = Interop.GLWindow.GlWindow_GetAuxiliaryHintValue(swigCPtr, id); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets an ID of the auxiliary hint string. + /// + /// The auxiliary hint string. + /// The ID of auxiliary hint string, or 0 on failure. + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetAuxiliaryHintId(string hint) + { + uint ret = Interop.GLWindow.GlWindow_GetAuxiliaryHintId(swigCPtr, hint); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets a region to accept input events. + /// + /// The region to accept input events. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetInputRegion(Rectangle inputRegion) + { + Interop.GLWindow.GlWindow_SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets a transparent window's visual state to opaque.
+ /// If a visual state of a transparent window is opaque,
+ /// then the window manager could handle it as an opaque window when calculating visibility. + ///
+ /// Whether the window's visual state is opaque. + /// This will have no effect on an opaque window.
+ /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window. + ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public void SetOpaqueState(bool opaque) + { + Interop.GLWindow.GlWindow_SetOpaqueState(swigCPtr, opaque); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Returns whether a transparent window's visual state is opaque or not. + /// + /// True if the window's visual state is opaque, false otherwise. + /// The return value has no meaning on an opaque window. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsOpaqueState() + { + bool ret = Interop.GLWindow.GlWindow_IsOpaqueState(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets a preferred orientation. + /// + /// The preferred orientation. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetPreferredOrientation(GLWindow.GLWindowOrientation orientation) + { + Interop.GLWindow.GlWindow_SetPreferredOrientation(swigCPtr, (int)orientation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets current orientation of the window. + /// + /// The current window orientation if previously set, or none. + [EditorBrowsable(EditorBrowsableState.Never)] + public GLWindow.GLWindowOrientation GetCurrentOrientation() + { + GLWindow.GLWindowOrientation ret = (GLWindow.GLWindowOrientation)Interop.GLWindow.GlWindow_GetCurrentOrientation(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets available orientations of the window. + /// This API is for setting several orientations one time. + /// + /// The list of orientations. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetAvailableOrientations(List orientations) + { + PropertyArray orientationArray = new PropertyArray(); + for (int i = 0; i < orientations.Count; i++) + { + orientationArray.PushBack(new PropertyValue((int)orientations[i])); + } + + Interop.GLWindow.GlWindow_SetAvailableOrientations(swigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Allows at least one more render, even when paused. + /// The window should be shown, not minimised. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void RenderOnce() + { + Interop.GLWindow.GlWindow_RenderOnce(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Type of callback to initialize native GL code. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public delegate void GLInitializeCallbackType(); + + GLInitializeCallbackType GLInitializeCallback; + HandleRef InitHandleRef; + + /// + /// Type of callback to render to frame to use native GL code. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public delegate void GLRenderFrameCallbackType(); + + GLRenderFrameCallbackType GLRenderFrameCallback; + HandleRef RenderHandlerRef; + + + /// + /// Type of callback to cleanup native GL resource. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public delegate void GLTerminateCallbackType(); + + GLTerminateCallbackType GLTerminateCallback; + HandleRef TerminateHandlerRef; + + /// + /// Registers a GL callback function for application. + /// + /// The callback function for application initialize + /// The callback function to render to the frame + /// The callback function to clean-up application GL resource + [EditorBrowsable(EditorBrowsableState.Never)] + public void RegisterGlCallback( GLInitializeCallbackType glInit, GLRenderFrameCallbackType glRenderFrame, GLTerminateCallbackType glTerminate ) + { + GLInitializeCallback = glInit; + InitHandleRef = new HandleRef(this, Marshal.GetFunctionPointerForDelegate(GLInitializeCallback)); + + GLRenderFrameCallback = glRenderFrame; + RenderHandlerRef = new HandleRef(this, Marshal.GetFunctionPointerForDelegate(GLRenderFrameCallback)); + + GLTerminateCallback = glTerminate; + TerminateHandlerRef = new HandleRef(this, Marshal.GetFunctionPointerForDelegate(GLTerminateCallback)); + + Interop.GLWindow.GlWindow_RegisterGlCallback(swigCPtr, InitHandleRef, RenderHandlerRef, TerminateHandlerRef); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Destroy the window immediately. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Destroy() + { + this.Dispose(); + } + + /// + /// Dispose for Window + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + this.DisconnectNativeSignals(); + + base.Dispose(type); + } + + /// This will not be public opened. + protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.Window.delete_Window(swigCPtr); + } + } +} diff --git a/src/Tizen.NUI/src/public/GLWindowEvent.cs b/src/Tizen.NUI/src/public/GLWindowEvent.cs new file mode 100644 index 0000000..3b86c55 --- /dev/null +++ b/src/Tizen.NUI/src/public/GLWindowEvent.cs @@ -0,0 +1,454 @@ +/* + * 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.ComponentModel; +using System.Runtime.InteropServices; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + public partial class GLWindow + { + private FocusChangedEventCallbackType _focusChangedEventCallback; + private GLWindowTouchDataCallbackType _windowTouchDataCallback; + private EventCallbackDelegateType1 _windowKeyCallbackDelegate; + private WindowResizedEventCallbackType _windowResizedEventCallback; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void FocusChangedEventCallbackType(IntPtr window, bool focusGained); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool GLWindowTouchDataCallbackType(IntPtr touchData); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WindowResizedEventCallbackType(IntPtr windowSize); + + /// + /// FocusChanged event. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler FocusChanged + { + add + { + if (_focusChangedEventCallback == null) + { + _focusChangedEventCallback = OnWindowFocusedChanged; + FocusChangedSignal().Connect(_focusChangedEventCallback); + } + + _focusChangedEventHandler += value; + } + remove + { + _focusChangedEventHandler -= value; + + if (_focusChangedEventHandler == null && FocusChangedSignal().Empty() == false && _focusChangedEventCallback != null) + { + FocusChangedSignal().Disconnect(_focusChangedEventCallback); + } + } + } + + /// + /// Emits the event when the screen is touched and when the touch ends.
+ /// If there are multiple touch points then it is emitted when the first touch occurs and + /// when the last finger is lifted too.
+ /// Even though incoming events are interrupted, the event occurs.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler TouchEvent + { + add + { + if (_windoTouchDataEventHandler == null) + { + _windowTouchDataCallback = OnWindowTouch; + this.TouchSignal().Connect(_windowTouchDataCallback); + } + _windoTouchDataEventHandler += value; + } + remove + { + _windoTouchDataEventHandler -= value; + if (_windoTouchDataEventHandler == null && TouchSignal().Empty() == false && _windowTouchDataCallback != null) + { + this.TouchSignal().Disconnect(_windowTouchDataCallback); + } + } + } + + /// + /// Emits the event when the key event is received. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler KeyEvent + { + add + { + if (_stageKeyHandler == null) + { + _windowKeyCallbackDelegate = OnStageKey; + KeyEventSignal().Connect(_windowKeyCallbackDelegate); + } + _stageKeyHandler += value; + } + remove + { + _stageKeyHandler -= value; + if (_stageKeyHandler == null && KeyEventSignal().Empty() == false) + { + KeyEventSignal().Disconnect(_windowKeyCallbackDelegate); + } + } + } + + /// + /// Emits the event when the window resized. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler Resized + { + add + { + if (_windowResizedEventHandler == null) + { + _windowResizedEventCallback = OnResized; + GLWindowResizedSignal().Connect(_windowResizedEventCallback); + } + + _windowResizedEventHandler += value; + } + remove + { + _windowResizedEventHandler -= value; + + if (_windowResizedEventHandler == null && GLWindowResizedSignal().Empty() == false && _windowResizedEventCallback != null) + { + GLWindowResizedSignal().Disconnect(_windowResizedEventCallback); + } + } + } + + private event EventHandler _focusChangedEventHandler; + private event EventHandler _windoTouchDataEventHandler; + private event EventHandler _stageKeyHandler; + private event EventHandler _windowResizedEventHandler; + + internal WindowFocusSignalType FocusChangedSignal() + { + WindowFocusSignalType ret = new WindowFocusSignalType(Interop.GLWindow.GlWindow_FocusChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal KeyEventSignal KeyEventSignal() + { + KeyEventSignal ret = new KeyEventSignal(Interop.GLWindow.GlWindow_KeyEventSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TouchSignal TouchSignal() + { + TouchSignal ret = new TouchSignal(Interop.GLWindow.GlWindow_TouchSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal GLWindowResizedSignal GLWindowResizedSignal() + { + GLWindowResizedSignal ret = new GLWindowResizedSignal(Interop.GLWindow.GlWindow_ResizedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Disconnect all native signals + /// + internal void DisconnectNativeSignals() + { + if (_focusChangedEventCallback != null) + { + FocusChangedSignal().Disconnect(_focusChangedEventCallback); + } + + if (_windowTouchDataCallback != null) + { + TouchSignal().Disconnect(_windowTouchDataCallback); + } + + if (_windowKeyCallbackDelegate != null) + { + KeyEventSignal().Disconnect(_windowKeyCallbackDelegate); + } + + if (_windowResizedEventCallback != null) + { + GLWindowResizedSignal().Disconnect(_windowResizedEventCallback); + } + } + + private void OnWindowFocusedChanged(IntPtr window, bool focusGained) + { + if (window == IntPtr.Zero) + { + NUILog.Error("OnWindowFocusedChanged() Window is null! Do nothing!"); + return; + } + + FocusChangedEventArgs e = new FocusChangedEventArgs(); + + e.FocusGained = focusGained; + + if (_focusChangedEventHandler != null) + { + _focusChangedEventHandler(this, e); + } + } + + private bool OnWindowTouch(IntPtr touchData) + { + if (touchData == global::System.IntPtr.Zero) + { + NUILog.Error("touchData should not be null!"); + return false; + } + + TouchEventArgs e = new TouchEventArgs(); + + e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData); + + if (_windoTouchDataEventHandler != null) + { + _windoTouchDataEventHandler(this, e); + } + return false; + } + + // Callback for Stage KeyEventsignal + private void OnStageKey(IntPtr data) + { + KeyEventArgs e = new KeyEventArgs(); + e.Key = Tizen.NUI.Key.GetKeyFromPtr(data); + + + if (_stageKeyHandler != null) + { + //here we send all data to user event handlers + _stageKeyHandler(this, e); + } + } + + private void OnResized(IntPtr windowSize) + { + ResizedEventArgs e = new ResizedEventArgs(); + // var val = new Uint16Pair(windowSize, false); + // e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight()); + // val.Dispose(); + + // Workaround : windowSize should be valid pointer from dali, + // but currenlty it is fixed and is not Uint16Pair class. + // will be fixed later. + e.WindowSize = this.WindowSize; + + if (_windowResizedEventHandler != null) + { + _windowResizedEventHandler(this, e); + } + } + + /// + /// The focus changed event argument. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class FocusChangedEventArgs : EventArgs + { + /// + /// FocusGained flag. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool FocusGained + { + get; + set; + } + } + + /// + /// The touch event argument. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class TouchEventArgs : EventArgs + { + private Touch _touch; + + /// + /// Touch. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public Touch Touch + { + get + { + return _touch; + } + set + { + _touch = value; + } + } + } + + /// + /// Key event arguments. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class KeyEventArgs : EventArgs + { + private Key _key; + + /// + /// Key. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public Key Key + { + get + { + return _key; + } + set + { + _key = value; + } + } + } + + /// + /// Feeds a key event into the window. + /// This resized event arguments. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class ResizedEventArgs : EventArgs + { + Size2D _windowSize; + + /// + /// This window size. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public Size2D WindowSize + { + get + { + return _windowSize; + } + set + { + _windowSize = value; + } + } + } + + /// + /// VisibilityChangedArgs + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class VisibilityChangedArgs : EventArgs + { + private bool _visibility; + /// + /// Visibility + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Visibility + { + get => _visibility; + set { + _visibility = value; + } + } + } + + private void OnVisibilityChanged(IntPtr window, bool visibility) + { + if (window == global::System.IntPtr.Zero) + { + NUILog.Error("[ERR] OnVisibilityChanged() window is null"); + return; + } + + VisibilityChangedArgs e = new VisibilityChangedArgs(); + e.Visibility = visibility; + if (VisibilityChangedEventHandler != null) + { + VisibilityChangedEventHandler.Invoke(this, e); + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void GLVisibilityChangedEventCallbackType(IntPtr window, bool visibility); + private GLVisibilityChangedEventCallbackType _GLVisibilityChangedEventCallback; + private event EventHandler VisibilityChangedEventHandler; + private GLWindowVisibilityChangedEvent _GLVisibilityChangedEventSignal; + + /// + /// EffectStart + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler VisibilityChanged + { + add + { + if (VisibilityChangedEventHandler == null) + { + _GLVisibilityChangedEventCallback = OnVisibilityChanged; + _GLVisibilityChangedEventSignal = new GLWindowVisibilityChangedEvent(this); + _GLVisibilityChangedEventSignal.Connect(_GLVisibilityChangedEventCallback); + } + VisibilityChangedEventHandler += value; + } + remove + { + VisibilityChangedEventHandler -= value; + if (VisibilityChangedEventHandler == null) + { + if(_GLVisibilityChangedEventSignal != null) + { + if(_GLVisibilityChangedEventSignal.Empty() == false) + { + _GLVisibilityChangedEventSignal.Disconnect(_GLVisibilityChangedEventCallback); + } + } + } + } + } + + /// + /// VisibiltyChangedSignalEmit + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void VisibiltyChangedSignalEmit(bool visibility) + { + if(_GLVisibilityChangedEventSignal == null) + { + _GLVisibilityChangedEventSignal = new GLWindowVisibilityChangedEvent(this); + } + _GLVisibilityChangedEventSignal.Emit(this, visibility); + } + } +} diff --git a/src/Tizen.NUI/src/public/GLWindowVisibilityChangedEvent.cs b/src/Tizen.NUI/src/public/GLWindowVisibilityChangedEvent.cs new file mode 100644 index 0000000..d1e8248 --- /dev/null +++ b/src/Tizen.NUI/src/public/GLWindowVisibilityChangedEvent.cs @@ -0,0 +1,76 @@ +/* + * 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. + * + */ + +namespace Tizen.NUI +{ + internal class GLWindowVisibilityChangedEvent : Disposable + { + internal GLWindowVisibilityChangedEvent(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + public GLWindowVisibilityChangedEvent(GLWindow glWindow) : this(Interop.GLWindowVisibilityChangedSignal.GetSignal(GLWindow.getCPtr(glWindow)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.GLWindowVisibilityChangedSignal.DeleteSignal(swigCPtr); + } + + public bool Empty() + { + bool ret = Interop.GLWindowVisibilityChangedSignal.Empty(swigCPtr); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = Interop.GLWindowVisibilityChangedSignal.GetConnectionCount(swigCPtr); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.GLWindowVisibilityChangedSignal.Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.GLWindowVisibilityChangedSignal.Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(GLWindow glWindow, bool visibility) + { + Interop.GLWindowVisibilityChangedSignal.Emit(swigCPtr, GLWindow.getCPtr(glWindow), visibility); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } +}