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();
1218 /// Adds an orientation to the list of available orientations.
1220 /// <param name="orientation">The available orientation to add</param>
1221 /// <since_tizen> 6 </since_tizen>
1222 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1223 [EditorBrowsable(EditorBrowsableState.Never)]
1224 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1226 Interop.Window.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1231 /// Removes an orientation from the list of available orientations.
1233 /// <param name="orientation">The available orientation to remove.</param>
1234 /// <since_tizen> 6 </since_tizen>
1235 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1236 [EditorBrowsable(EditorBrowsableState.Never)]
1237 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1239 Interop.Window.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1244 /// Sets a preferred orientation.
1246 /// <param name="orientation">The preferred orientation.</param>
1247 /// <since_tizen> 6 </since_tizen>
1248 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1249 [EditorBrowsable(EditorBrowsableState.Never)]
1250 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1252 Interop.Window.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1257 /// Gets the preferred orientation.
1259 /// <param name="parent">The parent window.</param>
1260 /// <since_tizen> 6 </since_tizen>
1261 /// <returns>The preferred orientation if previously set, or none.</returns>
1262 [EditorBrowsable(EditorBrowsableState.Never)]
1263 public Window.WindowOrientation GetPreferredOrientation()
1265 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.Window_GetPreferredOrientation(swigCPtr);
1266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1270 internal Any GetNativeHandle()
1272 Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1273 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1277 internal WindowFocusSignalType FocusChangedSignal()
1279 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1284 internal void Add(Layer layer)
1286 Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1289 LayersChildren?.Add(layer);
1290 layer.SetWindow(this);
1293 internal void Remove(Layer layer)
1295 Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1298 LayersChildren?.Remove(layer);
1299 layer.SetWindow(null);
1302 internal Vector2 GetSize()
1304 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1305 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1310 internal RenderTaskList GetRenderTaskList()
1312 RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1318 /// Queries the number of on-window layers.
1320 /// <returns>The number of layers.</returns>
1321 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1322 internal uint GetLayerCount()
1324 if (LayersChildren == null || LayersChildren.Count < 0)
1327 return (uint) LayersChildren.Count;
1330 internal Layer GetRootLayer()
1332 // Window.IsInstalled() is actually true only when called from event thread and
1333 // Core has been initialized, not when Stage is ready.
1334 if (_rootLayer == null && Window.IsInstalled())
1336 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1337 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1338 LayersChildren?.Add(_rootLayer);
1339 _rootLayer.SetWindow(this);
1344 internal void SetBackgroundColor(Vector4 color)
1346 Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1347 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1350 internal Vector4 GetBackgroundColor()
1352 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1353 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1357 internal Vector2 GetDpi()
1359 Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1360 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1364 internal ObjectRegistry GetObjectRegistry()
1366 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1371 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1373 Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1374 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1377 internal RenderingBehaviorType GetRenderingBehavior()
1379 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1380 if (NDalicPINVOKE.SWIGPendingException.Pending)
1381 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1385 internal KeyEventSignal KeyEventSignal()
1387 KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false);
1388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1392 internal VoidSignal EventProcessingFinishedSignal()
1394 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1399 internal TouchSignal TouchSignal()
1401 TouchSignal ret = new TouchSignal(Interop.Window.TouchSignal(swigCPtr), false);
1402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1406 internal TouchDataSignal TouchDataSignal()
1408 TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1409 if (NDalicPINVOKE.SWIGPendingException.Pending)
1410 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1414 internal VoidSignal ContextLostSignal()
1416 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false);
1417 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1421 internal VoidSignal ContextRegainedSignal()
1423 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextRegainedSignal(stageCPtr), false);
1424 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1428 internal VoidSignal SceneCreatedSignal()
1430 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false);
1431 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1435 internal ResizedSignal ResizedSignal()
1437 ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false);
1438 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1442 internal void SetWindowSize(Size2D size)
1444 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1445 Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1447 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1449 // Resetting Window size should request a relayout of the tree.
1452 internal Size2D GetWindowSize()
1454 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1455 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1457 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1461 internal void SetPosition(Position2D position)
1463 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1464 Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1466 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1468 // Setting Position of the window should request a relayout of the tree.
1472 internal Position2D GetPosition()
1474 var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1475 Position2D ret = new Position2D(val.GetX(), val.GetY());
1477 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1481 internal void SetPositionSize(Rectangle positionSize)
1483 Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1485 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1487 // Setting Position of the window should request a relayout of the tree.
1492 /// Sets whether the window is transparent or not.
1494 /// <param name="transparent">Whether the window is transparent or not.</param>
1495 /// <since_tizen> 5 </since_tizen>
1496 public void SetTransparency(bool transparent) {
1497 Interop.Window.SetTransparency(swigCPtr, transparent);
1498 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1500 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1505 /// Sets parent window of the window.
1506 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1507 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1508 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1510 /// <param name="parent">The parent window.</param>
1511 /// <since_tizen> 6 </since_tizen>
1512 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1513 [EditorBrowsable(EditorBrowsableState.Never)]
1514 public void SetParent(Window parent) {
1515 Interop.Window.SetParent(swigCPtr, Window.getCPtr(parent));
1516 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1520 /// Unsets parent window of the window.
1521 /// After unsetting, the window is disconnected his parent window.
1523 /// <since_tizen> 6 </since_tizen>
1524 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1525 [EditorBrowsable(EditorBrowsableState.Never)]
1526 public void Unparent() {
1527 Interop.Window.Unparent(swigCPtr);
1528 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1532 /// Gets parent window of the window.
1534 /// <returns>The parent window of the window.</returns>
1535 /// <since_tizen> 6 </since_tizen>
1536 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1537 [EditorBrowsable(EditorBrowsableState.Never)]
1538 public Window GetParent() {
1539 Window ret = new Window(Interop.Window.GetParent(swigCPtr), true);
1540 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1545 /// Dispose for Window
1547 [EditorBrowsable(EditorBrowsableState.Never)]
1548 protected override void Dispose(DisposeTypes type)
1555 if (type == DisposeTypes.Explicit)
1558 //Release your own managed resources here.
1559 //You should release all of your own disposable objects here.
1561 _rootLayer.Dispose();
1562 localController.Dispose();
1564 foreach(var layer in _childLayers)
1568 _childLayers.Clear();
1571 this.DisconnectNativeSignals();
1573 //Release your own unmanaged resources here.
1574 //You should not access any managed member here except static instance.
1575 //because the execution order of Finalizes is non-deterministic.
1577 if (swigCPtr.Handle != global::System.IntPtr.Zero)
1581 swigCMemOwn = false;
1582 Interop.Window.delete_Window(swigCPtr);
1584 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1590 internal System.IntPtr GetNativeWindowHandler()
1592 System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1597 private void OnWindowFocusedChanged(bool focusGained)
1599 FocusChangedEventArgs e = new FocusChangedEventArgs();
1601 e.FocusGained = focusGained;
1603 if (_windowFocusChangedEventHandler != null)
1605 _windowFocusChangedEventHandler(this, e);
1609 private StageWheelSignal WheelEventSignal()
1611 StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false);
1612 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1616 private WheelSignal StageWheelEventSignal()
1618 WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1619 if (NDalicPINVOKE.SWIGPendingException.Pending)
1620 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1624 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1626 if (touchData == global::System.IntPtr.Zero)
1628 NUILog.Error("touchData should not be null!");
1632 TouchEventArgs e = new TouchEventArgs();
1634 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1636 if (_rootLayerTouchDataEventHandler != null)
1638 _rootLayerTouchDataEventHandler(this, e);
1643 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1645 if (wheelEvent == global::System.IntPtr.Zero)
1647 NUILog.Error("wheelEvent should not be null!");
1651 WheelEventArgs e = new WheelEventArgs();
1653 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1655 if (_stageWheelHandler != null)
1657 _stageWheelHandler(this, e);
1662 // Callback for Stage KeyEventsignal
1663 private void OnStageKey(IntPtr data)
1665 KeyEventArgs e = new KeyEventArgs();
1666 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1669 if (_stageKeyHandler != null)
1671 //here we send all data to user event handlers
1672 _stageKeyHandler(this, e);
1676 // Callback for Stage EventProcessingFinishedSignal
1677 private void OnEventProcessingFinished()
1679 if (_stageEventProcessingFinishedEventHandler != null)
1681 _stageEventProcessingFinishedEventHandler(this, null);
1685 // Callback for Stage ContextLostSignal
1686 private void OnContextLost()
1688 if (_stageContextLostEventHandler != null)
1690 _stageContextLostEventHandler(this, null);
1694 // Callback for Stage ContextRegainedSignal
1695 private void OnContextRegained()
1697 if (_stageContextRegainedEventHandler != null)
1699 _stageContextRegainedEventHandler(this, null);
1703 // Callback for Stage SceneCreatedSignal
1704 private void OnSceneCreated()
1706 if (_stageSceneCreatedEventHandler != null)
1708 _stageSceneCreatedEventHandler(this, null);
1712 private void OnResized(IntPtr windowSize)
1714 ResizedEventArgs e = new ResizedEventArgs();
1715 var val = new Uint16Pair(windowSize, false);
1716 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1719 if (_windowResizedEventHandler != null)
1721 _windowResizedEventHandler(this, e);
1725 private void OnWindowFocusedChanged2(bool focusGained)
1727 FocusChangedEventArgs e = new FocusChangedEventArgs();
1729 e.FocusGained = focusGained;
1731 if (_windowFocusChangedEventHandler2 != null)
1733 _windowFocusChangedEventHandler2(this, e);
1738 /// The focus changed event argument.
1740 /// <since_tizen> 3 </since_tizen>
1741 public class FocusChangedEventArgs : EventArgs
1744 /// FocusGained flag.
1746 /// <since_tizen> 3 </since_tizen>
1747 public bool FocusGained
1755 /// The touch event argument.
1757 /// <since_tizen> 3 </since_tizen>
1758 public class TouchEventArgs : EventArgs
1760 private Touch _touch;
1765 /// <since_tizen> 3 </since_tizen>
1780 /// Wheel event arguments.
1782 /// <since_tizen> 3 </since_tizen>
1783 public class WheelEventArgs : EventArgs
1785 private Wheel _wheel;
1790 /// <since_tizen> 3 </since_tizen>
1805 /// Key event arguments.
1807 /// <since_tizen> 3 </since_tizen>
1808 public class KeyEventArgs : EventArgs
1815 /// <since_tizen> 3 </since_tizen>
1830 /// Sets position and size of the window. This API guarantees that
1831 /// both moving and resizing of window will appear on the screen at once.
1833 [EditorBrowsable(EditorBrowsableState.Never)]
1834 public Rectangle WindowPositionSize
1838 Position2D position = GetPosition();
1839 Size2D size = GetSize();
1840 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1845 SetPositionSize(value);
1850 /// Feeds a key event into the window.
1851 /// This resized event arguments.
1853 /// <since_tizen> 3 </since_tizen>
1854 public class ResizedEventArgs : EventArgs
1859 /// This window size.
1861 /// <since_tizen> 4 </since_tizen>
1862 public Size2D WindowSize
1870 _windowSize = value;
1876 /// Please do not use! this will be deprecated
1878 /// <since_tizen> 3 </since_tizen>
1879 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1881 "Window.Instance.FocusChanged = OnFocusChanged; " +
1882 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1883 [EditorBrowsable(EditorBrowsableState.Never)]
1884 public class WindowFocusChangedEventArgs : EventArgs
1887 /// Please do not use! this will be deprecated
1889 /// <since_tizen> 3 </since_tizen>
1890 public bool FocusGained
1898 /// Contains and encapsulates Native Window handle.
1900 /// <since_tizen> 4 </since_tizen>
1901 public class SafeNativeWindowHandle : SafeHandle
1904 /// Contructor, Native window handle is set to handle.
1906 /// <since_tizen> 4 </since_tizen>
1907 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1909 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1912 /// Null check if the handle is valid or not.
1914 /// <since_tizen> 4 </since_tizen>
1915 public override bool IsInvalid
1919 return this.handle == IntPtr.Zero;
1923 /// Release handle itself.
1925 /// <returns>true when released successfully.</returns>
1926 /// <since_tizen> 4 </since_tizen>
1927 protected override bool ReleaseHandle()
1934 /// Disconnect all native signals
1936 /// <since_tizen> 5 </since_tizen>
1937 internal void DisconnectNativeSignals()
1939 if( _windowFocusChangedEventCallback != null )
1941 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1944 if( _rootLayerTouchDataCallback != null )
1946 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1949 if( _wheelEventCallback != null )
1951 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1954 if( _stageKeyCallbackDelegate != null )
1956 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1959 if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1961 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1964 if( _stageContextLostEventCallbackDelegate != null )
1966 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1969 if( _stageContextRegainedEventCallbackDelegate != null )
1971 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1974 if( _stageSceneCreatedEventCallbackDelegate != null )
1976 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1979 if( _windowResizedEventCallback != null )
1981 ResizedSignal().Disconnect(_windowResizedEventCallback);
1984 if( _windowFocusChangedEventCallback2 != null )
1986 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);