X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FWindow.cs;h=7da98b043f99abcf5caaf0508131762113e0c905;hb=ff607138dfabd4cfa5ab3ffe1af249f807b70cae;hp=bf53c0a02f142fa1c7283f695702e206c1690b1f;hpb=e2d68735ebe04978569bd61546d1f2269c40a430;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs old mode 100644 new mode 100755 index bf53c0a..7da98b0 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -1,5 +1,7 @@ + + /* - * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * Copyright(c) 2019 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. @@ -18,6 +20,7 @@ using System; using System.Runtime.InteropServices; using Tizen.NUI.BaseComponents; using System.ComponentModel; +using System.Collections.Generic; namespace Tizen.NUI { @@ -32,282 +35,417 @@ namespace Tizen.NUI private global::System.Runtime.InteropServices.HandleRef stageCPtr; private Layer _rootLayer; private string _windowTitle; + private List _childLayers = new List(); + 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(); - internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn) + private LayoutController localController; + + internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Window.Window_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - if (NDalicPINVOKE.Stage_IsInstalled()) + if (Interop.Stage.Stage_IsInstalled()) { - stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent()); + stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.Stage_GetCurrent()); + + localController = new LayoutController(this); + NUILog.Debug("layoutController id:" + localController.GetId() ); } } - internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj) + /// + /// Creates a new Window.
+ /// This creates an extra window in addition to the default main window
+ ///
+ /// The position and size of the Window. + /// Whether Window is translucent. + /// A new Window. + /// 6 + [EditorBrowsable(EditorBrowsableState.Never)] + public Window(Rectangle windowPosition = null , bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), "", isTranslucent), true) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + 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); + /// - /// To make the window instance be disposed. + /// FocusChanged event. /// - /// Please DO NOT use! This will be deprecated! - /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, IMFManager, TtsPlayer, Window) is not required. - /// Because it is Sigletone, so it is alive for one thread until the NUI is terminated, so it never be disposed. /// 3 - [EditorBrowsable(EditorBrowsableState.Never)] - protected override void Dispose(DisposeTypes type) + public event EventHandler FocusChanged { - if (disposed) + add { - return; - } + if (_windowFocusChangedEventHandler == null) + { + _windowFocusChangedEventCallback = OnWindowFocusedChanged; + WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback); + } - if (type == DisposeTypes.Explicit) - { - //Called by User - //Release your own managed resources here. - //You should release all of your own disposable objects here. + _windowFocusChangedEventHandler += value; } - - //Release your own unmanaged resources here. - //You should not access any managed member here except static instance. - //because the execution order of Finalizes is non-deterministic. - - if (_windowFocusChangedEventCallback != null) + remove { - WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback); - } + _windowFocusChangedEventHandler -= value; - if (_stageTouchCallbackDelegate != null) - { - TouchSignal().Disconnect(_stageTouchCallbackDelegate); + if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null) + { + WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback); + } } + } - if (_stageWheelCallbackDelegate != null) + /// + /// This event is emitted when the screen is touched and when the touch ends.
+ /// If there are multiple touch points, then this will be emitted when the first touch occurs and + /// then when the last finger is lifted.
+ /// An interrupted event will also be emitted (if it occurs).
+ ///
+ /// 3 + public event EventHandler TouchEvent + { + add { - WheelEventSignal().Disconnect(_stageWheelCallbackDelegate); + if (_rootLayerTouchDataEventHandler == null) + { + _rootLayerTouchDataCallback = OnWindowTouch; + this.TouchDataSignal().Connect(_rootLayerTouchDataCallback); + } + _rootLayerTouchDataEventHandler += value; } - - if (_stageKeyCallbackDelegate != null) + remove { - KeyEventSignal().Disconnect(_stageKeyCallbackDelegate); + _rootLayerTouchDataEventHandler -= value; + if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false) + { + this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback); + } } + } - if (_stageEventProcessingFinishedEventCallbackDelegate != null) + /// + /// This event is emitted when the wheel event is received. + /// + /// 3 + public event EventHandler WheelEvent + { + add { - EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate); + if (_stageWheelHandler == null) + { + _wheelEventCallback = OnStageWheel; + this.StageWheelEventSignal().Connect(_wheelEventCallback); + } + _stageWheelHandler += value; } - - if (_stageContextLostEventCallbackDelegate != null) + remove { - ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate); + _stageWheelHandler -= value; + if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false) + { + this.StageWheelEventSignal().Disconnect(_wheelEventCallback); + } } + } - if (_stageContextRegainedEventCallbackDelegate != null) + /// + /// This event is emitted when the key event is received. + /// + /// 3 + public event EventHandler KeyEvent + { + add { - this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate); + if (_stageKeyHandler == null) + { + _stageKeyCallbackDelegate = OnStageKey; + KeyEventSignal().Connect(_stageKeyCallbackDelegate); + } + _stageKeyHandler += value; } - - if (_stageSceneCreatedEventCallbackDelegate != null) + remove { - SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate); + _stageKeyHandler -= value; + if (_stageKeyHandler == null && KeyEventSignal().Empty() == false) + { + KeyEventSignal().Disconnect(_stageKeyCallbackDelegate); + } } + } - if (_windowResizedEventCallback != null) + /// + /// This event is emitted when the window resized. + /// + /// 3 + public event EventHandler Resized + { + add { - ResizedSignal().Disconnect(_windowResizedEventCallback); - } + if (_windowResizedEventHandler == null) + { + _windowResizedEventCallback = OnResized; + ResizedSignal().Connect(_windowResizedEventCallback); + } - if (_windowFocusChangedEventCallback2 != null) - { - WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2); + _windowResizedEventHandler += value; } - - if (swigCPtr.Handle != global::System.IntPtr.Zero) + remove { - if (swigCMemOwn) + _windowResizedEventHandler -= value; + + if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null) { - swigCMemOwn = false; - NDalicPINVOKE.delete_Window(swigCPtr); - NDalicPINVOKE.delete_Stage(stageCPtr); + ResizedSignal().Disconnect(_windowResizedEventCallback); } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } - - base.Dispose(type); - } - - internal static Window GetCurrent() - { - Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal static bool IsInstalled() - { - bool ret = NDalicPINVOKE.Stage_IsInstalled(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; } /// - /// Sets whether the window accepts a focus or not. + /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead. /// - /// If a focus is accepted or not. The default is true. /// 3 - public void SetAcceptFocus(bool accept) + /// 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 WindowFocusChanged { - NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } + add + { + if (_windowFocusChangedEventHandler2 == null) + { + _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2; + WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2); + } - /// - /// Returns whether the window accepts a focus or not. - /// - /// True if the window accepts a focus, false otherwise. - /// 3 - public bool IsFocusAcceptable() - { - bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + _windowFocusChangedEventHandler2 += value; + } + remove + { + _windowFocusChangedEventHandler2 -= value; - return ret; + if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null) + { + WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2); + } + } } /// - /// Shows the window if it is hidden. + /// ViewAdded will be triggered when the view added on Window /// - /// 3 - public void Show() - { - NDalicPINVOKE.Show(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } + /// 6 + /// 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; - /// - /// Hides the window if it is showing. - /// - /// 3 - public void Hide() + internal void SendViewAdded(View view) { - NDalicPINVOKE.Hide(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + ViewAdded?.Invoke(view, EventArgs.Empty); } - /// - /// Retrieves whether the window is visible or not. - /// - /// True if the window is visible. - /// 3 - public bool IsVisible() + internal event EventHandler EventProcessingFinished { - bool temp = NDalicPINVOKE.IsVisible(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return temp; - } + add + { + if (_stageEventProcessingFinishedEventHandler == null) + { + _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished; + EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate); + } + _stageEventProcessingFinishedEventHandler += value; - /// - /// Gets the count of supported auxiliary hints of the window. - /// - /// The number of supported auxiliary hints. - /// 3 - public uint GetSupportedAuxiliaryHintCount() - { - uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + } + remove + { + _stageEventProcessingFinishedEventHandler -= value; + if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false) + { + EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate); + } + } } - /// - /// Gets the supported auxiliary hint string of the window. - /// - /// The index of the supported auxiliary hint lists. - /// The auxiliary hint string of the index. - /// 3 - public string GetSupportedAuxiliaryHint(uint index) + internal event EventHandler ContextLost { - string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + add + { + if (_stageContextLostEventHandler == null) + { + _stageContextLostEventCallbackDelegate = OnContextLost; + ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate); + } + _stageContextLostEventHandler += value; + } + remove + { + _stageContextLostEventHandler -= value; + if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false) + { + ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate); + } + } } - /// - /// Creates an auxiliary hint of the window. - /// - /// The auxiliary hint string. - /// The value string. - /// The ID of created auxiliary hint, or 0 on failure. - /// 3 - public uint AddAuxiliaryHint(string hint, string value) + internal event EventHandler ContextRegained { - uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + 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 + { + add + { + if (_stageSceneCreatedEventHandler == null) + { + _stageSceneCreatedEventCallbackDelegate = OnSceneCreated; + SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate); + } + _stageSceneCreatedEventHandler += value; + } + remove + { + _stageSceneCreatedEventHandler -= value; + if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false) + { + SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate); + } + } } + private event EventHandler _windowFocusChangedEventHandler; + private event EventHandler _rootLayerTouchDataEventHandler; + private event EventHandler _stageWheelHandler; + private event EventHandler _stageKeyHandler; + private event EventHandler _stageEventProcessingFinishedEventHandler; + private event EventHandler _windowResizedEventHandler; + private event EventHandler _windowFocusChangedEventHandler2; + /// - /// Removes an auxiliary hint of the window. + /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing. /// - /// The ID of the auxiliary hint. - /// True if no error occurred, false otherwise. /// 3 - public bool RemoveAuxiliaryHint(uint id) + public enum WindowOrientation { - bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + /// + /// Portrait orientation. The height of the display area is greater than the width. + /// + /// 3 + Portrait = 0, + /// + /// Landscape orientation. A wide view area is needed. + /// + /// 3 + Landscape = 90, + /// + /// Portrait inverse orientation. + /// + /// 3 + PortraitInverse = 180, + /// + /// Landscape inverse orientation. + /// + /// 3 + LandscapeInverse = 270 } /// - /// Changes a value of the auxiliary hint. + /// Enumeration for the key grab mode for platform-level APIs. /// - /// The auxiliary hint ID. - /// The value string to be set. - /// True if no error occurred, false otherwise. /// 3 - public bool SetAuxiliaryHintValue(uint id, string value) + public enum KeyGrabMode { - bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } + /// + /// Grabs a key only when on the top of the grabbing-window stack mode. + /// + Topmost = 0, + /// + /// Grabs a key together with the other client window(s) mode. + /// + Shared, + /// + /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack with the possibility of overriding the grab by the other client window mode. + /// + OverrideExclusive, + /// + /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode. + /// + Exclusive + }; /// - /// Gets a value of the auxiliary hint. + /// Enumeration for opacity of the indicator. /// - /// The auxiliary hint ID. - /// The string value of the auxiliary hint ID, or an empty string if none exists. - /// 3 - public string GetAuxiliaryHintValue(uint id) + internal enum IndicatorBackgroundOpacity { - string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + Opaque = 100, + Translucent = 50, + Transparent = 0 } /// - /// Gets an ID of the auxiliary hint string. + /// Enumeration for visible mode of the indicator. /// - /// The auxiliary hint string. - /// The ID of auxiliary hint string, or 0 on failure. - /// 3 - public uint GetAuxiliaryHintId(string hint) + internal enum IndicatorVisibleMode { - uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + Invisible = 0, + Visible = 1, + Auto = 2 } /// - /// Sets a region to accept input events. + /// The stage instance property (read-only).
+ /// Gets the current window.
///
- /// The region to accept input events. /// 3 - public void SetInputRegion(Rectangle inputRegion) + public static Window Instance { - NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + get + { + return instance; + } } /// @@ -318,550 +456,564 @@ namespace Tizen.NUI { get { - WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr); + WindowType ret = (WindowType)Interop.Window.GetType(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } set { - NDalicPINVOKE.SetType(swigCPtr, (int)value); + Interop.Window.SetType(swigCPtr, (int)value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } /// - /// Sets a priority level for the specified notification window. + /// Gets/Sets a window title. /// - /// The notification window level. - /// True if no error occurred, false otherwise. - /// 3 - public bool SetNotificationLevel(NotificationLevel level) + /// 4 + public string Title { - bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + get + { + return _windowTitle; + } + set + { + _windowTitle = value; + SetClass(_windowTitle, ""); + } } /// - /// Gets a priority level for the specified notification window. + /// The rendering behavior of a Window. /// - /// The notification window level. - /// 3 - public NotificationLevel GetNotificationLevel() + /// 5 + public RenderingBehaviorType RenderingBehavior { - NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + get + { + return GetRenderingBehavior(); + } + set + { + SetRenderingBehavior(value); + } } /// - /// Sets a transparent window's visual state to opaque. + /// The window size property (read-only). /// - /// Whether the window's visual state is opaque. /// 3 - public void SetOpaqueState(bool opaque) + public Size2D Size { - NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + get + { + Size2D ret = GetSize(); + return ret; + } } /// - /// Returns whether a transparent window's visual state is opaque or not. + /// The background color property. /// - /// True if the window's visual state is opaque, false otherwise. /// 3 - public bool IsOpaqueState() + public Color BackgroundColor { - bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + set + { + SetBackgroundColor(value); + } + get + { + Color ret = GetBackgroundColor(); + return ret; + } } /// - /// Sets a window's screen off mode. + /// The DPI property (read-only).
+ /// Retrieves the DPI of the display device to which the Window is connected.
///
- /// The screen mode. - /// True if no error occurred, false otherwise. - /// 4 - public bool SetScreenOffMode(ScreenOffMode screenOffMode) + /// 3 + public Vector2 Dpi { - bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + get + { + return GetDpi(); + } } /// - /// Gets the screen mode of the window. + /// The layer count property (read-only).
+ /// Queries the number of on-Window layers.
///
- /// The screen off mode. - /// 4 - public ScreenOffMode GetScreenOffMode() + /// 3 + public uint LayerCount { - ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + get + { + return GetLayerCount(); + } } /// - /// Sets preferred brightness of the window. + /// Gets or sets a size of the window. /// - /// The preferred brightness (0 to 100). - /// True if no error occurred, false otherwise. - /// 3 - public bool SetBrightness(int brightness) - { - bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// Gets the preferred brightness of the window. - /// - /// The preferred brightness. - /// 3 - public int GetBrightness() - { - int ret = NDalicPINVOKE.GetBrightness(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// The focus changed event argument. - /// - /// 3 - public class FocusChangedEventArgs : EventArgs + /// 4 + public Size2D WindowSize { - /// - /// FocusGained flag. - /// - /// 3 - public bool FocusGained + get { - get; - set; + return GetWindowSize(); + } + set + { + SetWindowSize(value); } } - private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback; - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void WindowFocusChangedEventCallbackType(bool focusGained); - private event EventHandler _windowFocusChangedEventHandler; - /// - /// FocusChanged event. + /// Gets or sets a position of the window. /// - /// 3 - public event EventHandler FocusChanged + /// 4 + public Position2D WindowPosition { - add + get { - if (_windowFocusChangedEventHandler == null) - { - _windowFocusChangedEventCallback = OnWindowFocusedChanged; - WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback); - } - - _windowFocusChangedEventHandler += value; + return GetPosition(); } - remove + set { - _windowFocusChangedEventHandler -= value; - - if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null) - { - WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback); - } + SetPosition(value); } } - - private void OnWindowFocusedChanged(bool focusGained) + internal static Vector4 DEFAULT_BACKGROUND_COLOR { - FocusChangedEventArgs e = new FocusChangedEventArgs(); - - e.FocusGained = focusGained; - - if (_windowFocusChangedEventHandler != null) + get { - _windowFocusChangedEventHandler(this, e); + global::System.IntPtr cPtr = Interop.Stage.Stage_DEFAULT_BACKGROUND_COLOR_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } } - /// - /// Gets/Sets a window title. - /// - /// 4 - public string Title + internal static Vector4 DEBUG_BACKGROUND_COLOR { get { - return _windowTitle; - } - set - { - _windowTitle = value; - SetClass(_windowTitle, ""); + global::System.IntPtr cPtr = Interop.Stage.Stage_DEBUG_BACKGROUND_COLOR_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } } - internal WindowFocusSignalType WindowFocusChangedSignal() + internal List LayersChildren { - WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + get + { + return _childLayers; + } } - internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true) + internal LayoutController LayoutController { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + get + { + return localController; + } } - internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true) + /// + /// Feed a key-event into the window. + /// + /// The key event to feed. + /// 4 + [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")] + public static void FeedKeyEvent(Key keyEvent) { + Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true) + /// + /// Sets whether the window accepts a focus or not. + /// + /// If a focus is accepted or not. The default is true. + /// 3 + public void SetAcceptFocus(bool accept) { + Interop.Window.SetAcceptFocus(swigCPtr, accept); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true) + /// + /// Returns whether the window accepts a focus or not. + /// + /// True if the window accepts a focus, false otherwise. + /// 3 + public bool IsFocusAcceptable() { + bool ret = Interop.Window.IsFocusAcceptable(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode) - { - NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity) + /// + /// Shows the window if it is hidden. + /// + /// 3 + public void Show() { - NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity); + Interop.Window.Show(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal void RotateIndicator(Window.WindowOrientation orientation) + /// + /// Hides the window if it is showing. + /// + /// 3 + public void Hide() { - NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation); + Interop.Window.Hide(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// - /// Sets the window name and the class string. + /// Retrieves whether the window is visible or not. /// - /// The name of the window. - /// The class of the window. - /// 4 - public void SetClass(string name, string klass) + /// True if the window is visible. + /// 3 + public bool IsVisible() { - NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass); + bool temp = Interop.Window.IsVisible(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return temp; } /// - /// Raises the window to the top of the window stack. + /// Gets the count of supported auxiliary hints of the window. /// + /// The number of supported auxiliary hints. /// 3 - public void Raise() + public uint GetSupportedAuxiliaryHintCount() { - NDalicPINVOKE.Window_Raise(swigCPtr); + uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } /// - /// Lowers the window to the bottom of the window stack. + /// Gets the supported auxiliary hint string of the window. /// + /// The index of the supported auxiliary hint lists. + /// The auxiliary hint string of the index. /// 3 - public void Lower() + public string GetSupportedAuxiliaryHint(uint index) { - NDalicPINVOKE.Window_Lower(swigCPtr); + string ret = Interop.Window.GetSupportedAuxiliaryHint(swigCPtr, index); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } /// - /// Activates the window to the top of the window stack even it is iconified. + /// Creates an auxiliary hint of the window. /// + /// The auxiliary hint string. + /// The value string. + /// The ID of created auxiliary hint, or 0 on failure. /// 3 - public void Activate() + public uint AddAuxiliaryHint(string hint, string value) { - NDalicPINVOKE.Window_Activate(swigCPtr); + uint ret = Interop.Window.AddAuxiliaryHint(swigCPtr, hint, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - internal void AddAvailableOrientation(Window.WindowOrientation orientation) + /// + /// Removes an auxiliary hint of the window. + /// + /// The ID of the auxiliary hint. + /// True if no error occurred, false otherwise. + /// 3 + public bool RemoveAuxiliaryHint(uint id) { - NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation); + bool ret = Interop.Window.RemoveAuxiliaryHint(swigCPtr, id); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - internal void RemoveAvailableOrientation(Window.WindowOrientation orientation) + /// + /// Changes a value of the auxiliary hint. + /// + /// The auxiliary hint ID. + /// The value string to be set. + /// True if no error occurred, false otherwise. + /// 3 + public bool SetAuxiliaryHintValue(uint id, string value) { - NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation); + bool ret = Interop.Window.SetAuxiliaryHintValue(swigCPtr, id, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - internal void SetPreferredOrientation(Window.WindowOrientation orientation) + /// + /// 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. + /// 3 + public string GetAuxiliaryHintValue(uint id) { - NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation); + string ret = Interop.Window.GetAuxiliaryHintValue(swigCPtr, id); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - internal Window.WindowOrientation GetPreferredOrientation() + /// + /// Gets an ID of the auxiliary hint string. + /// + /// The auxiliary hint string. + /// The ID of auxiliary hint string, or 0 on failure. + /// 3 + public uint GetAuxiliaryHintId(string hint) { - Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr); + uint ret = Interop.Window.GetAuxiliaryHintId(swigCPtr, hint); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - internal DragAndDropDetector GetDragAndDropDetector() + /// + /// Sets a region to accept input events. + /// + /// The region to accept input events. + /// 3 + public void SetInputRegion(Rectangle inputRegion) { - DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true); + Interop.Window.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; } - internal Any GetNativeHandle() + /// + /// Sets a priority level for the specified notification window. + /// + /// The notification window level. + /// True if no error occurred, false otherwise. + /// 3 + public bool SetNotificationLevel(NotificationLevel level) { - Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true); + bool ret = Interop.Window.SetNotificationLevel(swigCPtr, (int)level); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - internal WindowFocusSignalType FocusChangedSignal() + /// + /// Gets a priority level for the specified notification window. + /// + /// The notification window level. + /// 3 + public NotificationLevel GetNotificationLevel() { - WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false); + NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// - /// Gets the default ( root ) layer. + /// 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. ///
- /// The root layer. + /// 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. + ///
/// 3 - public Layer GetDefaultLayer() + public void SetOpaqueState(bool opaque) { - return this.GetRootLayer(); + Interop.Window.SetOpaqueState(swigCPtr, opaque); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal void Add(Layer layer) + /// + /// 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. + /// 3 + public bool IsOpaqueState() { - NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer)); + bool ret = Interop.Window.IsOpaqueState(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - internal void Remove(Layer layer) + /// + /// Sets a window's screen off mode. + /// + /// The screen mode. + /// True if no error occurred, false otherwise. + /// 4 + public bool SetScreenOffMode(ScreenOffMode screenOffMode) { - NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer)); + bool ret = Interop.Window.SetScreenOffMode(swigCPtr, (int)screenOffMode); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } /// - /// Add a child view to window. + /// Gets the screen mode of the window. /// - /// the child should be added to the window. - /// 3 - public void Add(View view) + /// The screen off mode. + /// 4 + public ScreenOffMode GetScreenOffMode() { - GetRootLayer()?.Add(view); + ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } /// - /// Remove a child view from window. + /// Sets preferred brightness of the window. /// - /// the child to be removed. + /// The preferred brightness (0 to 100). + /// True if no error occurred, false otherwise. /// 3 - public void Remove(View view) - { - GetRootLayer()?.Remove(view); - } - - internal Vector2 GetSize() + public bool SetBrightness(int brightness) { - Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true); + bool ret = Interop.Window.SetBrightness(swigCPtr, brightness); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - internal RenderTaskList GetRenderTaskList() + /// + /// Gets the preferred brightness of the window. + /// + /// The preferred brightness. + /// 3 + public int GetBrightness() { - RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true); + int ret = Interop.Window.GetBrightness(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// - /// Queries the number of on-window layers. + /// Sets the window name and the class string. /// - /// The number of layers. - /// Note that a default layer is always provided (count >= 1). - internal uint GetLayerCount() + /// The name of the window. + /// The class of the window. + /// 4 + public void SetClass(string name, string klass) { - uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr); + Interop.Window.Window_SetClass(swigCPtr, name, klass); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; } /// - /// Retrieves the layer at a specified depth. + /// Raises the window to the top of the window stack. /// - /// The layer's depth index. - /// The layer found at the given depth. /// 3 - public Layer GetLayer(uint depth) - { - IntPtr cPtr = NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth); - Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer; - - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal Layer GetRootLayer() - { - // Window.IsInstalled() is actually true only when called from event thread and - // Core has been initialized, not when Stage is ready. - if (_rootLayer == null && Window.IsInstalled()) - { - _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - return _rootLayer; - } - - internal void SetBackgroundColor(Vector4 color) - { - NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - internal Vector4 GetBackgroundColor() - { - Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal Vector2 GetDpi() - { - Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal ObjectRegistry GetObjectRegistry() + public void Raise() { - ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true); + Interop.Window.Window_Raise(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; } /// - /// Keep rendering for at least the given amount of time. + /// Lowers the window to the bottom of the window stack. /// - /// Time to keep rendering, 0 means render at least one more frame. /// 3 - public void KeepRendering(float durationSeconds) - { - NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - internal KeyEventSignal KeyEventSignal() - { - KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal VoidSignal EventProcessingFinishedSignal() - { - VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal TouchSignal TouchSignal() - { - TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - private StageWheelSignal WheelEventSignal() + public void Lower() { - StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false); + Interop.Window.Window_Lower(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; } - internal VoidSignal ContextLostSignal() + /// + /// Activates the window to the top of the window stack even it is iconified. + /// + /// 3 + public void Activate() { - VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false); + Interop.Window.Window_Activate(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; } - internal VoidSignal ContextRegainedSignal() + /// + /// Gets the default ( root ) layer. + /// + /// The root layer. + /// 3 + public Layer GetDefaultLayer() { - VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + return this.GetRootLayer(); } - internal VoidSignal SceneCreatedSignal() + /// + /// Add a child view to window. + /// + /// the child should be added to the window. + /// 3 + public void Add(View view) { - VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false); + Interop.Actor.Actor_Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer + view.InternalParent = this.GetRootLayer(); } - internal ResizedSignal ResizedSignal() + /// + /// Remove a child view from window. + /// + /// the child to be removed. + /// 3 + public void Remove(View view) { - ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + Interop.Actor.Actor_Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view)); + this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer + view.InternalParent = null; } - internal static Vector4 DEFAULT_BACKGROUND_COLOR + /// + /// Retrieves the layer at a specified depth. + /// + /// The layer's depth index. + /// The layer found at the given depth. + /// 3 + public Layer GetLayer(uint depth) { - get + if (depth < LayersChildren?.Count) { - global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get(); - Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Layer ret = LayersChildren?[Convert.ToInt32(depth)]; return ret; } - } - - internal static Vector4 DEBUG_BACKGROUND_COLOR - { - get + else { - global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get(); - Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + return null; } } - private static readonly Window instance = Application.Instance.GetWindow(); + /// + /// Destroy the window immediately. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Destroy() + { + this.Dispose(); + } /// - /// The stage instance property (read-only).
- /// Gets the current window.
+ /// Keep rendering for at least the given amount of time. ///
+ /// Time to keep rendering, 0 means render at least one more frame. /// 3 - public static Window Instance + public void KeepRendering(float durationSeconds) { - get - { - return instance; - } + Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// @@ -874,7 +1026,7 @@ namespace Tizen.NUI /// 3 public bool GrabKeyTopmost(int DaliKey) { - bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey); + bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -888,7 +1040,7 @@ namespace Tizen.NUI /// 3 public bool UngrabKeyTopmost(int DaliKey) { - bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey); + bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -906,7 +1058,7 @@ namespace Tizen.NUI /// 3 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode) { - bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode); + bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -920,643 +1072,633 @@ namespace Tizen.NUI /// 3 public bool UngrabKey(int DaliKey) { - bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey); + bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - internal System.IntPtr GetNativeWindowHandler() + /// + /// Sets the keyboard repeat information. + /// + /// The key repeat rate value in seconds. + /// The key repeat delay value in seconds. + /// True if setting the keyboard repeat succeeds. + /// 5 + public bool SetKeyboardRepeatInfo(float rate, float delay) { - System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr)); + bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// - /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing. + /// Gets the keyboard repeat information. /// - /// 3 - public enum WindowOrientation + /// The key repeat rate value in seconds. + /// The key repeat delay value in seconds. + /// True if setting the keyboard repeat succeeds. + /// 5 + public bool GetKeyboardRepeatInfo(out float rate, out float delay) { - /// - /// Portrait orientation. The height of the display area is greater than the width. - /// - /// 3 - Portrait = 0, - /// - /// Landscape orientation. A wide view area is needed. - /// - /// 3 - Landscape = 90, - /// - /// Portrait inverse orientation. - /// - /// 3 - PortraitInverse = 180, - /// - /// Landscape inverse orientation. - /// - /// 3 - LandscapeInverse = 270 + bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } /// - /// Enumeration for the key grab mode for platform-level APIs. + /// Adds a layer to the stage. /// + /// Layer to add. /// 3 - public enum KeyGrabMode + public void AddLayer(Layer layer) { - /// - /// Grabs a key only when on the top of the grabbing-window stack mode. - /// - Topmost = 0, - /// - /// Grabs a key together with the other client window(s) mode. - /// - Shared, - /// - /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack with the possibility of overriding the grab by the other client window mode. - /// - OverrideExclusive, - /// - /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode. - /// - Exclusive - }; + Interop.Window.Add(swigCPtr, Layer.getCPtr(layer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + LayersChildren?.Add(layer); + layer.SetWindow(this); + } /// - /// Enumeration for opacity of the indicator. + /// Removes a layer from the stage. /// - internal enum IndicatorBackgroundOpacity + /// Layer to remove. + /// 3 + public void RemoveLayer(Layer layer) { - Opaque = 100, - Translucent = 50, - Transparent = 0 + Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + LayersChildren?.Remove(layer); + layer.SetWindow(null); } /// - /// Enumeration for visible mode of the indicator. + /// Feeds a key event into the window. /// - internal enum IndicatorVisibleMode + /// The key event to feed. + /// 5 + public void FeedKey(Key keyEvent) { - Invisible = 0, - Visible = 1, - Auto = 2 + Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// - /// The touch event argument. + /// Allows at least one more render, even when paused. + /// The window should be shown, not minimised. /// - /// 3 - public class TouchEventArgs : EventArgs + /// 4 + public void RenderOnce() { - private Touch _touch; + Interop.Window.Window_RenderOnce(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - /// - /// Touch. - /// - /// 3 - public Touch Touch - { - get - { - return _touch; - } - set - { - _touch = value; - } - } + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - private event EventHandler _stageTouchHandler; - private EventCallbackDelegateType1 _stageTouchCallbackDelegate; + internal static Window GetCurrent() + { + Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - /// - /// This event is emitted when the screen is touched and when the touch ends.
- /// If there are multiple touch points, then this will be emitted when the first touch occurs and - /// then when the last finger is lifted.
- /// An interrupted event will also be emitted (if it occurs).
- ///
- /// 3 - public event EventHandler TouchEvent + internal static bool IsInstalled() { - add - { - lock (this) - { - _stageTouchHandler += value; - _stageTouchCallbackDelegate = OnStageTouch; - this.TouchSignal().Connect(_stageTouchCallbackDelegate); - } - } - remove - { - lock (this) - { - if (_stageTouchHandler != null) - { - this.TouchSignal().Disconnect(_stageTouchCallbackDelegate); - } - _stageTouchHandler -= value; - } - } + bool ret = Interop.Stage.Stage_IsInstalled(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - private void OnStageTouch(IntPtr data) + internal WindowFocusSignalType WindowFocusChangedSignal() { - TouchEventArgs e = new TouchEventArgs(); + WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - if (data != null) - { - e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data); - } + internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode) + { + Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - if (_stageTouchHandler != null) - { - _stageTouchHandler(this, e); - } + internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity) + { + Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// Wheel event arguments. - /// - /// 3 - public class WheelEventArgs : EventArgs + internal void RotateIndicator(Window.WindowOrientation orientation) { - private Wheel _wheel; + Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - /// - /// Wheel. - /// - /// 3 - public Wheel Wheel - { - get - { - return _wheel; - } - set - { - _wheel = value; - } - } + internal void AddAvailableOrientation(Window.WindowOrientation orientation) + { + Interop.WindowInternal.Window_AddAvailableOrientation(swigCPtr, (int)orientation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - private event EventHandler _stageWheelHandler; - private EventCallbackDelegateType1 _stageWheelCallbackDelegate; + internal void RemoveAvailableOrientation(Window.WindowOrientation orientation) + { + Interop.WindowInternal.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - /// - /// This event is emitted when the wheel event is received. - /// - /// 3 - public event EventHandler WheelEvent + internal void SetPreferredOrientation(Window.WindowOrientation orientation) { - add - { - if (_stageWheelHandler == null) - { - _stageWheelCallbackDelegate = OnStageWheel; - WheelEventSignal().Connect(_stageWheelCallbackDelegate); - } - _stageWheelHandler += value; - } - remove - { - _stageWheelHandler -= value; - if (_stageWheelHandler == null && WheelEventSignal().Empty() == false) - { - WheelEventSignal().Disconnect(_stageWheelCallbackDelegate); - } - } + Interop.WindowInternal.Window_SetPreferredOrientation(swigCPtr, (int)orientation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - private void OnStageWheel(IntPtr data) + internal Window.WindowOrientation GetPreferredOrientation() { - WheelEventArgs e = new WheelEventArgs(); + Window.WindowOrientation ret = (Window.WindowOrientation)Interop.WindowInternal.Window_GetPreferredOrientation(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - if (data != null) - { - e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data); - } + internal Any GetNativeHandle() + { + Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - if (_stageWheelHandler != null) - { - _stageWheelHandler(this, e); - } + internal WindowFocusSignalType FocusChangedSignal() + { + WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - /// - /// Key event arguments. - /// - /// 3 - public class KeyEventArgs : EventArgs + internal void Add(Layer layer) { - private Key _key; + Interop.Window.Add(swigCPtr, Layer.getCPtr(layer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - /// - /// Key. - /// - /// 3 - public Key Key - { - get - { - return _key; - } - set - { - _key = value; - } - } + LayersChildren?.Add(layer); + layer.SetWindow(this); } - private event EventHandler _stageKeyHandler; - private EventCallbackDelegateType1 _stageKeyCallbackDelegate; + internal void Remove(Layer layer) + { + Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + LayersChildren?.Remove(layer); + layer.SetWindow(null); + } + + internal Vector2 GetSize() + { + var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false); + Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight()); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal RenderTaskList GetRenderTaskList() + { + RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } /// - /// This event is emitted when the key event is received. + /// Queries the number of on-window layers. /// - /// 3 - public event EventHandler KeyEvent + /// The number of layers. + /// Note that a default layer is always provided (count >= 1). + internal uint GetLayerCount() { - add - { - if (_stageKeyHandler == null) - { - _stageKeyCallbackDelegate = OnStageKey; - KeyEventSignal().Connect(_stageKeyCallbackDelegate); - } - _stageKeyHandler += value; - } - remove + if (LayersChildren == null || LayersChildren.Count < 0) + return 0; + + return (uint) LayersChildren.Count; + } + + internal Layer GetRootLayer() + { + // Window.IsInstalled() is actually true only when called from event thread and + // Core has been initialized, not when Stage is ready. + if (_rootLayer == null && Window.IsInstalled()) { - _stageKeyHandler -= value; - if (_stageKeyHandler == null && KeyEventSignal().Empty() == false) - { - KeyEventSignal().Disconnect(_stageKeyCallbackDelegate); - } + _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + LayersChildren?.Add(_rootLayer); + _rootLayer.SetWindow(this); } + return _rootLayer; } - // Callback for Stage KeyEventsignal - private void OnStageKey(IntPtr data) + internal void SetBackgroundColor(Vector4 color) { - KeyEventArgs e = new KeyEventArgs(); + Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - if (data != null) - { - e.Key = Tizen.NUI.Key.GetKeyFromPtr(data); - } + internal Vector4 GetBackgroundColor() + { + Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - if (_stageKeyHandler != null) - { - //here we send all data to user event handlers - _stageKeyHandler(this, e); - } + internal Vector2 GetDpi() + { + Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + internal ObjectRegistry GetObjectRegistry() + { + ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - private event EventHandler _stageEventProcessingFinishedEventHandler; - private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate; + internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior) + { + Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - internal event EventHandler EventProcessingFinished + internal RenderingBehaviorType GetRenderingBehavior() { - add - { - if (_stageEventProcessingFinishedEventHandler == null) - { - _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished; - EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate); - } - _stageEventProcessingFinishedEventHandler += value; + RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - } - remove - { - _stageEventProcessingFinishedEventHandler -= value; - if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false) - { - EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate); - } - } + internal KeyEventSignal KeyEventSignal() + { + KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - // Callback for Stage EventProcessingFinishedSignal - private void OnEventProcessingFinished() + internal VoidSignal EventProcessingFinishedSignal() { - if (_stageEventProcessingFinishedEventHandler != null) - { - _stageEventProcessingFinishedEventHandler(this, null); - } + 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; + } - private EventHandler _stageContextLostEventHandler; - private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate; + internal VoidSignal ContextLostSignal() + { + VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - internal event EventHandler ContextLost + internal VoidSignal ContextRegainedSignal() { - add - { - if (_stageContextLostEventHandler == null) - { - _stageContextLostEventCallbackDelegate = OnContextLost; - ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate); - } - _stageContextLostEventHandler += value; - } - remove - { - _stageContextLostEventHandler -= value; - if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false) - { - ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate); - } - } + 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; } - // Callback for Stage ContextLostSignal - private void OnContextLost() + internal ResizedSignal ResizedSignal() { - if (_stageContextLostEventHandler != null) - { - _stageContextLostEventHandler(this, null); - } + 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.SetSize(swigCPtr, Uint16Pair.getCPtr(val)); - private EventHandler _stageContextRegainedEventHandler; - private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - 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); - } - } + // Resetting Window size should request a relayout of the tree. } - // Callback for Stage ContextRegainedSignal - private void OnContextRegained() + internal Size2D GetWindowSize() { - if (_stageContextRegainedEventHandler != null) - { - _stageContextRegainedEventHandler(this, null); - } + var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false); + Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } + internal void SetPosition(Position2D position) + { + var val = new Uint16Pair((uint)position.X, (uint)position.Y); + Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val)); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - private EventHandler _stageSceneCreatedEventHandler; - private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate; + // Setting Position of the window should request a relayout of the tree. - internal event EventHandler SceneCreated + } + + internal Position2D GetPosition() { - add - { - if (_stageSceneCreatedEventHandler == null) - { - _stageSceneCreatedEventCallbackDelegate = OnSceneCreated; - SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate); - } - _stageSceneCreatedEventHandler += value; - } - remove - { - _stageSceneCreatedEventHandler -= value; - if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false) - { - SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate); - } - } + var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true); + Position2D ret = new Position2D(val.GetX(), val.GetY()); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - // Callback for Stage SceneCreatedSignal - private void OnSceneCreated() + internal void SetPositionSize(Rectangle positionSize) { - if (_stageSceneCreatedEventHandler != null) - { - _stageSceneCreatedEventHandler(this, null); - } + Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize)); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + // Setting Position of the window should request a relayout of the tree. + } /// - /// This resized event arguments. + /// Sets whether the window is transparent or not. /// - /// 3 - public class ResizedEventArgs : EventArgs - { - Size2D _windowSize; + /// Whether the window is transparent or not. + /// 5 + 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. - /// - /// This window size. - /// - /// 4 - public Size2D WindowSize - { - get - { - return _windowSize; - } - set - { - _windowSize = value; - } - } } - private WindowResizedEventCallbackType _windowResizedEventCallback; - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void WindowResizedEventCallbackType(IntPtr windowSize); - private event EventHandler _windowResizedEventHandler; + /// + /// 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. + /// + /// The parent window. + /// 6 + /// 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 void SetParent(Window parent) { + Interop.Window.SetParent(swigCPtr, Window.getCPtr(parent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } /// - /// This event is emitted when the window resized. + /// Unsets parent window of the window. + /// After unsetting, the window is disconnected his parent window. /// - /// 3 - public event EventHandler Resized + /// 6 + /// 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 void Unparent() { + Interop.Window.Unparent(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets parent window of the window. + /// + /// The parent window of the window. + /// 6 + /// 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 Window GetParent() { + Window ret = new Window(Interop.Window.GetParent(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Dispose for Window + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void Dispose(DisposeTypes type) { - add + if (disposed) { - if (_windowResizedEventHandler == null) + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //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) { - _windowResizedEventCallback = OnResized; - ResizedSignal().Connect(_windowResizedEventCallback); + layer.Dispose(); } - - _windowResizedEventHandler += value; + _childLayers.Clear(); } - remove - { - _windowResizedEventHandler -= value; - if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null) + this.DisconnectNativeSignals(); + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) { - ResizedSignal().Disconnect(_windowResizedEventCallback); + swigCMemOwn = false; + Interop.Window.delete_Window(swigCPtr); } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } + + base.Dispose(type); } - private void OnResized(IntPtr windowSize) + internal System.IntPtr GetNativeWindowHandler() { - ResizedEventArgs e = new ResizedEventArgs(); - var val = new Uint16Pair(windowSize, false); - e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight()); - val.Dispose(); + System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } - if (_windowResizedEventHandler != null) + private void OnWindowFocusedChanged(bool focusGained) + { + FocusChangedEventArgs e = new FocusChangedEventArgs(); + + e.FocusGained = focusGained; + + if (_windowFocusChangedEventHandler != null) { - _windowResizedEventHandler(this, e); + _windowFocusChangedEventHandler(this, e); } } - internal void SetWindowSize(Size2D size) + private StageWheelSignal WheelEventSignal() { - var val = new Uint16Pair((uint)size.Width, (uint)size.Height); - NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val)); - + StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - internal Size2D GetWindowSize() + private WheelSignal StageWheelEventSignal() { - var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false); - Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); - - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - internal void SetPosition(Position2D position) + private bool OnWindowTouch(IntPtr view, IntPtr touchData) { - var val = new Uint16Pair((uint)position.X, (uint)position.Y); - NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val)); + if (touchData == global::System.IntPtr.Zero) + { + NUILog.Error("touchData should not be null!"); + return false; + } - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + TouchEventArgs e = new TouchEventArgs(); + + e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData); + + if (_rootLayerTouchDataEventHandler != null) + { + _rootLayerTouchDataEventHandler(this, e); + } + return false; } - internal Position2D GetPosition() + private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent) { - var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true); - Position2D ret = new Position2D(val.GetX(), val.GetY()); + if (wheelEvent == global::System.IntPtr.Zero) + { + NUILog.Error("wheelEvent should not be null!"); + return true; + } - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } + WheelEventArgs e = new WheelEventArgs(); - /// - /// Sets whether the window is transparent or not. - /// - /// Whether the window is transparent. - /// 5 - /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. - [EditorBrowsable(EditorBrowsableState.Never)] - public void SetTransparency(bool transparent) { - NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent); + + if (_stageWheelHandler != null) + { + _stageWheelHandler(this, e); + } + return true; } - /// - /// The window size property (read-only). - /// - /// 3 - public Size2D Size + // Callback for Stage KeyEventsignal + private void OnStageKey(IntPtr data) { - get + KeyEventArgs e = new KeyEventArgs(); + e.Key = Tizen.NUI.Key.GetKeyFromPtr(data); + + + if (_stageKeyHandler != null) { - Size2D ret = GetSize(); - return ret; + //here we send all data to user event handlers + _stageKeyHandler(this, e); } } - /// - /// The background color property. - /// - /// 3 - public Color BackgroundColor + // Callback for Stage EventProcessingFinishedSignal + private void OnEventProcessingFinished() { - set + if (_stageEventProcessingFinishedEventHandler != null) { - SetBackgroundColor(value); + _stageEventProcessingFinishedEventHandler(this, null); } - get + } + + // Callback for Stage ContextLostSignal + private void OnContextLost() + { + if (_stageContextLostEventHandler != null) { - Color ret = GetBackgroundColor(); - return ret; + _stageContextLostEventHandler(this, null); } } - /// - /// The DPI property (read-only).
- /// Retrieves the DPI of the display device to which the Window is connected.
- ///
- /// 3 - public Vector2 Dpi + // Callback for Stage ContextRegainedSignal + private void OnContextRegained() { - get + if (_stageContextRegainedEventHandler != null) { - return GetDpi(); + _stageContextRegainedEventHandler(this, null); } } - /// - /// The layer count property (read-only).
- /// Queries the number of on-Window layers.
- ///
- /// 3 - public uint LayerCount + // Callback for Stage SceneCreatedSignal + private void OnSceneCreated() { - get + if (_stageSceneCreatedEventHandler != null) { - return GetLayerCount(); + _stageSceneCreatedEventHandler(this, null); } } - - /// - /// Adds a layer to the stage. - /// - /// Layer to add. - /// 3 - public void AddLayer(Layer layer) + private void OnResized(IntPtr windowSize) { - NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + 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); + } } - /// - /// Removes a layer from the stage. - /// - /// Layer to remove. - /// 3 - public void RemoveLayer(Layer layer) + private void OnWindowFocusedChanged2(bool focusGained) { - NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + FocusChangedEventArgs e = new FocusChangedEventArgs(); + + e.FocusGained = focusGained; + + if (_windowFocusChangedEventHandler2 != null) + { + _windowFocusChangedEventHandler2(this, e); + } } /// - /// Please do not use! this will be deprecated + /// The focus changed event argument. /// /// 3 - [EditorBrowsable(EditorBrowsableState.Never)] - public class WindowFocusChangedEventArgs : EventArgs + public class FocusChangedEventArgs : EventArgs { /// - /// Please do not use! this will be deprecated + /// FocusGained flag. /// /// 3 public bool FocusGained @@ -1566,105 +1708,147 @@ namespace Tizen.NUI } } - private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2; - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void WindowFocusChangedEventCallbackType2(bool focusGained); - private event EventHandler _windowFocusChangedEventHandler2; - /// - /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead. + /// The touch event argument. /// /// 3 - /// Please do not use! this will be deprecated! - /// Instead please use FocusChanged. - [Obsolete("Please do not use! this will be deprecated, instead please use FocusChanged")] - [EditorBrowsable(EditorBrowsableState.Never)] - public event EventHandler WindowFocusChanged + public class TouchEventArgs : EventArgs { - add + private Touch _touch; + + /// + /// Touch. + /// + /// 3 + public Touch Touch { - if (_windowFocusChangedEventHandler2 == null) + get { - _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2; - WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2); + return _touch; } - - _windowFocusChangedEventHandler2 += value; - } - remove - { - _windowFocusChangedEventHandler2 -= value; - - if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null) + set { - WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2); + _touch = value; } } } - private void OnWindowFocusedChanged2(bool focusGained) + /// + /// Wheel event arguments. + /// + /// 3 + public class WheelEventArgs : EventArgs { - WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs(); - - e.FocusGained = focusGained; + private Wheel _wheel; - if (_windowFocusChangedEventHandler2 != null) + /// + /// Wheel. + /// + /// 3 + public Wheel Wheel { - _windowFocusChangedEventHandler2(this, e); + get + { + return _wheel; + } + set + { + _wheel = value; + } } } /// - /// Gets or sets a size of the window. + /// Key event arguments. /// - /// 4 - public Size2D WindowSize + /// 3 + public class KeyEventArgs : EventArgs { - get - { - return GetWindowSize(); - } - set + private Key _key; + + /// + /// Key. + /// + /// 3 + public Key Key { - SetWindowSize(value); + get + { + return _key; + } + set + { + _key = value; + } } } /// - /// Gets or sets a position of the window. + /// Sets position and size of the window. This API guarantees that + /// both moving and resizing of window will appear on the screen at once. /// - /// 4 - public Position2D WindowPosition + [EditorBrowsable(EditorBrowsableState.Never)] + public Rectangle WindowPositionSize { get { - return GetPosition(); + Position2D position = GetPosition(); + Size2D size = GetSize(); + Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height); + return ret; } set { - SetPosition(value); + SetPositionSize(value); } } /// - /// Feed a key-event into the window. + /// Feeds a key event into the window. + /// This resized event arguments. /// - /// 4 - public static void FeedKeyEvent(Key keyEvent) + /// 3 + public class ResizedEventArgs : EventArgs { - NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Size2D _windowSize; + + /// + /// This window size. + /// + /// 4 + public Size2D WindowSize + { + get + { + return _windowSize; + } + set + { + _windowSize = value; + } + } } /// - /// Allows at least one more render, even when paused. - /// The window should be shown, not minimised. + /// Please do not use! this will be deprecated /// - /// 4 - public void RenderOnce() + /// 3 + [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 { - NDalicManualPINVOKE.Window_RenderOnce(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + /// + /// Please do not use! this will be deprecated + /// + /// 3 + public bool FocusGained + { + get; + set; + } } /// @@ -1703,5 +1887,63 @@ namespace Tizen.NUI } } + /// + /// Disconnect all native signals + /// + /// 5 + 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); + } + + } + } }