4 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.BaseComponents;
22 using System.ComponentModel;
23 using System.Collections.Generic;
28 /// The window class is used internally for drawing.<br />
29 /// The window has an orientation and indicator properties.<br />
31 /// <since_tizen> 3 </since_tizen>
32 public class Window : BaseHandle
34 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35 private global::System.Runtime.InteropServices.HandleRef stageCPtr;
36 private Layer _rootLayer;
37 private string _windowTitle;
38 private List<Layer> _childLayers = new List<Layer>();
39 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
40 private RootLayerTouchDataCallbackType _rootLayerTouchDataCallback;
41 private WheelEventCallbackType _wheelEventCallback;
42 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
43 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
44 private EventHandler _stageContextLostEventHandler;
45 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
46 private EventHandler _stageContextRegainedEventHandler;
47 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
48 private EventHandler _stageSceneCreatedEventHandler;
49 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
50 private WindowResizedEventCallbackType _windowResizedEventCallback;
51 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
53 private static readonly Window instance = Application.Instance?.GetWindow();
55 private LayoutController localController;
57 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Window.Window_SWIGUpcast(cPtr), cMemoryOwn)
59 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
60 if (Interop.Stage.Stage_IsInstalled())
62 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.Stage_GetCurrent());
64 localController = new LayoutController(this);
65 NUILog.Debug("layoutController id:" + localController.GetId() );
70 /// Creates a new Window.<br />
71 /// This creates an extra window in addition to the default main window<br />
73 /// <param name="windowPosition">The position and size of the Window.</param>
74 /// <param name="isTranslucent">Whether Window is translucent.</param>
75 /// <returns>A new Window.</returns>
76 /// <since_tizen> 6 </since_tizen>
77 [EditorBrowsable(EditorBrowsableState.Never)]
78 public Window(Rectangle windowPosition = null , bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
80 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
84 /// Creates a new Window.<br />
85 /// This creates an extra window in addition to the default main window<br />
87 /// <param name="name">The name for extra window. </param>
88 /// <param name="windowPosition">The position and size of the Window.</param>
89 /// <param name="isTranslucent">Whether Window is translucent.</param>
90 /// <returns>A new Window.</returns>
91 /// <since_tizen> 6 </since_tizen>
92 [EditorBrowsable(EditorBrowsableState.Never)]
93 public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
99 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
100 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
101 private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
102 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
103 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
104 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
105 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
106 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
107 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
110 /// FocusChanged event.
112 /// <since_tizen> 3 </since_tizen>
113 public event EventHandler<FocusChangedEventArgs> FocusChanged
117 if (_windowFocusChangedEventHandler == null)
119 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
120 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
123 _windowFocusChangedEventHandler += value;
127 _windowFocusChangedEventHandler -= value;
129 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
131 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
137 /// This event is emitted when the screen is touched and when the touch ends.<br />
138 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
139 /// then when the last finger is lifted.<br />
140 /// An interrupted event will also be emitted (if it occurs).<br />
142 /// <since_tizen> 3 </since_tizen>
143 public event EventHandler<TouchEventArgs> TouchEvent
147 if (_rootLayerTouchDataEventHandler == null)
149 _rootLayerTouchDataCallback = OnWindowTouch;
150 this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
152 _rootLayerTouchDataEventHandler += value;
156 _rootLayerTouchDataEventHandler -= value;
157 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
159 this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
165 /// This event is emitted when the wheel event is received.
167 /// <since_tizen> 3 </since_tizen>
168 public event EventHandler<WheelEventArgs> WheelEvent
172 if (_stageWheelHandler == null)
174 _wheelEventCallback = OnStageWheel;
175 this.StageWheelEventSignal().Connect(_wheelEventCallback);
177 _stageWheelHandler += value;
181 _stageWheelHandler -= value;
182 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
184 this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
190 /// This event is emitted when the key event is received.
192 /// <since_tizen> 3 </since_tizen>
193 public event EventHandler<KeyEventArgs> KeyEvent
197 if (_stageKeyHandler == null)
199 _stageKeyCallbackDelegate = OnStageKey;
200 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
202 _stageKeyHandler += value;
206 _stageKeyHandler -= value;
207 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
209 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
215 /// This event is emitted when the window resized.
217 /// <since_tizen> 3 </since_tizen>
218 public event EventHandler<ResizedEventArgs> Resized
222 if (_windowResizedEventHandler == null)
224 _windowResizedEventCallback = OnResized;
225 ResizedSignal().Connect(_windowResizedEventCallback);
228 _windowResizedEventHandler += value;
232 _windowResizedEventHandler -= value;
234 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
236 ResizedSignal().Disconnect(_windowResizedEventCallback);
242 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
244 /// <since_tizen> 3 </since_tizen>
245 /// Please do not use! this will be deprecated!
246 /// Instead please use FocusChanged.
247 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
249 "Window.Instance.FocusChanged = OnFocusChanged; " +
250 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
251 [EditorBrowsable(EditorBrowsableState.Never)]
252 public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
256 if (_windowFocusChangedEventHandler2 == null)
258 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
259 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
262 _windowFocusChangedEventHandler2 += value;
266 _windowFocusChangedEventHandler2 -= value;
268 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
270 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
276 /// ViewAdded will be triggered when the view added on Window
278 /// <since_tizen> 6 </since_tizen>
279 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
280 [EditorBrowsable(EditorBrowsableState.Never)]
281 public event EventHandler ViewAdded;
283 internal void SendViewAdded(View view)
285 ViewAdded?.Invoke(view, EventArgs.Empty);
288 internal event EventHandler EventProcessingFinished
292 if (_stageEventProcessingFinishedEventHandler == null)
294 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
295 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
297 _stageEventProcessingFinishedEventHandler += value;
302 _stageEventProcessingFinishedEventHandler -= value;
303 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
305 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
310 internal event EventHandler ContextLost
314 if (_stageContextLostEventHandler == null)
316 _stageContextLostEventCallbackDelegate = OnContextLost;
317 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
319 _stageContextLostEventHandler += value;
323 _stageContextLostEventHandler -= value;
324 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
326 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
331 internal event EventHandler ContextRegained
335 if (_stageContextRegainedEventHandler == null)
337 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
338 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
340 _stageContextRegainedEventHandler += value;
344 _stageContextRegainedEventHandler -= value;
345 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
347 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
352 internal event EventHandler SceneCreated
356 if (_stageSceneCreatedEventHandler == null)
358 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
359 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
361 _stageSceneCreatedEventHandler += value;
365 _stageSceneCreatedEventHandler -= value;
366 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
368 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
373 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
374 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
375 private event EventHandler<WheelEventArgs> _stageWheelHandler;
376 private event EventHandler<KeyEventArgs> _stageKeyHandler;
377 private event EventHandler _stageEventProcessingFinishedEventHandler;
378 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
379 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
382 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
384 /// <since_tizen> 3 </since_tizen>
385 public enum WindowOrientation
388 /// Portrait orientation. The height of the display area is greater than the width.
390 /// <since_tizen> 3 </since_tizen>
393 /// Landscape orientation. A wide view area is needed.
395 /// <since_tizen> 3 </since_tizen>
398 /// Portrait inverse orientation.
400 /// <since_tizen> 3 </since_tizen>
401 PortraitInverse = 180,
403 /// Landscape inverse orientation.
405 /// <since_tizen> 3 </since_tizen>
406 LandscapeInverse = 270
410 /// Enumeration for the key grab mode for platform-level APIs.
412 /// <since_tizen> 3 </since_tizen>
413 public enum KeyGrabMode
416 /// Grabs a key only when on the top of the grabbing-window stack mode.
420 /// Grabs a key together with the other client window(s) mode.
424 /// 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.
428 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
434 /// Enumeration for opacity of the indicator.
436 internal enum IndicatorBackgroundOpacity
444 /// Enumeration for visible mode of the indicator.
446 internal enum IndicatorVisibleMode
454 /// The stage instance property (read-only).<br />
455 /// Gets the current window.<br />
457 /// <since_tizen> 3 </since_tizen>
458 public static Window Instance
467 /// Gets or sets a window type.
469 /// <since_tizen> 3 </since_tizen>
470 public WindowType Type
474 WindowType ret = (WindowType)Interop.Window.GetType(swigCPtr);
475 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
480 Interop.Window.SetType(swigCPtr, (int)value);
481 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
486 /// Gets/Sets a window title.
488 /// <since_tizen> 4 </since_tizen>
497 _windowTitle = value;
498 SetClass(_windowTitle, "");
503 /// The rendering behavior of a Window.
505 /// <since_tizen> 5 </since_tizen>
506 public RenderingBehaviorType RenderingBehavior
510 return GetRenderingBehavior();
514 SetRenderingBehavior(value);
519 /// The window size property (read-only).
521 /// <since_tizen> 3 </since_tizen>
526 Size2D ret = GetSize();
532 /// The background color property.
534 /// <since_tizen> 3 </since_tizen>
535 public Color BackgroundColor
539 SetBackgroundColor(value);
543 Color ret = GetBackgroundColor();
549 /// The DPI property (read-only).<br />
550 /// Retrieves the DPI of the display device to which the Window is connected.<br />
552 /// <since_tizen> 3 </since_tizen>
562 /// The layer count property (read-only).<br />
563 /// Queries the number of on-Window layers.<br />
565 /// <since_tizen> 3 </since_tizen>
566 public uint LayerCount
570 return GetLayerCount();
575 /// Gets or sets a size of the window.
577 /// <since_tizen> 4 </since_tizen>
578 public Size2D WindowSize
582 return GetWindowSize();
586 SetWindowSize(value);
591 /// Gets or sets a position of the window.
593 /// <since_tizen> 4 </since_tizen>
594 public Position2D WindowPosition
598 return GetPosition();
605 internal static Vector4 DEFAULT_BACKGROUND_COLOR
609 global::System.IntPtr cPtr = Interop.Stage.Stage_DEFAULT_BACKGROUND_COLOR_get();
610 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
611 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
616 internal static Vector4 DEBUG_BACKGROUND_COLOR
620 global::System.IntPtr cPtr = Interop.Stage.Stage_DEBUG_BACKGROUND_COLOR_get();
621 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
622 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
627 internal List<Layer> LayersChildren
635 internal LayoutController LayoutController
639 return localController;
644 /// Feed a key-event into the window.
646 /// <param name="keyEvent">The key event to feed.</param>
647 /// <since_tizen> 4 </since_tizen>
648 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
649 public static void FeedKeyEvent(Key keyEvent)
651 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
652 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
656 /// Sets whether the window accepts a focus or not.
658 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
659 /// <since_tizen> 3 </since_tizen>
660 public void SetAcceptFocus(bool accept)
662 Interop.Window.SetAcceptFocus(swigCPtr, accept);
663 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
667 /// Returns whether the window accepts a focus or not.
669 /// <returns>True if the window accepts a focus, false otherwise.</returns>
670 /// <since_tizen> 3 </since_tizen>
671 public bool IsFocusAcceptable()
673 bool ret = Interop.Window.IsFocusAcceptable(swigCPtr);
674 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
680 /// Shows the window if it is hidden.
682 /// <since_tizen> 3 </since_tizen>
685 Interop.Window.Show(swigCPtr);
686 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
690 /// Hides the window if it is showing.
692 /// <since_tizen> 3 </since_tizen>
695 Interop.Window.Hide(swigCPtr);
696 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700 /// Retrieves whether the window is visible or not.
702 /// <returns>True if the window is visible.</returns>
703 /// <since_tizen> 3 </since_tizen>
704 public bool IsVisible()
706 bool temp = Interop.Window.IsVisible(swigCPtr);
707 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
712 /// Gets the count of supported auxiliary hints of the window.
714 /// <returns>The number of supported auxiliary hints.</returns>
715 /// <since_tizen> 3 </since_tizen>
716 public uint GetSupportedAuxiliaryHintCount()
718 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(swigCPtr);
719 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
724 /// Gets the supported auxiliary hint string of the window.
726 /// <param name="index">The index of the supported auxiliary hint lists.</param>
727 /// <returns>The auxiliary hint string of the index.</returns>
728 /// <since_tizen> 3 </since_tizen>
729 public string GetSupportedAuxiliaryHint(uint index)
731 string ret = Interop.Window.GetSupportedAuxiliaryHint(swigCPtr, index);
732 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
737 /// Creates an auxiliary hint of the window.
739 /// <param name="hint">The auxiliary hint string.</param>
740 /// <param name="value">The value string.</param>
741 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
742 /// <since_tizen> 3 </since_tizen>
743 public uint AddAuxiliaryHint(string hint, string value)
745 uint ret = Interop.Window.AddAuxiliaryHint(swigCPtr, hint, value);
746 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751 /// Removes an auxiliary hint of the window.
753 /// <param name="id">The ID of the auxiliary hint.</param>
754 /// <returns>True if no error occurred, false otherwise.</returns>
755 /// <since_tizen> 3 </since_tizen>
756 public bool RemoveAuxiliaryHint(uint id)
758 bool ret = Interop.Window.RemoveAuxiliaryHint(swigCPtr, id);
759 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764 /// Changes a value of the auxiliary hint.
766 /// <param name="id">The auxiliary hint ID.</param>
767 /// <param name="value">The value string to be set.</param>
768 /// <returns>True if no error occurred, false otherwise.</returns>
769 /// <since_tizen> 3 </since_tizen>
770 public bool SetAuxiliaryHintValue(uint id, string value)
772 bool ret = Interop.Window.SetAuxiliaryHintValue(swigCPtr, id, value);
773 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778 /// Gets a value of the auxiliary hint.
780 /// <param name="id">The auxiliary hint ID.</param>
781 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
782 /// <since_tizen> 3 </since_tizen>
783 public string GetAuxiliaryHintValue(uint id)
785 string ret = Interop.Window.GetAuxiliaryHintValue(swigCPtr, id);
786 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791 /// Gets an ID of the auxiliary hint string.
793 /// <param name="hint">The auxiliary hint string.</param>
794 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
795 /// <since_tizen> 3 </since_tizen>
796 public uint GetAuxiliaryHintId(string hint)
798 uint ret = Interop.Window.GetAuxiliaryHintId(swigCPtr, hint);
799 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
804 /// Sets a region to accept input events.
806 /// <param name="inputRegion">The region to accept input events.</param>
807 /// <since_tizen> 3 </since_tizen>
808 public void SetInputRegion(Rectangle inputRegion)
810 Interop.Window.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
811 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815 /// Sets a priority level for the specified notification window.
817 /// <param name="level">The notification window level.</param>
818 /// <returns>True if no error occurred, false otherwise.</returns>
819 /// <since_tizen> 3 </since_tizen>
820 public bool SetNotificationLevel(NotificationLevel level)
822 bool ret = Interop.Window.SetNotificationLevel(swigCPtr, (int)level);
823 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
828 /// Gets a priority level for the specified notification window.
830 /// <returns>The notification window level.</returns>
831 /// <since_tizen> 3 </since_tizen>
832 public NotificationLevel GetNotificationLevel()
834 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(swigCPtr);
835 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
840 /// Sets a transparent window's visual state to opaque. <br />
841 /// If a visual state of a transparent window is opaque, <br />
842 /// then the window manager could handle it as an opaque window when calculating visibility.
844 /// <param name="opaque">Whether the window's visual state is opaque.</param>
845 /// <remarks>This will have no effect on an opaque window. <br />
846 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
848 /// <since_tizen> 3 </since_tizen>
849 public void SetOpaqueState(bool opaque)
851 Interop.Window.SetOpaqueState(swigCPtr, opaque);
852 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
856 /// Returns whether a transparent window's visual state is opaque or not.
858 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
859 /// <remarks> The return value has no meaning on an opaque window. </remarks>
860 /// <since_tizen> 3 </since_tizen>
861 public bool IsOpaqueState()
863 bool ret = Interop.Window.IsOpaqueState(swigCPtr);
864 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
869 /// Sets a window's screen off mode.
871 /// <param name="screenOffMode">The screen mode.</param>
872 /// <returns>True if no error occurred, false otherwise.</returns>
873 /// <since_tizen> 4 </since_tizen>
874 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
876 bool ret = Interop.Window.SetScreenOffMode(swigCPtr, (int)screenOffMode);
877 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
882 /// Gets the screen mode of the window.
884 /// <returns>The screen off mode.</returns>
885 /// <since_tizen> 4 </since_tizen>
886 public ScreenOffMode GetScreenOffMode()
888 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(swigCPtr);
889 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
894 /// Sets preferred brightness of the window.
896 /// <param name="brightness">The preferred brightness (0 to 100).</param>
897 /// <returns>True if no error occurred, false otherwise.</returns>
898 /// <since_tizen> 3 </since_tizen>
899 public bool SetBrightness(int brightness)
901 bool ret = Interop.Window.SetBrightness(swigCPtr, brightness);
902 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
907 /// Gets the preferred brightness of the window.
909 /// <returns>The preferred brightness.</returns>
910 /// <since_tizen> 3 </since_tizen>
911 public int GetBrightness()
913 int ret = Interop.Window.GetBrightness(swigCPtr);
914 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
919 /// Sets the window name and the class string.
921 /// <param name="name">The name of the window.</param>
922 /// <param name="klass">The class of the window.</param>
923 /// <since_tizen> 4 </since_tizen>
924 public void SetClass(string name, string klass)
926 Interop.Window.Window_SetClass(swigCPtr, name, klass);
927 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
931 /// Raises the window to the top of the window stack.
933 /// <since_tizen> 3 </since_tizen>
936 Interop.Window.Window_Raise(swigCPtr);
937 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
941 /// Lowers the window to the bottom of the window stack.
943 /// <since_tizen> 3 </since_tizen>
946 Interop.Window.Window_Lower(swigCPtr);
947 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
951 /// Activates the window to the top of the window stack even it is iconified.
953 /// <since_tizen> 3 </since_tizen>
954 public void Activate()
956 Interop.Window.Window_Activate(swigCPtr);
957 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
961 /// Gets the default ( root ) layer.
963 /// <returns>The root layer.</returns>
964 /// <since_tizen> 3 </since_tizen>
965 public Layer GetDefaultLayer()
967 return this.GetRootLayer();
971 /// Add a child view to window.
973 /// <param name="view">the child should be added to the window.</param>
974 /// <since_tizen> 3 </since_tizen>
975 public void Add(View view)
977 Interop.Actor.Actor_Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
978 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
979 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
980 view.InternalParent = this.GetRootLayer();
984 /// Remove a child view from window.
986 /// <param name="view">the child to be removed.</param>
987 /// <since_tizen> 3 </since_tizen>
988 public void Remove(View view)
990 Interop.Actor.Actor_Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
991 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
992 view.InternalParent = null;
996 /// Retrieves the layer at a specified depth.
998 /// <param name="depth">The layer's depth index.</param>
999 /// <returns>The layer found at the given depth.</returns>
1000 /// <since_tizen> 3 </since_tizen>
1001 public Layer GetLayer(uint depth)
1003 if (depth < LayersChildren?.Count)
1005 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1015 /// Destroy the window immediately.
1017 [EditorBrowsable(EditorBrowsableState.Never)]
1018 public void Destroy()
1024 /// Keep rendering for at least the given amount of time.
1026 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1027 /// <since_tizen> 3 </since_tizen>
1028 public void KeepRendering(float durationSeconds)
1030 Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds);
1031 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1035 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1036 /// This function can be used for following example scenarios: <br />
1037 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1039 /// <param name="DaliKey">The key code to grab.</param>
1040 /// <returns>True if the grab succeeds.</returns>
1041 /// <since_tizen> 3 </since_tizen>
1042 public bool GrabKeyTopmost(int DaliKey)
1044 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1045 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1050 /// Ungrabs the key specified by a key for the window.<br />
1051 /// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event.<br />
1053 /// <param name="DaliKey">The key code to ungrab.</param>
1054 /// <returns>True if the ungrab succeeds.</returns>
1055 /// <since_tizen> 3 </since_tizen>
1056 public bool UngrabKeyTopmost(int DaliKey)
1058 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1059 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1064 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1065 /// Details: This function can be used for following example scenarios: <br />
1066 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1067 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1068 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1070 /// <param name="DaliKey">The key code to grab.</param>
1071 /// <param name="GrabMode">The grab mode for the key.</param>
1072 /// <returns>True if the grab succeeds.</returns>
1073 /// <since_tizen> 3 </since_tizen>
1074 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1076 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1077 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1082 /// Ungrabs the key specified by a key for a window.<br />
1083 /// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event. <br />
1085 /// <param name="DaliKey">The key code to ungrab.</param>
1086 /// <returns>True if the ungrab succeeds.</returns>
1087 /// <since_tizen> 3 </since_tizen>
1088 public bool UngrabKey(int DaliKey)
1090 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1091 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1096 /// Sets the keyboard repeat information.
1098 /// <param name="rate">The key repeat rate value in seconds.</param>
1099 /// <param name="delay">The key repeat delay value in seconds.</param>
1100 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1101 /// <since_tizen> 5 </since_tizen>
1102 public bool SetKeyboardRepeatInfo(float rate, float delay)
1104 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1105 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1110 /// Gets the keyboard repeat information.
1112 /// <param name="rate">The key repeat rate value in seconds.</param>
1113 /// <param name="delay">The key repeat delay value in seconds.</param>
1114 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1115 /// <since_tizen> 5 </since_tizen>
1116 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1118 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1124 /// Adds a layer to the stage.
1126 /// <param name="layer">Layer to add.</param>
1127 /// <since_tizen> 3 </since_tizen>
1128 public void AddLayer(Layer layer)
1130 Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1131 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1133 LayersChildren?.Add(layer);
1134 layer.SetWindow(this);
1138 /// Removes a layer from the stage.
1140 /// <param name="layer">Layer to remove.</param>
1141 /// <since_tizen> 3 </since_tizen>
1142 public void RemoveLayer(Layer layer)
1144 Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1145 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1147 LayersChildren?.Remove(layer);
1148 layer.SetWindow(null);
1152 /// Feeds a key event into the window.
1154 /// <param name="keyEvent">The key event to feed.</param>
1155 /// <since_tizen> 5 </since_tizen>
1156 public void FeedKey(Key keyEvent)
1158 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1163 /// Allows at least one more render, even when paused.
1164 /// The window should be shown, not minimised.
1166 /// <since_tizen> 4 </since_tizen>
1167 public void RenderOnce()
1169 Interop.Window.Window_RenderOnce(swigCPtr);
1170 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1173 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1175 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1178 internal static Window GetCurrent()
1180 Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
1181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1185 internal static bool IsInstalled()
1187 bool ret = Interop.Stage.Stage_IsInstalled();
1188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1192 internal WindowFocusSignalType WindowFocusChangedSignal()
1194 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1199 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1201 Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1205 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1207 Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1211 internal void RotateIndicator(Window.WindowOrientation orientation)
1213 Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
1214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1217 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1219 Interop.WindowInternal.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1220 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1223 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1225 Interop.WindowInternal.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1226 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1229 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1231 Interop.WindowInternal.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1235 internal Window.WindowOrientation GetPreferredOrientation()
1237 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.WindowInternal.Window_GetPreferredOrientation(swigCPtr);
1238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1242 internal Any GetNativeHandle()
1244 Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1249 internal WindowFocusSignalType FocusChangedSignal()
1251 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1256 internal void Add(Layer layer)
1258 Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1261 LayersChildren?.Add(layer);
1262 layer.SetWindow(this);
1265 internal void Remove(Layer layer)
1267 Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1270 LayersChildren?.Remove(layer);
1271 layer.SetWindow(null);
1274 internal Vector2 GetSize()
1276 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1277 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1278 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1282 internal RenderTaskList GetRenderTaskList()
1284 RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1285 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1290 /// Queries the number of on-window layers.
1292 /// <returns>The number of layers.</returns>
1293 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1294 internal uint GetLayerCount()
1296 if (LayersChildren == null || LayersChildren.Count < 0)
1299 return (uint) LayersChildren.Count;
1302 internal Layer GetRootLayer()
1304 // Window.IsInstalled() is actually true only when called from event thread and
1305 // Core has been initialized, not when Stage is ready.
1306 if (_rootLayer == null && Window.IsInstalled())
1308 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1310 LayersChildren?.Add(_rootLayer);
1311 _rootLayer.SetWindow(this);
1316 internal void SetBackgroundColor(Vector4 color)
1318 Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1319 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1322 internal Vector4 GetBackgroundColor()
1324 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1329 internal Vector2 GetDpi()
1331 Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1332 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1336 internal ObjectRegistry GetObjectRegistry()
1338 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1343 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1345 Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1349 internal RenderingBehaviorType GetRenderingBehavior()
1351 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1352 if (NDalicPINVOKE.SWIGPendingException.Pending)
1353 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1357 internal KeyEventSignal KeyEventSignal()
1359 KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false);
1360 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1364 internal VoidSignal EventProcessingFinishedSignal()
1366 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1371 internal TouchSignal TouchSignal()
1373 TouchSignal ret = new TouchSignal(Interop.Window.TouchSignal(swigCPtr), false);
1374 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1378 internal TouchDataSignal TouchDataSignal()
1380 TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1381 if (NDalicPINVOKE.SWIGPendingException.Pending)
1382 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1386 internal VoidSignal ContextLostSignal()
1388 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false);
1389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1393 internal VoidSignal ContextRegainedSignal()
1395 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextRegainedSignal(stageCPtr), false);
1396 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1400 internal VoidSignal SceneCreatedSignal()
1402 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false);
1403 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1407 internal ResizedSignal ResizedSignal()
1409 ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false);
1410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1414 internal void SetWindowSize(Size2D size)
1416 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1417 Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1419 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1421 // Resetting Window size should request a relayout of the tree.
1424 internal Size2D GetWindowSize()
1426 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1427 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1429 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1433 internal void SetPosition(Position2D position)
1435 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1436 Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1438 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1440 // Setting Position of the window should request a relayout of the tree.
1444 internal Position2D GetPosition()
1446 var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1447 Position2D ret = new Position2D(val.GetX(), val.GetY());
1449 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1453 internal void SetPositionSize(Rectangle positionSize)
1455 Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1457 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1459 // Setting Position of the window should request a relayout of the tree.
1464 /// Sets whether the window is transparent or not.
1466 /// <param name="transparent">Whether the window is transparent or not.</param>
1467 /// <since_tizen> 5 </since_tizen>
1468 public void SetTransparency(bool transparent) {
1469 Interop.Window.SetTransparency(swigCPtr, transparent);
1470 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1472 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1477 /// Sets parent window of the window.
1478 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1479 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1480 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1482 /// <param name="parent">The parent window.</param>
1483 /// <since_tizen> 6 </since_tizen>
1484 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1485 [EditorBrowsable(EditorBrowsableState.Never)]
1486 public void SetParent(Window parent) {
1487 Interop.Window.SetParent(swigCPtr, Window.getCPtr(parent));
1488 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1492 /// Unsets parent window of the window.
1493 /// After unsetting, the window is disconnected his parent window.
1495 /// <since_tizen> 6 </since_tizen>
1496 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1497 [EditorBrowsable(EditorBrowsableState.Never)]
1498 public void Unparent() {
1499 Interop.Window.Unparent(swigCPtr);
1500 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1504 /// Gets parent window of the window.
1506 /// <returns>The parent window of the window.</returns>
1507 /// <since_tizen> 6 </since_tizen>
1508 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1509 [EditorBrowsable(EditorBrowsableState.Never)]
1510 public Window GetParent() {
1511 Window ret = new Window(Interop.Window.GetParent(swigCPtr), true);
1512 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1517 /// Dispose for Window
1519 [EditorBrowsable(EditorBrowsableState.Never)]
1520 protected override void Dispose(DisposeTypes type)
1527 if (type == DisposeTypes.Explicit)
1530 //Release your own managed resources here.
1531 //You should release all of your own disposable objects here.
1533 _rootLayer.Dispose();
1534 localController.Dispose();
1536 foreach(var layer in _childLayers)
1540 _childLayers.Clear();
1543 this.DisconnectNativeSignals();
1545 //Release your own unmanaged resources here.
1546 //You should not access any managed member here except static instance.
1547 //because the execution order of Finalizes is non-deterministic.
1549 if (swigCPtr.Handle != global::System.IntPtr.Zero)
1553 swigCMemOwn = false;
1554 Interop.Window.delete_Window(swigCPtr);
1556 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1562 internal System.IntPtr GetNativeWindowHandler()
1564 System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1565 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1569 private void OnWindowFocusedChanged(bool focusGained)
1571 FocusChangedEventArgs e = new FocusChangedEventArgs();
1573 e.FocusGained = focusGained;
1575 if (_windowFocusChangedEventHandler != null)
1577 _windowFocusChangedEventHandler(this, e);
1581 private StageWheelSignal WheelEventSignal()
1583 StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false);
1584 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1588 private WheelSignal StageWheelEventSignal()
1590 WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1591 if (NDalicPINVOKE.SWIGPendingException.Pending)
1592 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1596 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1598 if (touchData == global::System.IntPtr.Zero)
1600 NUILog.Error("touchData should not be null!");
1604 TouchEventArgs e = new TouchEventArgs();
1606 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1608 if (_rootLayerTouchDataEventHandler != null)
1610 _rootLayerTouchDataEventHandler(this, e);
1615 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1617 if (wheelEvent == global::System.IntPtr.Zero)
1619 NUILog.Error("wheelEvent should not be null!");
1623 WheelEventArgs e = new WheelEventArgs();
1625 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1627 if (_stageWheelHandler != null)
1629 _stageWheelHandler(this, e);
1634 // Callback for Stage KeyEventsignal
1635 private void OnStageKey(IntPtr data)
1637 KeyEventArgs e = new KeyEventArgs();
1638 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1641 if (_stageKeyHandler != null)
1643 //here we send all data to user event handlers
1644 _stageKeyHandler(this, e);
1648 // Callback for Stage EventProcessingFinishedSignal
1649 private void OnEventProcessingFinished()
1651 if (_stageEventProcessingFinishedEventHandler != null)
1653 _stageEventProcessingFinishedEventHandler(this, null);
1657 // Callback for Stage ContextLostSignal
1658 private void OnContextLost()
1660 if (_stageContextLostEventHandler != null)
1662 _stageContextLostEventHandler(this, null);
1666 // Callback for Stage ContextRegainedSignal
1667 private void OnContextRegained()
1669 if (_stageContextRegainedEventHandler != null)
1671 _stageContextRegainedEventHandler(this, null);
1675 // Callback for Stage SceneCreatedSignal
1676 private void OnSceneCreated()
1678 if (_stageSceneCreatedEventHandler != null)
1680 _stageSceneCreatedEventHandler(this, null);
1684 private void OnResized(IntPtr windowSize)
1686 ResizedEventArgs e = new ResizedEventArgs();
1687 var val = new Uint16Pair(windowSize, false);
1688 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1691 if (_windowResizedEventHandler != null)
1693 _windowResizedEventHandler(this, e);
1697 private void OnWindowFocusedChanged2(bool focusGained)
1699 FocusChangedEventArgs e = new FocusChangedEventArgs();
1701 e.FocusGained = focusGained;
1703 if (_windowFocusChangedEventHandler2 != null)
1705 _windowFocusChangedEventHandler2(this, e);
1710 /// The focus changed event argument.
1712 /// <since_tizen> 3 </since_tizen>
1713 public class FocusChangedEventArgs : EventArgs
1716 /// FocusGained flag.
1718 /// <since_tizen> 3 </since_tizen>
1719 public bool FocusGained
1727 /// The touch event argument.
1729 /// <since_tizen> 3 </since_tizen>
1730 public class TouchEventArgs : EventArgs
1732 private Touch _touch;
1737 /// <since_tizen> 3 </since_tizen>
1752 /// Wheel event arguments.
1754 /// <since_tizen> 3 </since_tizen>
1755 public class WheelEventArgs : EventArgs
1757 private Wheel _wheel;
1762 /// <since_tizen> 3 </since_tizen>
1777 /// Key event arguments.
1779 /// <since_tizen> 3 </since_tizen>
1780 public class KeyEventArgs : EventArgs
1787 /// <since_tizen> 3 </since_tizen>
1802 /// Sets position and size of the window. This API guarantees that
1803 /// both moving and resizing of window will appear on the screen at once.
1805 [EditorBrowsable(EditorBrowsableState.Never)]
1806 public Rectangle WindowPositionSize
1810 Position2D position = GetPosition();
1811 Size2D size = GetSize();
1812 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1817 SetPositionSize(value);
1822 /// Feeds a key event into the window.
1823 /// This resized event arguments.
1825 /// <since_tizen> 3 </since_tizen>
1826 public class ResizedEventArgs : EventArgs
1831 /// This window size.
1833 /// <since_tizen> 4 </since_tizen>
1834 public Size2D WindowSize
1842 _windowSize = value;
1848 /// Please do not use! this will be deprecated
1850 /// <since_tizen> 3 </since_tizen>
1851 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1853 "Window.Instance.FocusChanged = OnFocusChanged; " +
1854 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1855 [EditorBrowsable(EditorBrowsableState.Never)]
1856 public class WindowFocusChangedEventArgs : EventArgs
1859 /// Please do not use! this will be deprecated
1861 /// <since_tizen> 3 </since_tizen>
1862 public bool FocusGained
1870 /// Contains and encapsulates Native Window handle.
1872 /// <since_tizen> 4 </since_tizen>
1873 public class SafeNativeWindowHandle : SafeHandle
1876 /// Contructor, Native window handle is set to handle.
1878 /// <since_tizen> 4 </since_tizen>
1879 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1881 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1884 /// Null check if the handle is valid or not.
1886 /// <since_tizen> 4 </since_tizen>
1887 public override bool IsInvalid
1891 return this.handle == IntPtr.Zero;
1895 /// Release handle itself.
1897 /// <returns>true when released successfully.</returns>
1898 /// <since_tizen> 4 </since_tizen>
1899 protected override bool ReleaseHandle()
1906 /// Disconnect all native signals
1908 /// <since_tizen> 5 </since_tizen>
1909 internal void DisconnectNativeSignals()
1911 if( _windowFocusChangedEventCallback != null )
1913 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1916 if( _rootLayerTouchDataCallback != null )
1918 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1921 if( _wheelEventCallback != null )
1923 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1926 if( _stageKeyCallbackDelegate != null )
1928 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1931 if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1933 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1936 if( _stageContextLostEventCallbackDelegate != null )
1938 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1941 if( _stageContextRegainedEventCallbackDelegate != null )
1943 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1946 if( _stageSceneCreatedEventCallbackDelegate != null )
1948 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1951 if( _windowResizedEventCallback != null )
1953 ResizedSignal().Disconnect(_windowResizedEventCallback);
1956 if( _windowFocusChangedEventCallback2 != null )
1958 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);