X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FWindow%2FWindow.cs;h=2cd83072bc0093ec0d6fd1ef76d138466d6f0e57;hb=111e585788abf529d768e6de92220d35eb7c0ada;hp=a975583e413ee23df30d3abf543526b035bf172e;hpb=673e8088fe4154f86491716548632608c860d4f2;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/Window/Window.cs b/src/Tizen.NUI/src/public/Window/Window.cs old mode 100644 new mode 100755 index a975583..2cd8307 --- a/src/Tizen.NUI/src/public/Window/Window.cs +++ b/src/Tizen.NUI/src/public/Window/Window.cs @@ -36,14 +36,26 @@ namespace Tizen.NUI { private HandleRef stageCPtr; private Layer rootLayer; + private Layer overlayLayer; + private Layer borderLayer; private string windowTitle; private List childLayers = new List(); private LayoutController localController; + private Key internalLastKeyEvent; + private Touch internalLastTouchEvent; + private Timer internalHoverTimer; static internal bool IsSupportedMultiWindow() { bool isSupported = false; - Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported); + try + { + Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported); + } + catch (DllNotFoundException e) + { + Tizen.Log.Fatal("NUI", $"{e}\n"); + } return isSupported; } @@ -66,13 +78,14 @@ namespace Tizen.NUI [EditorBrowsable(EditorBrowsableState.Never)] static public Window Get(View view) { - if(view == null) + if (view == null) { NUILog.Error("if there is no view, it can not get a window"); return null; } - Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.Get(View.getCPtr(view))) as Window; + //to fix memory leak issue, match the handle count with native side. + Window ret = view.GetInstanceSafely(Interop.Window.Get(View.getCPtr(view))); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -118,6 +131,30 @@ namespace Tizen.NUI } /// + /// Creates a new Window with a specific name.
+ /// This creates an extra window in addition to the default main window
+ ///
+ /// The name for extra window. + /// If borderInterface is null, defaultBorder is enabled. + /// The position and size of the Window. + /// Whether Window is translucent. + /// A new Window. + /// http://tizen.org/feature/opengles.surfaceless_context + /// The required feature is not supported. + [EditorBrowsable(EditorBrowsableState.Never)] + public Window(string name, IBorderInterface borderInterface, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true) + { + if (IsSupportedMultiWindow() == false) + { + NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. "); + } + this.windowTitle = name; + this.EnableBorder(borderInterface); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + /// /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing. /// /// 3 @@ -179,26 +216,28 @@ namespace Tizen.NUI /// /// Enumeration for transition effect's state. /// - [Obsolete("Please do not use! This will be removed. Please use Window.EffectState instead!")] + [Obsolete("Do not use this, that will be removed. Use Window.EffectState instead.")] [EditorBrowsable(EditorBrowsableState.Never)] + // This is already deprecated, so suppress warning here. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "")] public enum EffectStates { /// /// None state. /// - [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.None instead!")] + [Obsolete("Do not use this, that will be removed. Use Window.EffectState.None instead.")] [EditorBrowsable(EditorBrowsableState.Never)] None = 0, /// /// Transition effect is started. /// - [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.Start instead!")] + [Obsolete("Do not use this, that will be removed. Use Window.EffectState.Start instead.")] [EditorBrowsable(EditorBrowsableState.Never)] Start, /// /// Transition effect is ended. /// - [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.End instead!")] + [Obsolete("Do not use this, that will be removed. Use Window.EffectState.End instead.")] [EditorBrowsable(EditorBrowsableState.Never)] End, } @@ -229,26 +268,28 @@ namespace Tizen.NUI /// /// Enumeration for transition effect's type. /// - [Obsolete("Please do not use! This will be removed. Please use Window.EffectType instead!")] + [Obsolete("Do not use this, that will be removed. Use Window.EffectType instead.")] [EditorBrowsable(EditorBrowsableState.Never)] + // This is already deprecated, so suppress warning here. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "")] public enum EffectTypes { /// /// None type. /// - [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.None instead!")] + [Obsolete("Do not use this, that will be removed. Use Window.EffectType.None instead.")] [EditorBrowsable(EditorBrowsableState.Never)] None = 0, /// /// Window show effect. /// - [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.Show instead!")] + [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Show instead.")] [EditorBrowsable(EditorBrowsableState.Never)] Show, /// /// Window hide effect. /// - [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.Hide instead!")] + [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Hide instead.")] [EditorBrowsable(EditorBrowsableState.Never)] Hide, } @@ -306,6 +347,11 @@ namespace Tizen.NUI public enum ResizeDirection { /// + /// None type. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + None = 0, + /// /// Start resizing window to the top-left edge. /// [EditorBrowsable(EditorBrowsableState.Never)] @@ -510,7 +556,7 @@ namespace Tizen.NUI { Position2D position = GetPosition(); Size2D size = GetSize(); - Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height); + Rectangle ret = new Rectangle(position?.X ?? 0, position?.Y ?? 0, size?.Width ?? 0, size?.Height ?? 0); position.Dispose(); return ret; } @@ -520,6 +566,24 @@ namespace Tizen.NUI } } + /// + /// Gets or sets whether the window will update partial area or full area. + /// If this value is true, window will update and render partial area. + /// If false, full area updated. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool PartialUpdate + { + get + { + return IsPartialUpdate(); + } + set + { + SetPartialUpdate(value); + } + } + internal static Vector4 DEFAULT_BACKGROUND_COLOR { get @@ -566,7 +630,7 @@ namespace Tizen.NUI /// /// The key event to feed. /// 4 - [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")] + [Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")] public static void FeedKeyEvent(Key keyEvent) { Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent)); @@ -728,7 +792,7 @@ namespace Tizen.NUI /// 3 public void SetInputRegion(Rectangle inputRegion) { - Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion)); + Interop.Window.SetInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -889,19 +953,32 @@ namespace Tizen.NUI } /// + /// Gets the overlay layer. + /// + /// The overlay layer. + [EditorBrowsable(EditorBrowsableState.Never)] + public Layer GetOverlayLayer() + { + // Window.IsInstalled() is actually true only when called from event thread and + // Core has been initialized, not when Stage is ready. + if (overlayLayer == null && Window.IsInstalled()) + { + overlayLayer = new Layer(Interop.Window.GetOverlayLayer(SwigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + LayersChildren?.Add(overlayLayer); + overlayLayer.SetWindow(this); + } + return overlayLayer; + } + + /// /// Add a child view to window. /// /// the child should be added to the window. /// 3 public void Add(View view) { - Interop.Actor.Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer - if (null != view) - { - view.InternalParent = this.GetRootLayer(); - } + this.GetRootLayer().Add(view); } /// @@ -911,12 +988,7 @@ namespace Tizen.NUI /// 3 public void Remove(View view) { - Interop.Actor.Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view)); - this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer - if (null != view) - { - view.InternalParent = null; - } + this.GetRootLayer().Remove(view); } /// @@ -954,7 +1026,7 @@ namespace Tizen.NUI /// 3 public void KeepRendering(float durationSeconds) { - Interop.Stage.KeepRendering(stageCPtr, durationSeconds); + Interop.Window.KeepRendering(SwigCPtr, durationSeconds); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -1048,6 +1120,62 @@ namespace Tizen.NUI } /// + /// Sets the keyboard repeat information of horizontal way. + /// + /// The key repeat rate value in seconds. + /// The key repeat delay value in seconds. + /// True if setting the keyboard repeat succeeds. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool SetKeyboardHorizentalRepeatInfo(float rate, float delay) + { + bool ret = Interop.Window.SetKeyboardHorizentalRepeatInfo(rate, delay); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the keyboard repeat information of horizontal way. + /// + /// The key repeat rate value in seconds. + /// The key repeat delay value in seconds. + /// True if setting the keyboard repeat succeeds. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool GetKeyboardHorizentalRepeatInfo(out float rate, out float delay) + { + bool ret = Interop.Window.GetKeyboardHorizentalRepeatInfo(out rate, out delay); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the keyboard repeat information of vertical way. + /// + /// The key repeat rate value in seconds. + /// The key repeat delay value in seconds. + /// True if setting the keyboard repeat succeeds. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool SetKeyboardVerticalRepeatInfo(float rate, float delay) + { + bool ret = Interop.Window.SetKeyboardVerticalRepeatInfo(rate, delay); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the keyboard repeat information of vertical way. + /// + /// The key repeat rate value in seconds. + /// The key repeat delay value in seconds. + /// True if setting the keyboard repeat succeeds. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool GetKeyboardVerticalRepeatInfo(out float rate, out float delay) + { + bool ret = Interop.Window.GetKeyboardVerticalRepeatInfo(out rate, out delay); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// /// Adds a layer to the stage. /// /// Layer to add. @@ -1076,7 +1204,79 @@ namespace Tizen.NUI /// 5 public void FeedKey(Key keyEvent) { - Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent)); + Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Feeds a hover event into the window.
+ /// This is feed after a default time of 48 ms. You can also set this time. + ///
+ /// The time of how much later it will be feed (default is 48ms) + /// If you want to do FeedHover after the UI is updated, it is recommended to set the time to at least 16ms. This will be a good time waiting for the UI to update.
+ /// and LazyFeedHover called within the set time are ignored. Only the last request becomes a FeedHover. + ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public void LazyFeedHover(uint time = 48) + { + if (internalHoverTimer == null) + { + internalHoverTimer = new Timer(time); + internalHoverTimer.Tick += (s, e) => + { + FeedHover(); + internalHoverTimer?.Stop(); + internalHoverTimer?.Dispose(); + internalHoverTimer = null; + return false; + }; + internalHoverTimer.Start(); + } + else + { + internalHoverTimer.Start(); + } + } + + /// + /// Feeds a touch point into the window. + /// + /// The touch point to feed. + /// The timeStamp. + internal void FeedTouch(TouchPoint touchPoint, int timeStamp) + { + Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Feeds a wheel event into the window. + /// + /// The wheel event to feed. + internal void FeedWheel(Wheel wheelEvent) + { + Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Feeds a hover event into the window. + /// + /// The touch point to feed hover event. If null is entered, the feed hover event is generated with the last inputed touch point. + [EditorBrowsable(EditorBrowsableState.Never)] + internal void FeedHover(TouchPoint touchPoint = null) + { + if (touchPoint == null) + { + using Touch touch = GetLastTouchEvent(); + if (touch == null || touch.GetPointCount() < 1) + { + return; + } + using Vector2 screenPosition = touch.GetScreenPosition(0); + touchPoint = new TouchPoint(touch.GetDeviceId(0), TouchPoint.StateType.Motion, screenPosition.X, screenPosition.Y); + } + Interop.Window.FeedHoverEvent(SwigCPtr, TouchPoint.getCPtr(touchPoint)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -1175,7 +1375,7 @@ namespace Tizen.NUI { NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. "); } - Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.GetParent(SwigCPtr)) as Window; + Window ret = this.GetInstanceSafely(Interop.Window.GetParent(SwigCPtr)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1191,11 +1391,6 @@ namespace Tizen.NUI } } - 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; - } - internal static bool IsInstalled() { bool ret = Interop.Stage.IsInstalled(); @@ -1313,8 +1508,17 @@ namespace Tizen.NUI { throw new ArgumentNullException(nameof(layer)); } - Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer)); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + if (isBorderWindow) + { + Interop.Actor.Add(GetRootLayer().SwigCPtr, layer.SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + } + else + { + Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } LayersChildren?.Add(layer); layer.SetWindow(this); @@ -1336,8 +1540,12 @@ namespace Tizen.NUI internal Vector2 GetSize() { var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true); + + convertRealWindowSizeToBorderWindowSize(val); + Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight()); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + val.Dispose(); return ret; } @@ -1365,16 +1573,29 @@ namespace Tizen.NUI 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()) + if (isBorderWindow) { - rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - LayersChildren?.Add(rootLayer); - rootLayer.SetWindow(this); + if (borderLayer == null) + { + borderLayer = GetBorderWindowRootLayer(); + LayersChildren?.Add(borderLayer); + borderLayer.SetWindow(this); + } + return borderLayer; + } + else + { + // 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(Interop.Window.GetRootLayer(SwigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + LayersChildren?.Add(rootLayer); + rootLayer.SetWindow(this); + } + return rootLayer; } - return rootLayer; } internal void SetBackgroundColor(Vector4 color) @@ -1425,6 +1646,9 @@ namespace Tizen.NUI throw new ArgumentNullException(nameof(size)); } var val = new Uint16Pair((uint)size.Width, (uint)size.Height); + + convertBorderWindowSizeToRealWindowSize(val); + Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val)); val.Dispose(); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -1434,8 +1658,12 @@ namespace Tizen.NUI internal Size2D GetWindowSize() { var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true); + + convertRealWindowSizeToBorderWindowSize(val); + Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + val.Dispose(); return ret; } @@ -1445,8 +1673,8 @@ namespace Tizen.NUI { throw new ArgumentNullException(nameof(position)); } - var val = new Uint16Pair((uint)position.X, (uint)position.Y); - Interop.Window.SetPosition(SwigCPtr, Uint16Pair.getCPtr(val)); + var val = new Int32Pair(position.X, position.Y); + Interop.Window.SetPosition(SwigCPtr, Int32Pair.getCPtr(val)); val.Dispose(); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); // Setting Position of the window should request a relayout of the tree. @@ -1454,8 +1682,8 @@ namespace Tizen.NUI internal Position2D GetPosition() { - var val = new Uint16Pair(Interop.Window.GetPosition(SwigCPtr), true); - Position2D ret = new Position2D(val.GetX(), val.GetY()); + var val = new Int32Pair(Interop.Window.GetPosition(SwigCPtr), true); + Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY()); val.Dispose(); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -1463,7 +1691,19 @@ namespace Tizen.NUI internal void SetPositionSize(Rectangle positionSize) { + if (positionSize == null) + { + throw new ArgumentNullException(nameof(positionSize)); + } + var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height); + + convertBorderWindowSizeToRealWindowSize(val); + + positionSize.Width = val.GetX(); + positionSize.Height = val.GetY(); + Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize)); + val.Dispose(); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -1471,6 +1711,27 @@ namespace Tizen.NUI } /// + /// Set the window use partial update or not. + /// + /// If window enable partial update or disable. + internal void SetPartialUpdate(bool enabled) + { + Interop.Window.SetPartialUpdateEnabled(SwigCPtr, enabled); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Returns whether the window is enabled partial update or not. + /// + /// True if the window is enabled partial update, false otherwise. + internal bool IsPartialUpdate() + { + bool ret = Interop.Window.IsPartialUpdateEnabled(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// /// Enables the floating mode of window. /// The floating mode is to support window is moved or resized by display server. /// For example, if the video-player window sets the floating mode, @@ -1487,6 +1748,18 @@ namespace Tizen.NUI } /// + /// Returns whether the window is floating mode or not. + /// + /// True if the window is enabled floating mode, false otherwise. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsFloatingModeEnabled() + { + bool ret = Interop.Window.IsFloatingModeEnabled(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// /// Requests to display server for the window is moved by display server. /// It can be work with setting window floating mode. /// @@ -1544,6 +1817,317 @@ namespace Tizen.NUI } /// + /// Sets the pointer constraints lock. + /// + /// True if PointerConstraintsLock succeeds. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool PointerConstraintsLock() + { + bool ret = Interop.Window.PointerConstraintsLock(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the pointer constraints unlock. + /// + /// True if PointerConstraintsUnlock succeeds. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool PointerConstraintsUnlock() + { + bool ret = Interop.Window.PointerConstraintsUnlock(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the locked pointer region. + /// + /// The x position. + /// The y position. + /// The width. + /// The height. + [EditorBrowsable(EditorBrowsableState.Never)] + public void LockedPointerRegionSet(int x, int y, int width, int height) + { + Interop.Window.LockedPointerRegionSet(SwigCPtr, x, y, width, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets the locked pointer cursor position hintset + /// + /// The x position. + /// The y position. + [EditorBrowsable(EditorBrowsableState.Never)] + public void LockedPointerCursorPositionHintSet(int x, int y) + { + Interop.Window.LockedPointerCursorPositionHintSet(SwigCPtr, x, y); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets the pointer warp. The pointer moves to the set coordinates. + /// + /// The x position. + /// The y position. + /// True if PointerWarp succeeds. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool PointerWarp(int x, int y) + { + bool ret = Interop.Window.PointerWarp(SwigCPtr, x, y); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Maximizes window's size. + /// If this function is called with true, window will be resized with screen size. + /// Otherwise window will be resized with previous size. + /// It is for the window's MAX button in window's border. + /// If window border is supported by display server, it is not necessary. + /// + /// If window is maximized or unmaximized. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Maximize(bool max) + { + Interop.Window.Maximize(SwigCPtr, max); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Returns whether the window is maximized or not. + /// + /// True if the window is maximized, false otherwise. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsMaximized() + { + bool ret = Interop.Window.IsMaximized(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets window's maximum size. + /// + /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer(). + /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize(). + /// + /// After setting, if Maximize() is called, window is resized with the setting size and move the center. + /// + /// + /// the maximum size. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetMaximumSize(Size2D size) + { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } + var val = new Uint16Pair((uint)size.Width, (uint)size.Height); + + Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val)); + val.Dispose(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Minimizes window's size. + /// If this function is called with true, window will be iconified. + /// Otherwise window will be activated. + /// It is for the window's MIN button in window border. + /// If window border is supported by display server, it is not necessary. + /// + /// If window is minimized or unminimized. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Minimize(bool min) + { + Interop.Window.Minimize(SwigCPtr, min); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Returns whether the window is minimized or not. + /// + /// True if the window is minimized, false otherwise. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsMinimized() + { + bool ret = Interop.Window.IsMinimized(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets window's minimum size. + /// It is to set the minimum size when window's size is decreased by RequestResizeToServer(). + /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize(). + /// + /// the minimum size. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetMimimumSize(Size2D size) + { + if (null == size) + { + throw new ArgumentNullException(nameof(size)); + } + var val = new Uint16Pair((uint)size.Width, (uint)size.Height); + + Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val)); + val.Dispose(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets the layout of the window. + /// + /// The number of columns in the layout. + /// The number of rows in the layout. + /// The column number of the window within the layout. + /// The row number of the window within the layout. + /// The number of columns the window should span within the layout. + /// The number of rows the window should span within the layout. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetLayout(uint numCols, uint numRows, uint column, uint row, uint colSpan, uint rowSpan) + { + Interop.Window.SetLayout(SwigCPtr, numCols, numRows, column, row, colSpan, rowSpan); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + /// + /// Sets the layout of the window. + /// + /// The type of layout to set for the window. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetLayout(WindowLayoutType layoutType) + { + switch (layoutType) + { + case WindowLayoutType.LeftHalf: + Interop.Window.SetLayout(SwigCPtr, 2, 1, 0, 0, 1, 1); + break; + case WindowLayoutType.RightHalf: + Interop.Window.SetLayout(SwigCPtr, 2, 1, 1, 0, 1, 1); + break; + + case WindowLayoutType.TopHalf: + Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 0, 1, 1); + break; + case WindowLayoutType.BottomHalf: + Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 1, 1, 1); + break; + + case WindowLayoutType.UpperLeftQuarter: + Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 0, 1, 1); + break; + case WindowLayoutType.UpperRightQuarter: + Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 0, 1, 1); + break; + case WindowLayoutType.LowerLeftQuarter: + Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 1, 1, 1); + break; + case WindowLayoutType.LowerRightQuarter: + Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 1, 1, 1); + break; + + case WindowLayoutType.LeftThird: + Interop.Window.SetLayout(SwigCPtr, 3, 1, 0, 0, 1, 1); + break; + case WindowLayoutType.CenterThird: + Interop.Window.SetLayout(SwigCPtr, 3, 1, 1, 0, 1, 1); + break; + case WindowLayoutType.RightThird: + Interop.Window.SetLayout(SwigCPtr, 3, 1, 2, 0, 1, 1); + break; + + case WindowLayoutType.TopThird: + Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 0, 1, 1); + break; + case WindowLayoutType.MiddleThird: + Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 1, 1, 1); + break; + case WindowLayoutType.BottomThird: + Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 2, 1, 1); + break; + } + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + /// + /// Query whether window is rotating or not. + /// + /// True if window is rotating, false otherwise. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsWindowRotating() + { + bool ret = Interop.Window.IsWindowRotating(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the last key event the window gets. + /// + /// The last key event the window gets. + [EditorBrowsable(EditorBrowsableState.Never)] + public Key GetLastKeyEvent() + { + if(internalLastKeyEvent == null) + { + internalLastKeyEvent = new Key(); + } + Interop.Window.InternalRetrievingLastKeyEvent(SwigCPtr, internalLastKeyEvent.SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return internalLastKeyEvent; + } + + /// + /// Gets the last touch event the window gets. + /// + /// The last touch event the window gets. + [EditorBrowsable(EditorBrowsableState.Never)] + public Touch GetLastTouchEvent() + { + if(internalLastTouchEvent == null) + { + internalLastTouchEvent = new Touch(); + } + Interop.Window.InternalRetrievingLastTouchEvent(SwigCPtr, internalLastTouchEvent.SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return internalLastTouchEvent; + } + + /// + /// Sets the necessary for window rotation Acknowledgement. + /// After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation. + /// + /// This function is supprot that application has the window rotation acknowledgement's control. + /// It means display server waits when application's rotation work is finished. + /// It is useful application has the other rendering engine which works asynchronous. + /// For instance, GlView. + /// + /// the flag is true if window rotation acknowledge is sent. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement) + { + Interop.Window.SetNeedsRotationCompletedAcknowledgement(SwigCPtr, needAcknowledgement); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// send the Acknowledgement to complete window rotation. + /// For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void SendRotationCompletedAcknowledgement() + { + Interop.Window.SendRotationCompletedAcknowledgement(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// /// Add FrameUpdateCallback /// [EditorBrowsable(EditorBrowsableState.Never)] @@ -1572,19 +2156,19 @@ namespace Tizen.NUI return; } + this.DisconnectNativeSignals(); + if (type == DisposeTypes.Explicit) { //Called by User //Release your own managed resources here. //You should release all of your own disposable objects here. - if (rootLayer != null) + if (IsBorderEnabled) { - rootLayer.Dispose(); + DisposeBorder(); } - localController?.Dispose(); - foreach (var layer in childLayers) { if (layer != null) @@ -1594,9 +2178,19 @@ namespace Tizen.NUI } childLayers.Clear(); + + localController?.Dispose(); + + internalLastKeyEvent?.Dispose(); + internalLastKeyEvent = null; + internalLastTouchEvent?.Dispose(); + internalLastTouchEvent = null; + + internalHoverTimer?.Stop(); + internalHoverTimer?.Dispose(); + internalHoverTimer = null; } - this.DisconnectNativeSignals(); base.Dispose(type); } @@ -1732,5 +2326,28 @@ namespace Tizen.NUI return ret; } + /// + /// Get Native Window handle. + /// + /// How to get Native Window handle + /// + /// Window window = NUIApplication.GetDefaultWindow(); + /// var handle = window.NativeHandle; + /// if(handle.IsInvalid == false) + /// { + /// IntPtr nativeHandle = handle.DangerousGetHandle(); + /// // do something with nativeHandle + /// } + /// + /// + /// + /// 9 + public SafeHandle NativeHandle + { + get + { + return new NUI.SafeNativeWindowHandle(this); + } + } } }