X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FWindow.cs;h=7da98b043f99abcf5caaf0508131762113e0c905;hb=ff607138dfabd4cfa5ab3ffe1af249f807b70cae;hp=542d513b6660188fc2bfba8a67e6509d9cd64cf0;hpb=5fcb6d48c76e2dccb31082f83be3028bdabd24e8;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index 542d513..7da98b0 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -1,5 +1,7 @@ + + /* - * Copyright(c) 2018 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. @@ -31,11 +33,8 @@ namespace Tizen.NUI { private global::System.Runtime.InteropServices.HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef stageCPtr; - private readonly global::System.Runtime.InteropServices.HandleRef rootLayoutCPtr; private Layer _rootLayer; private string _windowTitle; - private readonly LayoutItem rootLayoutItem; - private List _childLayers = new List(); private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback; private RootLayerTouchDataCallbackType _rootLayerTouchDataCallback; @@ -53,46 +52,30 @@ namespace Tizen.NUI 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()) - { - stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent()); - // Create a root layout (AbsoluteLayout) that is invisible to the user but enables layouts added to the Window - // Enables layouts added to the Window to have a parent layout. As parent layout is needed to store measure spec properties. - // Currently without these measure specs the new layout added will always be the size of the window. - global::System.IntPtr rootLayoutIntPtr = NDalicManualPINVOKE.Window_NewRootLayout(); - // Store HandleRef used by Add() - rootLayoutCPtr = new global::System.Runtime.InteropServices.HandleRef(this, rootLayoutIntPtr); - Layer rootLayer = GetRootLayer(); - // Add the root layout created above to the root layer. - NDalicPINVOKE.Actor_Add( Layer.getCPtr(rootLayer), rootLayoutCPtr ); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - global::System.IntPtr rootControlLayoutIntPtr = Tizen.NUI.NDalicManualPINVOKE.GetLayout__SWIG_1(rootLayoutCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (Interop.Stage.Stage_IsInstalled()) + { + stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.Stage_GetCurrent()); - rootLayoutItem = new LayoutItem(rootControlLayoutIntPtr, true); + localController = new LayoutController(this); + NUILog.Debug("layoutController id:" + localController.GetId() ); } } - internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true) - { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true) - { - 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) - { - 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) + /// + /// 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) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -274,6 +257,19 @@ namespace Tizen.NUI } } + /// + /// ViewAdded will be triggered when the view added on 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 event EventHandler ViewAdded; + + internal void SendViewAdded(View view) + { + ViewAdded?.Invoke(view, EventArgs.Empty); + } + internal event EventHandler EventProcessingFinished { add @@ -460,13 +456,13 @@ 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(); } } @@ -595,7 +591,7 @@ namespace Tizen.NUI { get { - global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get(); + 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; @@ -606,7 +602,7 @@ namespace Tizen.NUI { get { - global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get(); + 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; @@ -621,6 +617,14 @@ namespace Tizen.NUI } } + internal LayoutController LayoutController + { + get + { + return localController; + } + } + /// /// Feed a key-event into the window. /// @@ -629,7 +633,7 @@ namespace Tizen.NUI [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")] public static void FeedKeyEvent(Key keyEvent) { - NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent)); + Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -640,7 +644,7 @@ namespace Tizen.NUI /// 3 public void SetAcceptFocus(bool accept) { - NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept); + Interop.Window.SetAcceptFocus(swigCPtr, accept); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -651,7 +655,7 @@ namespace Tizen.NUI /// 3 public bool IsFocusAcceptable() { - bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr); + bool ret = Interop.Window.IsFocusAcceptable(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -663,7 +667,7 @@ namespace Tizen.NUI /// 3 public void Show() { - NDalicPINVOKE.Show(swigCPtr); + Interop.Window.Show(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -673,7 +677,7 @@ namespace Tizen.NUI /// 3 public void Hide() { - NDalicPINVOKE.Hide(swigCPtr); + Interop.Window.Hide(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -684,7 +688,7 @@ namespace Tizen.NUI /// 3 public bool IsVisible() { - bool temp = NDalicPINVOKE.IsVisible(swigCPtr); + bool temp = Interop.Window.IsVisible(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return temp; } @@ -696,7 +700,7 @@ namespace Tizen.NUI /// 3 public uint GetSupportedAuxiliaryHintCount() { - uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr); + uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -709,7 +713,7 @@ namespace Tizen.NUI /// 3 public string GetSupportedAuxiliaryHint(uint index) { - string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index); + string ret = Interop.Window.GetSupportedAuxiliaryHint(swigCPtr, index); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -723,7 +727,7 @@ namespace Tizen.NUI /// 3 public uint AddAuxiliaryHint(string hint, string value) { - uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value); + uint ret = Interop.Window.AddAuxiliaryHint(swigCPtr, hint, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -736,7 +740,7 @@ namespace Tizen.NUI /// 3 public bool RemoveAuxiliaryHint(uint id) { - bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id); + bool ret = Interop.Window.RemoveAuxiliaryHint(swigCPtr, id); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -750,7 +754,7 @@ namespace Tizen.NUI /// 3 public bool SetAuxiliaryHintValue(uint id, string value) { - bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value); + bool ret = Interop.Window.SetAuxiliaryHintValue(swigCPtr, id, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -763,7 +767,7 @@ namespace Tizen.NUI /// 3 public string GetAuxiliaryHintValue(uint id) { - string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id); + string ret = Interop.Window.GetAuxiliaryHintValue(swigCPtr, id); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -776,7 +780,7 @@ namespace Tizen.NUI /// 3 public uint GetAuxiliaryHintId(string hint) { - uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint); + uint ret = Interop.Window.GetAuxiliaryHintId(swigCPtr, hint); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -788,7 +792,7 @@ namespace Tizen.NUI /// 3 public void SetInputRegion(Rectangle inputRegion) { - NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion)); + Interop.Window.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -800,7 +804,7 @@ namespace Tizen.NUI /// 3 public bool SetNotificationLevel(NotificationLevel level) { - bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level); + bool ret = Interop.Window.SetNotificationLevel(swigCPtr, (int)level); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -812,7 +816,7 @@ namespace Tizen.NUI /// 3 public NotificationLevel GetNotificationLevel() { - NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr); + NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -829,7 +833,7 @@ namespace Tizen.NUI /// 3 public void SetOpaqueState(bool opaque) { - NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque); + Interop.Window.SetOpaqueState(swigCPtr, opaque); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -841,7 +845,7 @@ namespace Tizen.NUI /// 3 public bool IsOpaqueState() { - bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr); + bool ret = Interop.Window.IsOpaqueState(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -854,7 +858,7 @@ namespace Tizen.NUI /// 4 public bool SetScreenOffMode(ScreenOffMode screenOffMode) { - bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode); + bool ret = Interop.Window.SetScreenOffMode(swigCPtr, (int)screenOffMode); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -866,7 +870,7 @@ namespace Tizen.NUI /// 4 public ScreenOffMode GetScreenOffMode() { - ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr); + ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -879,7 +883,7 @@ namespace Tizen.NUI /// 3 public bool SetBrightness(int brightness) { - bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness); + bool ret = Interop.Window.SetBrightness(swigCPtr, brightness); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -891,7 +895,7 @@ namespace Tizen.NUI /// 3 public int GetBrightness() { - int ret = NDalicPINVOKE.GetBrightness(swigCPtr); + int ret = Interop.Window.GetBrightness(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -904,7 +908,7 @@ namespace Tizen.NUI /// 4 public void SetClass(string name, string klass) { - NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass); + Interop.Window.Window_SetClass(swigCPtr, name, klass); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -914,7 +918,7 @@ namespace Tizen.NUI /// 3 public void Raise() { - NDalicPINVOKE.Window_Raise(swigCPtr); + Interop.Window.Window_Raise(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -924,7 +928,7 @@ namespace Tizen.NUI /// 3 public void Lower() { - NDalicPINVOKE.Window_Lower(swigCPtr); + Interop.Window.Window_Lower(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -934,7 +938,7 @@ namespace Tizen.NUI /// 3 public void Activate() { - NDalicPINVOKE.Window_Activate(swigCPtr); + Interop.Window.Window_Activate(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -955,7 +959,7 @@ namespace Tizen.NUI /// 3 public void Add(View view) { - NDalicPINVOKE.Actor_Add(rootLayoutCPtr, View.getCPtr(view)); + Interop.Actor.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 view.InternalParent = this.GetRootLayer(); @@ -968,7 +972,7 @@ namespace Tizen.NUI /// 3 public void Remove(View view) { - NDalicPINVOKE.Actor_Remove(rootLayoutCPtr, View.getCPtr(view)); + Interop.Actor.Actor_Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view)); this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer view.InternalParent = null; } @@ -983,7 +987,7 @@ namespace Tizen.NUI { if (depth < LayersChildren?.Count) { - Layer ret = LayersChildren[Convert.ToInt32(depth)]; + Layer ret = LayersChildren?[Convert.ToInt32(depth)]; return ret; } else @@ -993,13 +997,22 @@ namespace Tizen.NUI } /// + /// Destroy the window immediately. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void Destroy() + { + this.Dispose(); + } + + /// /// Keep rendering for at least the given amount of time. /// /// Time to keep rendering, 0 means render at least one more frame. /// 3 public void KeepRendering(float durationSeconds) { - NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds); + Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -1013,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; } @@ -1027,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; } @@ -1045,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; } @@ -1059,7 +1072,7 @@ 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; } @@ -1073,7 +1086,7 @@ namespace Tizen.NUI /// 5 public bool SetKeyboardRepeatInfo(float rate, float delay) { - bool ret = NDalicManualPINVOKE.SetKeyboardRepeatInfo(rate, delay); + bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1087,7 +1100,7 @@ namespace Tizen.NUI /// 5 public bool GetKeyboardRepeatInfo(out float rate, out float delay) { - bool ret = NDalicManualPINVOKE.GetKeyboardRepeatInfo(out rate, out delay); + bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1099,10 +1112,11 @@ namespace Tizen.NUI /// 3 public void AddLayer(Layer layer) { - NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer)); + Interop.Window.Add(swigCPtr, Layer.getCPtr(layer)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); LayersChildren?.Add(layer); + layer.SetWindow(this); } /// @@ -1112,10 +1126,11 @@ namespace Tizen.NUI /// 3 public void RemoveLayer(Layer layer) { - NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer)); + Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); LayersChildren?.Remove(layer); + layer.SetWindow(null); } /// @@ -1125,7 +1140,7 @@ namespace Tizen.NUI /// 5 public void FeedKey(Key keyEvent) { - NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent)); + Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -1136,7 +1151,7 @@ namespace Tizen.NUI /// 4 public void RenderOnce() { - NDalicManualPINVOKE.Window_RenderOnce(swigCPtr); + Interop.Window.Window_RenderOnce(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -1147,115 +1162,111 @@ namespace Tizen.NUI internal static Window GetCurrent() { - Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true); + Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal static bool IsInstalled() { - bool ret = NDalicPINVOKE.Stage_IsInstalled(); + bool ret = Interop.Stage.Stage_IsInstalled(); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal WindowFocusSignalType WindowFocusChangedSignal() { - WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false); + WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode) { - NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode); + Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity) { - NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity); + Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal void RotateIndicator(Window.WindowOrientation orientation) { - NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation); + Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal void AddAvailableOrientation(Window.WindowOrientation orientation) { - NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation); + Interop.WindowInternal.Window_AddAvailableOrientation(swigCPtr, (int)orientation); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal void RemoveAvailableOrientation(Window.WindowOrientation orientation) { - NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation); + Interop.WindowInternal.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal void SetPreferredOrientation(Window.WindowOrientation orientation) { - NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation); + Interop.WindowInternal.Window_SetPreferredOrientation(swigCPtr, (int)orientation); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal Window.WindowOrientation GetPreferredOrientation() { - Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal DragAndDropDetector GetDragAndDropDetector() - { - DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true); + Window.WindowOrientation ret = (Window.WindowOrientation)Interop.WindowInternal.Window_GetPreferredOrientation(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal Any GetNativeHandle() { - Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true); + Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal WindowFocusSignalType FocusChangedSignal() { - WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false); + WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal void Add(Layer layer) { - NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer)); + Interop.Window.Add(swigCPtr, Layer.getCPtr(layer)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); LayersChildren?.Add(layer); + layer.SetWindow(this); } internal void Remove(Layer layer) { - NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(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() { - Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true); + 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(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true); + RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1279,49 +1290,50 @@ namespace Tizen.NUI // Core has been initialized, not when Stage is ready. if (_rootLayer == null && Window.IsInstalled()) { - _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true); + _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); LayersChildren?.Add(_rootLayer); + _rootLayer.SetWindow(this); } return _rootLayer; } internal void SetBackgroundColor(Vector4 color) { - NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color)); + Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal Vector4 GetBackgroundColor() { - Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true); + Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal Vector2 GetDpi() { - Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true); + 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(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true); + ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior) { - NDalicPINVOKE.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior); + Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal RenderingBehaviorType GetRenderingBehavior() { - RenderingBehaviorType ret = (RenderingBehaviorType)NDalicPINVOKE.Stage_GetRenderingBehavior(stageCPtr); + RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -1329,28 +1341,28 @@ namespace Tizen.NUI internal KeyEventSignal KeyEventSignal() { - KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false); + KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal VoidSignal EventProcessingFinishedSignal() { - VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false); + 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(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false); + 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(NDalicPINVOKE.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false); + TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -1358,28 +1370,28 @@ namespace Tizen.NUI internal VoidSignal ContextLostSignal() { - VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false); + VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal VoidSignal ContextRegainedSignal() { - VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false); + 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(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false); + VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal ResizedSignal ResizedSignal() { - ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false); + ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1387,19 +1399,16 @@ namespace Tizen.NUI internal void SetWindowSize(Size2D size) { var val = new Uint16Pair((uint)size.Width, (uint)size.Height); - NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val)); + Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - if(rootLayoutItem != null) - { - rootLayoutItem.RequestLayout(); - } + // Resetting Window size should request a relayout of the tree. } internal Size2D GetWindowSize() { - var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false); + 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(); @@ -1409,19 +1418,17 @@ namespace Tizen.NUI internal void SetPosition(Position2D position) { var val = new Uint16Pair((uint)position.X, (uint)position.Y); - NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val)); + Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - if(rootLayoutItem != null) - { - rootLayoutItem.RequestLayout(); - } + // Setting Position of the window should request a relayout of the tree. + } internal Position2D GetPosition() { - var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true); + 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(); @@ -1430,14 +1437,12 @@ namespace Tizen.NUI internal void SetPositionSize(Rectangle positionSize) { - NDalicPINVOKE.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize)); + Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - if(rootLayoutItem != null) - { - rootLayoutItem.RequestLayout(); - } + // Setting Position of the window should request a relayout of the tree. + } /// @@ -1446,18 +1451,102 @@ namespace Tizen.NUI /// Whether the window is transparent or not. /// 5 public void SetTransparency(bool transparent) { - NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent); + Interop.Window.SetTransparency(swigCPtr, transparent); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - if(rootLayoutItem != null) + // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent. + + } + + /// + /// 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(); + } + + /// + /// Unsets parent window of the window. + /// After unsetting, the window is disconnected his 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 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) + { + if (disposed) + { + 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) + { + layer.Dispose(); + } + _childLayers.Clear(); + } + + 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) { - rootLayoutItem.RequestLayout(); + if (swigCMemOwn) + { + swigCMemOwn = false; + Interop.Window.delete_Window(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } + + base.Dispose(type); } internal System.IntPtr GetNativeWindowHandler() { - System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr)); + System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1476,14 +1565,14 @@ namespace Tizen.NUI private StageWheelSignal WheelEventSignal() { - StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false); + StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private WheelSignal StageWheelEventSignal() { - WheelSignal ret = new WheelSignal(NDalicPINVOKE.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false); + WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -1511,7 +1600,7 @@ namespace Tizen.NUI private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent) { if (wheelEvent == global::System.IntPtr.Zero) - { + { NUILog.Error("wheelEvent should not be null!"); return true; } @@ -1802,7 +1891,7 @@ namespace Tizen.NUI /// Disconnect all native signals /// /// 5 - internal void DisconnectNativeSignals() + internal void DisconnectNativeSignals() { if( _windowFocusChangedEventCallback != null ) {