-
-
/*
* Copyright(c) 2019 Samsung Electronics Co., Ltd.
*
*
*/
using System;
-using System.Runtime.InteropServices;
-using Tizen.NUI.BaseComponents;
using System.ComponentModel;
using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using Tizen.NUI.BaseComponents;
namespace Tizen.NUI
{
/// The window has an orientation and indicator properties.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public class Window : BaseHandle
+ public partial class Window : BaseHandle
{
+ private static readonly Window instance = Application.Instance?.GetWindow();
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private global::System.Runtime.InteropServices.HandleRef stageCPtr;
private Layer _rootLayer;
private string _windowTitle;
private List<Layer> _childLayers = new List<Layer>();
- private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
- private RootLayerTouchDataCallbackType _rootLayerTouchDataCallback;
- private WheelEventCallbackType _wheelEventCallback;
- private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
- private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
- private EventHandler _stageContextLostEventHandler;
- private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
- private EventHandler _stageContextRegainedEventHandler;
- private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
- private EventHandler _stageSceneCreatedEventHandler;
- private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
- private WindowResizedEventCallbackType _windowResizedEventCallback;
- private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
-
- private static readonly Window instance = Application.Instance?.GetWindow();
-
private LayoutController localController;
internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Window.Window_SWIGUpcast(cPtr), cMemoryOwn)
NUILog.Debug("layoutController id:" + localController.GetId() );
}
}
-
+
/// <summary>
/// Creates a new Window.<br />
/// This creates an extra window in addition to the default main window<br />
/// <param name="isTranslucent">Whether Window is translucent.</param>
/// <returns>A new Window.</returns>
/// <since_tizen> 6 </since_tizen>
- [EditorBrowsable(EditorBrowsableState.Never)]
public Window(Rectangle windowPosition = null , bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
-
- /// <summary>
- /// FocusChanged event.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public event EventHandler<FocusChangedEventArgs> FocusChanged
- {
- add
- {
- if (_windowFocusChangedEventHandler == null)
- {
- _windowFocusChangedEventCallback = OnWindowFocusedChanged;
- WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
- }
-
- _windowFocusChangedEventHandler += value;
- }
- remove
- {
- _windowFocusChangedEventHandler -= value;
-
- if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
- {
- WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
- }
- }
- }
-
- /// <summary>
- /// This event is emitted when the screen is touched and when the touch ends.<br />
- /// If there are multiple touch points, then this will be emitted when the first touch occurs and
- /// then when the last finger is lifted.<br />
- /// An interrupted event will also be emitted (if it occurs).<br />
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public event EventHandler<TouchEventArgs> TouchEvent
- {
- add
- {
- if (_rootLayerTouchDataEventHandler == null)
- {
- _rootLayerTouchDataCallback = OnWindowTouch;
- this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
- }
- _rootLayerTouchDataEventHandler += value;
- }
- remove
- {
- _rootLayerTouchDataEventHandler -= value;
- if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
- {
- this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
- }
- }
- }
-
- /// <summary>
- /// This event is emitted when the wheel event is received.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public event EventHandler<WheelEventArgs> WheelEvent
- {
- add
- {
- if (_stageWheelHandler == null)
- {
- _wheelEventCallback = OnStageWheel;
- this.StageWheelEventSignal().Connect(_wheelEventCallback);
- }
- _stageWheelHandler += value;
- }
- remove
- {
- _stageWheelHandler -= value;
- if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
- {
- this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
- }
- }
- }
-
- /// <summary>
- /// This event is emitted when the key event is received.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public event EventHandler<KeyEventArgs> KeyEvent
- {
- add
- {
- if (_stageKeyHandler == null)
- {
- _stageKeyCallbackDelegate = OnStageKey;
- KeyEventSignal().Connect(_stageKeyCallbackDelegate);
- }
- _stageKeyHandler += value;
- }
- remove
- {
- _stageKeyHandler -= value;
- if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
- {
- KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
- }
- }
- }
-
- /// <summary>
- /// This event is emitted when the window resized.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public event EventHandler<ResizedEventArgs> Resized
- {
- add
- {
- if (_windowResizedEventHandler == null)
- {
- _windowResizedEventCallback = OnResized;
- ResizedSignal().Connect(_windowResizedEventCallback);
- }
-
- _windowResizedEventHandler += value;
- }
- remove
- {
- _windowResizedEventHandler -= value;
-
- if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
- {
- ResizedSignal().Disconnect(_windowResizedEventCallback);
- }
- }
- }
-
- /// <summary>
- /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- /// Please do not use! this will be deprecated!
- /// Instead please use FocusChanged.
- [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
- "Like: " +
- "Window.Instance.FocusChanged = OnFocusChanged; " +
- "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
- {
- add
- {
- if (_windowFocusChangedEventHandler2 == null)
- {
- _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
- WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
- }
-
- _windowFocusChangedEventHandler2 += value;
- }
- remove
- {
- _windowFocusChangedEventHandler2 -= value;
-
- if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
- {
- WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
- }
- }
- }
-
/// <summary>
- /// ViewAdded will be triggered when the view added on Window
+ /// Creates a new Window with a specific name.<br />
+ /// This creates an extra window in addition to the default main window<br />
/// </summary>
+ /// <param name="name">The name for extra window. </param>
+ /// <param name="windowPosition">The position and size of the Window.</param>
+ /// <param name="isTranslucent">Whether Window is translucent.</param>
+ /// <returns>A new Window.</returns>
/// <since_tizen> 6 </since_tizen>
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler ViewAdded;
-
- internal void SendViewAdded(View view)
- {
- ViewAdded?.Invoke(view, EventArgs.Empty);
- }
-
- internal event EventHandler EventProcessingFinished
- {
- add
- {
- if (_stageEventProcessingFinishedEventHandler == null)
- {
- _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
- EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
- }
- _stageEventProcessingFinishedEventHandler += value;
-
- }
- remove
- {
- _stageEventProcessingFinishedEventHandler -= value;
- if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
- {
- EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
- }
- }
- }
-
- internal event EventHandler ContextLost
- {
- add
- {
- if (_stageContextLostEventHandler == null)
- {
- _stageContextLostEventCallbackDelegate = OnContextLost;
- ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
- }
- _stageContextLostEventHandler += value;
- }
- remove
- {
- _stageContextLostEventHandler -= value;
- if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
- {
- ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
- }
- }
- }
-
- internal event EventHandler ContextRegained
- {
- add
- {
- if (_stageContextRegainedEventHandler == null)
- {
- _stageContextRegainedEventCallbackDelegate = OnContextRegained;
- ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
- }
- _stageContextRegainedEventHandler += value;
- }
- remove
- {
- _stageContextRegainedEventHandler -= value;
- if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
- {
- this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
- }
- }
- }
-
- internal event EventHandler SceneCreated
+ public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
{
- add
- {
- if (_stageSceneCreatedEventHandler == null)
- {
- _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
- SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
- }
- _stageSceneCreatedEventHandler += value;
- }
- remove
- {
- _stageSceneCreatedEventHandler -= value;
- if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
- {
- SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
- }
- }
+ this._windowTitle = name;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
- private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
- private event EventHandler<WheelEventArgs> _stageWheelHandler;
- private event EventHandler<KeyEventArgs> _stageKeyHandler;
- private event EventHandler _stageEventProcessingFinishedEventHandler;
- private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
- private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
-
/// <summary>
/// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
/// </summary>
/// Landscape inverse orientation.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- LandscapeInverse = 270
+ LandscapeInverse = 270,
+ /// <summary>
+ /// 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.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ NoOrientationPreference = -1
}
/// <summary>
};
/// <summary>
+ /// Enumeration for transition effect's state.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum EffectStates
+ {
+ /// <summary>
+ /// None state.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ None = 0,
+ /// <summary>
+ /// Transition effect is started.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Start,
+ /// <summary>
+ /// Transition effect is ended.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ End,
+ }
+
+ /// <summary>
+ /// Enumeration for transition effect's type.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum EffectTypes
+ {
+ /// <summary>
+ /// None type.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ None = 0,
+ /// <summary>
+ /// Window show effect.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Show,
+ /// <summary>
+ /// Window hide effect.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Hide,
+ }
+
+ /// <summary>
/// Enumeration for opacity of the indicator.
/// </summary>
internal enum IndicatorBackgroundOpacity
}
/// <summary>
+ /// Get Resource ID of window
+ /// </summary>
+ internal int ResourceID
+ {
+ get
+ {
+ int ret = Interop.Window.GetResouceID(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+ }
+
+ /// <summary>
/// Gets or sets a window type.
/// </summary>
/// <since_tizen> 3 </since_tizen>
SetPosition(value);
}
}
+
+ /// <summary>
+ /// Sets position and size of the window. This API guarantees that
+ /// both moving and resizing of window will appear on the screen at once.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rectangle WindowPositionSize
+ {
+ get
+ {
+ Position2D position = GetPosition();
+ Size2D size = GetSize();
+ Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
+ return ret;
+ }
+ set
+ {
+ SetPositionSize(value);
+ }
+ }
+
internal static Vector4 DEFAULT_BACKGROUND_COLOR
{
get
}
}
+ /// <summary>
+ /// Get the LayoutController for this Window.
+ /// </summary>
internal LayoutController LayoutController
{
get
}
/// <summary>
+ /// Destroy the window immediately.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Destroy()
+ {
+ this.Dispose();
+ }
+
+ /// <summary>
/// Keep rendering for at least the given amount of time.
/// </summary>
/// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
+ /// <summary>
+ /// Sets whether the window is transparent or not.
+ /// </summary>
+ /// <param name="transparent">Whether the window is transparent or not.</param>
+ /// <since_tizen> 5 </since_tizen>
+ public void SetTransparency(bool transparent)
{
- return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ Interop.Window.SetTransparency(swigCPtr, transparent);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
}
- internal static Window GetCurrent()
+ /// <summary>
+ /// Sets parent window of the window.
+ /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
+ /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
+ /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
+ /// </summary>
+ /// <param name="parent">The parent window.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public void SetParent(Window parent)
{
- Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
+ Interop.Window.SetParent(swigCPtr, Window.getCPtr(parent));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
- internal static bool IsInstalled()
+ /// <summary>
+ /// Unsets parent window of the window.
+ /// After unsetting, the window is disconnected his parent window.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public void Unparent()
{
- bool ret = Interop.Stage.Stage_IsInstalled();
+ Interop.Window.Unparent(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
- internal WindowFocusSignalType WindowFocusChangedSignal()
+ /// <summary>
+ /// Gets parent window of the window.
+ /// </summary>
+ /// <returns>The parent window of the window.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ public Window GetParent()
{
- WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
+ Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.GetParent(swigCPtr)) as Window;
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
- internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
{
- Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
- internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
+ internal static Window GetCurrent()
{
- Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
+ Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
- internal void RotateIndicator(Window.WindowOrientation orientation)
+ internal static bool IsInstalled()
{
- Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
+ bool ret = Interop.Stage.Stage_IsInstalled();
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
- internal void AddAvailableOrientation(Window.WindowOrientation orientation)
+ internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
{
- Interop.WindowInternal.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
+ Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
+ internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
{
- Interop.WindowInternal.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
+ Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal void SetPreferredOrientation(Window.WindowOrientation orientation)
+ internal void RotateIndicator(Window.WindowOrientation orientation)
{
- Interop.WindowInternal.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
+ Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal Window.WindowOrientation GetPreferredOrientation()
+ /// <summary>
+ /// Adds an orientation to the list of available orientations.
+ /// </summary>
+ /// <param name="orientation">The available orientation to add</param>
+ /// <since_tizen> 6 </since_tizen>
+ public void AddAvailableOrientation(Window.WindowOrientation orientation)
{
- Window.WindowOrientation ret = (Window.WindowOrientation)Interop.WindowInternal.Window_GetPreferredOrientation(swigCPtr);
+ Interop.Window.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
- internal DragAndDropDetector GetDragAndDropDetector()
+ /// <summary>
+ /// Removes an orientation from the list of available orientations.
+ /// </summary>
+ /// <param name="orientation">The available orientation to remove.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
{
- DragAndDropDetector ret = new DragAndDropDetector(Interop.WindowInternal.Window_GetDragAndDropDetector(swigCPtr), true);
+ Interop.Window.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
- internal Any GetNativeHandle()
+ /// <summary>
+ /// Sets a preferred orientation.
+ /// </summary>
+ /// <param name="orientation">The preferred orientation.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public void SetPreferredOrientation(Window.WindowOrientation orientation)
{
- Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
+ Interop.Window.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Gets the preferred orientation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// <returns>The preferred orientation if previously set, or none.</returns>
+ public Window.WindowOrientation GetPreferredOrientation()
+ {
+ Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.Window_GetPreferredOrientation(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
- internal WindowFocusSignalType FocusChangedSignal()
+ internal Any GetNativeHandle()
{
- WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
+ Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
return ret;
}
- internal KeyEventSignal KeyEventSignal()
- {
- KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal VoidSignal EventProcessingFinishedSignal()
- {
- VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_EventProcessingFinishedSignal(stageCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal TouchSignal TouchSignal()
- {
- TouchSignal ret = new TouchSignal(Interop.Window.TouchSignal(swigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal TouchDataSignal TouchDataSignal()
- {
- TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal VoidSignal ContextLostSignal()
- {
- VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal VoidSignal ContextRegainedSignal()
- {
- VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextRegainedSignal(stageCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal VoidSignal SceneCreatedSignal()
- {
- VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal ResizedSignal ResizedSignal()
- {
- ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
internal void SetWindowSize(Size2D size)
{
var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
// Setting Position of the window should request a relayout of the tree.
-
}
internal Position2D GetPosition()
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
// Setting Position of the window should request a relayout of the tree.
-
- }
-
- /// <summary>
- /// Sets whether the window is transparent or not.
- /// </summary>
- /// <param name="transparent">Whether the window is transparent or not.</param>
- /// <since_tizen> 5 </since_tizen>
- public void SetTransparency(bool transparent) {
- Interop.Window.SetTransparency(swigCPtr, transparent);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
- // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
-
}
/// <summary>
//Release your own managed resources here.
//You should release all of your own disposable objects here.
+ _rootLayer.Dispose();
+ localController.Dispose();
+
+ foreach(var layer in _childLayers)
+ {
+ layer.Dispose();
+ }
+ _childLayers.Clear();
}
this.DisconnectNativeSignals();
base.Dispose(type);
}
-
- internal System.IntPtr GetNativeWindowHandler()
- {
- System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private void OnWindowFocusedChanged(bool focusGained)
- {
- FocusChangedEventArgs e = new FocusChangedEventArgs();
-
- e.FocusGained = focusGained;
-
- if (_windowFocusChangedEventHandler != null)
- {
- _windowFocusChangedEventHandler(this, e);
- }
- }
-
- private StageWheelSignal WheelEventSignal()
- {
- StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private WheelSignal StageWheelEventSignal()
- {
- WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending)
- throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- private bool OnWindowTouch(IntPtr view, 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 (_rootLayerTouchDataEventHandler != null)
- {
- _rootLayerTouchDataEventHandler(this, e);
- }
- return false;
- }
-
- private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
- {
- if (wheelEvent == global::System.IntPtr.Zero)
- {
- NUILog.Error("wheelEvent should not be null!");
- return true;
- }
-
- WheelEventArgs e = new WheelEventArgs();
-
- e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
-
- if (_stageWheelHandler != null)
- {
- _stageWheelHandler(this, e);
- }
- return true;
- }
-
- // 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);
- }
- }
-
- // Callback for Stage EventProcessingFinishedSignal
- private void OnEventProcessingFinished()
- {
- if (_stageEventProcessingFinishedEventHandler != null)
- {
- _stageEventProcessingFinishedEventHandler(this, null);
- }
- }
-
- // Callback for Stage ContextLostSignal
- private void OnContextLost()
- {
- if (_stageContextLostEventHandler != null)
- {
- _stageContextLostEventHandler(this, null);
- }
- }
-
- // Callback for Stage ContextRegainedSignal
- private void OnContextRegained()
- {
- if (_stageContextRegainedEventHandler != null)
- {
- _stageContextRegainedEventHandler(this, null);
- }
- }
-
- // Callback for Stage SceneCreatedSignal
- private void OnSceneCreated()
- {
- if (_stageSceneCreatedEventHandler != null)
- {
- _stageSceneCreatedEventHandler(this, null);
- }
- }
-
- 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();
-
- if (_windowResizedEventHandler != null)
- {
- _windowResizedEventHandler(this, e);
- }
- }
-
- private void OnWindowFocusedChanged2(bool focusGained)
- {
- FocusChangedEventArgs e = new FocusChangedEventArgs();
-
- e.FocusGained = focusGained;
-
- if (_windowFocusChangedEventHandler2 != null)
- {
- _windowFocusChangedEventHandler2(this, e);
- }
- }
-
- /// <summary>
- /// The focus changed event argument.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public class FocusChangedEventArgs : EventArgs
- {
- /// <summary>
- /// FocusGained flag.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public bool FocusGained
- {
- get;
- set;
- }
- }
-
- /// <summary>
- /// The touch event argument.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public class TouchEventArgs : EventArgs
- {
- private Touch _touch;
-
- /// <summary>
- /// Touch.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public Touch Touch
- {
- get
- {
- return _touch;
- }
- set
- {
- _touch = value;
- }
- }
- }
-
- /// <summary>
- /// Wheel event arguments.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public class WheelEventArgs : EventArgs
- {
- private Wheel _wheel;
-
- /// <summary>
- /// Wheel.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public Wheel Wheel
- {
- get
- {
- return _wheel;
- }
- set
- {
- _wheel = value;
- }
- }
- }
-
- /// <summary>
- /// Key event arguments.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public class KeyEventArgs : EventArgs
- {
- private Key _key;
-
- /// <summary>
- /// Key.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public Key Key
- {
- get
- {
- return _key;
- }
- set
- {
- _key = value;
- }
- }
- }
-
- /// <summary>
- /// Sets position and size of the window. This API guarantees that
- /// both moving and resizing of window will appear on the screen at once.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Rectangle WindowPositionSize
- {
- get
- {
- Position2D position = GetPosition();
- Size2D size = GetSize();
- Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
- return ret;
- }
- set
- {
- SetPositionSize(value);
- }
- }
-
- /// <summary>
- /// Feeds a key event into the window.
- /// This resized event arguments.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public class ResizedEventArgs : EventArgs
- {
- Size2D _windowSize;
-
- /// <summary>
- /// This window size.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public Size2D WindowSize
- {
- get
- {
- return _windowSize;
- }
- set
- {
- _windowSize = value;
- }
- }
- }
-
- /// <summary>
- /// Please do not use! this will be deprecated
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
- "Like: " +
- "Window.Instance.FocusChanged = OnFocusChanged; " +
- "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class WindowFocusChangedEventArgs : EventArgs
- {
- /// <summary>
- /// Please do not use! this will be deprecated
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public bool FocusGained
- {
- get;
- set;
- }
- }
-
- /// <summary>
- /// Contains and encapsulates Native Window handle.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public class SafeNativeWindowHandle : SafeHandle
- {
- /// <summary>
- /// Contructor, Native window handle is set to handle.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
- {
- SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
- }
- /// <summary>
- /// Null check if the handle is valid or not.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- 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()
- {
- return true;
- }
- }
-
- /// <summary>
- /// Disconnect all native signals
- /// </summary>
- /// <since_tizen> 5 </since_tizen>
- internal void DisconnectNativeSignals()
- {
- if( _windowFocusChangedEventCallback != null )
- {
- WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
- }
-
- if( _rootLayerTouchDataCallback != null )
- {
- TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
- }
-
- if( _wheelEventCallback != null )
- {
- StageWheelEventSignal().Disconnect(_wheelEventCallback);
- }
-
- if( _stageKeyCallbackDelegate != null )
- {
- KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
- }
-
- if( _stageEventProcessingFinishedEventCallbackDelegate != null )
- {
- EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
- }
-
- if( _stageContextLostEventCallbackDelegate != null )
- {
- ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
- }
-
- if( _stageContextRegainedEventCallbackDelegate != null )
- {
- ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
- }
-
- if( _stageSceneCreatedEventCallbackDelegate != null )
- {
- SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
- }
-
- if( _windowResizedEventCallback != null )
- {
- ResizedSignal().Disconnect(_windowResizedEventCallback);
- }
-
- if( _windowFocusChangedEventCallback2 != null )
- {
- WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
- }
-
- }
-
}
}