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="name">The Window title.</param>
75 /// <param name="isTransparent">Whether Window is transparent.</param>
76 /// <returns>A new Window.</returns>
77 /// <since_tizen> 6 </since_tizen>
78 [EditorBrowsable(EditorBrowsableState.Never)]
79 public Window(Rectangle windowPosition, string name, bool isTransparent) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
81 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85 /// Creates a new Window.<br />
86 /// This creates an extra window in addition to the default main window<br />
88 /// <param name="windowPosition">The position and size of the Window.</param>
89 /// <param name="name">The Window title.</param>
90 /// <returns>A new Window.</returns>
91 /// <since_tizen> 6 </since_tizen>
92 [EditorBrowsable(EditorBrowsableState.Never)]
93 public Window(Rectangle windowPosition, string name) : this(Interop.Window.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 /// Creates a new Window.<br />
100 /// This creates an extra window in addition to the default main window<br />
102 /// <param name="windowPosition">The position and size of the Window.</param>
103 /// <param name="name">The Window title.</param>
104 /// <param name="className">The Window class name.</param>
105 /// <param name="isTransparent">Whether Window is transparent.</param>
106 /// <returns>A new Window.</returns>
107 /// <since_tizen> 6 </since_tizen>
108 [EditorBrowsable(EditorBrowsableState.Never)]
109 public Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(Interop.Window.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
111 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115 /// Creates a new Window.<br />
116 /// This creates an extra window in addition to the default main window<br />
118 /// <param name="windowPosition">The position and size of the Window.</param>
119 /// <param name="name">The Window title.</param>
120 /// <param name="className">The Window class name.</param>
121 /// <returns>A new Window.</returns>
122 /// <since_tizen> 6 </since_tizen>
123 [EditorBrowsable(EditorBrowsableState.Never)]
124 public Window(Rectangle windowPosition, string name, string className) : this(Interop.Window.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
130 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
131 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
132 private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
133 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
134 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
135 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
136 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
137 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
138 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
141 /// FocusChanged event.
143 /// <since_tizen> 3 </since_tizen>
144 public event EventHandler<FocusChangedEventArgs> FocusChanged
148 if (_windowFocusChangedEventHandler == null)
150 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
151 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
154 _windowFocusChangedEventHandler += value;
158 _windowFocusChangedEventHandler -= value;
160 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
162 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
168 /// This event is emitted when the screen is touched and when the touch ends.<br />
169 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
170 /// then when the last finger is lifted.<br />
171 /// An interrupted event will also be emitted (if it occurs).<br />
173 /// <since_tizen> 3 </since_tizen>
174 public event EventHandler<TouchEventArgs> TouchEvent
178 if (_rootLayerTouchDataEventHandler == null)
180 _rootLayerTouchDataCallback = OnWindowTouch;
181 this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
183 _rootLayerTouchDataEventHandler += value;
187 _rootLayerTouchDataEventHandler -= value;
188 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
190 this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
196 /// This event is emitted when the wheel event is received.
198 /// <since_tizen> 3 </since_tizen>
199 public event EventHandler<WheelEventArgs> WheelEvent
203 if (_stageWheelHandler == null)
205 _wheelEventCallback = OnStageWheel;
206 this.StageWheelEventSignal().Connect(_wheelEventCallback);
208 _stageWheelHandler += value;
212 _stageWheelHandler -= value;
213 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
215 this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
221 /// This event is emitted when the key event is received.
223 /// <since_tizen> 3 </since_tizen>
224 public event EventHandler<KeyEventArgs> KeyEvent
228 if (_stageKeyHandler == null)
230 _stageKeyCallbackDelegate = OnStageKey;
231 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
233 _stageKeyHandler += value;
237 _stageKeyHandler -= value;
238 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
240 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
246 /// This event is emitted when the window resized.
248 /// <since_tizen> 3 </since_tizen>
249 public event EventHandler<ResizedEventArgs> Resized
253 if (_windowResizedEventHandler == null)
255 _windowResizedEventCallback = OnResized;
256 ResizedSignal().Connect(_windowResizedEventCallback);
259 _windowResizedEventHandler += value;
263 _windowResizedEventHandler -= value;
265 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
267 ResizedSignal().Disconnect(_windowResizedEventCallback);
273 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
275 /// <since_tizen> 3 </since_tizen>
276 /// Please do not use! this will be deprecated!
277 /// Instead please use FocusChanged.
278 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
280 "Window.Instance.FocusChanged = OnFocusChanged; " +
281 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
282 [EditorBrowsable(EditorBrowsableState.Never)]
283 public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
287 if (_windowFocusChangedEventHandler2 == null)
289 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
290 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
293 _windowFocusChangedEventHandler2 += value;
297 _windowFocusChangedEventHandler2 -= value;
299 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
301 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
307 /// ViewAdded will be triggered when the view added on Window
309 /// <since_tizen> 6 </since_tizen>
310 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
311 [EditorBrowsable(EditorBrowsableState.Never)]
312 public event EventHandler ViewAdded;
314 internal void SendViewAdded(View view)
316 ViewAdded?.Invoke(view, EventArgs.Empty);
319 internal event EventHandler EventProcessingFinished
323 if (_stageEventProcessingFinishedEventHandler == null)
325 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
326 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
328 _stageEventProcessingFinishedEventHandler += value;
333 _stageEventProcessingFinishedEventHandler -= value;
334 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
336 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
341 internal event EventHandler ContextLost
345 if (_stageContextLostEventHandler == null)
347 _stageContextLostEventCallbackDelegate = OnContextLost;
348 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
350 _stageContextLostEventHandler += value;
354 _stageContextLostEventHandler -= value;
355 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
357 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
362 internal event EventHandler ContextRegained
366 if (_stageContextRegainedEventHandler == null)
368 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
369 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
371 _stageContextRegainedEventHandler += value;
375 _stageContextRegainedEventHandler -= value;
376 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
378 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
383 internal event EventHandler SceneCreated
387 if (_stageSceneCreatedEventHandler == null)
389 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
390 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
392 _stageSceneCreatedEventHandler += value;
396 _stageSceneCreatedEventHandler -= value;
397 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
399 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
404 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
405 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
406 private event EventHandler<WheelEventArgs> _stageWheelHandler;
407 private event EventHandler<KeyEventArgs> _stageKeyHandler;
408 private event EventHandler _stageEventProcessingFinishedEventHandler;
409 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
410 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
413 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
415 /// <since_tizen> 3 </since_tizen>
416 public enum WindowOrientation
419 /// Portrait orientation. The height of the display area is greater than the width.
421 /// <since_tizen> 3 </since_tizen>
424 /// Landscape orientation. A wide view area is needed.
426 /// <since_tizen> 3 </since_tizen>
429 /// Portrait inverse orientation.
431 /// <since_tizen> 3 </since_tizen>
432 PortraitInverse = 180,
434 /// Landscape inverse orientation.
436 /// <since_tizen> 3 </since_tizen>
437 LandscapeInverse = 270
441 /// Enumeration for the key grab mode for platform-level APIs.
443 /// <since_tizen> 3 </since_tizen>
444 public enum KeyGrabMode
447 /// Grabs a key only when on the top of the grabbing-window stack mode.
451 /// Grabs a key together with the other client window(s) mode.
455 /// 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.
459 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
465 /// Enumeration for opacity of the indicator.
467 internal enum IndicatorBackgroundOpacity
475 /// Enumeration for visible mode of the indicator.
477 internal enum IndicatorVisibleMode
485 /// The stage instance property (read-only).<br />
486 /// Gets the current window.<br />
488 /// <since_tizen> 3 </since_tizen>
489 public static Window Instance
498 /// Gets or sets a window type.
500 /// <since_tizen> 3 </since_tizen>
501 public WindowType Type
505 WindowType ret = (WindowType)Interop.Window.GetType(swigCPtr);
506 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
511 Interop.Window.SetType(swigCPtr, (int)value);
512 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
517 /// Gets/Sets a window title.
519 /// <since_tizen> 4 </since_tizen>
528 _windowTitle = value;
529 SetClass(_windowTitle, "");
534 /// The rendering behavior of a Window.
536 /// <since_tizen> 5 </since_tizen>
537 public RenderingBehaviorType RenderingBehavior
541 return GetRenderingBehavior();
545 SetRenderingBehavior(value);
550 /// The window size property (read-only).
552 /// <since_tizen> 3 </since_tizen>
557 Size2D ret = GetSize();
563 /// The background color property.
565 /// <since_tizen> 3 </since_tizen>
566 public Color BackgroundColor
570 SetBackgroundColor(value);
574 Color ret = GetBackgroundColor();
580 /// The DPI property (read-only).<br />
581 /// Retrieves the DPI of the display device to which the Window is connected.<br />
583 /// <since_tizen> 3 </since_tizen>
593 /// The layer count property (read-only).<br />
594 /// Queries the number of on-Window layers.<br />
596 /// <since_tizen> 3 </since_tizen>
597 public uint LayerCount
601 return GetLayerCount();
606 /// Gets or sets a size of the window.
608 /// <since_tizen> 4 </since_tizen>
609 public Size2D WindowSize
613 return GetWindowSize();
617 SetWindowSize(value);
622 /// Gets or sets a position of the window.
624 /// <since_tizen> 4 </since_tizen>
625 public Position2D WindowPosition
629 return GetPosition();
636 internal static Vector4 DEFAULT_BACKGROUND_COLOR
640 global::System.IntPtr cPtr = Interop.Stage.Stage_DEFAULT_BACKGROUND_COLOR_get();
641 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
642 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
647 internal static Vector4 DEBUG_BACKGROUND_COLOR
651 global::System.IntPtr cPtr = Interop.Stage.Stage_DEBUG_BACKGROUND_COLOR_get();
652 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
653 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
658 internal List<Layer> LayersChildren
666 internal LayoutController LayoutController
670 return localController;
675 /// Feed a key-event into the window.
677 /// <param name="keyEvent">The key event to feed.</param>
678 /// <since_tizen> 4 </since_tizen>
679 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
680 public static void FeedKeyEvent(Key keyEvent)
682 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
683 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
687 /// Sets whether the window accepts a focus or not.
689 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
690 /// <since_tizen> 3 </since_tizen>
691 public void SetAcceptFocus(bool accept)
693 Interop.Window.SetAcceptFocus(swigCPtr, accept);
694 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
698 /// Returns whether the window accepts a focus or not.
700 /// <returns>True if the window accepts a focus, false otherwise.</returns>
701 /// <since_tizen> 3 </since_tizen>
702 public bool IsFocusAcceptable()
704 bool ret = Interop.Window.IsFocusAcceptable(swigCPtr);
705 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711 /// Shows the window if it is hidden.
713 /// <since_tizen> 3 </since_tizen>
716 Interop.Window.Show(swigCPtr);
717 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
721 /// Hides the window if it is showing.
723 /// <since_tizen> 3 </since_tizen>
726 Interop.Window.Hide(swigCPtr);
727 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
731 /// Retrieves whether the window is visible or not.
733 /// <returns>True if the window is visible.</returns>
734 /// <since_tizen> 3 </since_tizen>
735 public bool IsVisible()
737 bool temp = Interop.Window.IsVisible(swigCPtr);
738 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
743 /// Gets the count of supported auxiliary hints of the window.
745 /// <returns>The number of supported auxiliary hints.</returns>
746 /// <since_tizen> 3 </since_tizen>
747 public uint GetSupportedAuxiliaryHintCount()
749 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(swigCPtr);
750 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
755 /// Gets the supported auxiliary hint string of the window.
757 /// <param name="index">The index of the supported auxiliary hint lists.</param>
758 /// <returns>The auxiliary hint string of the index.</returns>
759 /// <since_tizen> 3 </since_tizen>
760 public string GetSupportedAuxiliaryHint(uint index)
762 string ret = Interop.Window.GetSupportedAuxiliaryHint(swigCPtr, index);
763 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
768 /// Creates an auxiliary hint of the window.
770 /// <param name="hint">The auxiliary hint string.</param>
771 /// <param name="value">The value string.</param>
772 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
773 /// <since_tizen> 3 </since_tizen>
774 public uint AddAuxiliaryHint(string hint, string value)
776 uint ret = Interop.Window.AddAuxiliaryHint(swigCPtr, hint, value);
777 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782 /// Removes an auxiliary hint of the window.
784 /// <param name="id">The ID of the auxiliary hint.</param>
785 /// <returns>True if no error occurred, false otherwise.</returns>
786 /// <since_tizen> 3 </since_tizen>
787 public bool RemoveAuxiliaryHint(uint id)
789 bool ret = Interop.Window.RemoveAuxiliaryHint(swigCPtr, id);
790 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
795 /// Changes a value of the auxiliary hint.
797 /// <param name="id">The auxiliary hint ID.</param>
798 /// <param name="value">The value string to be set.</param>
799 /// <returns>True if no error occurred, false otherwise.</returns>
800 /// <since_tizen> 3 </since_tizen>
801 public bool SetAuxiliaryHintValue(uint id, string value)
803 bool ret = Interop.Window.SetAuxiliaryHintValue(swigCPtr, id, value);
804 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
809 /// Gets a value of the auxiliary hint.
811 /// <param name="id">The auxiliary hint ID.</param>
812 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
813 /// <since_tizen> 3 </since_tizen>
814 public string GetAuxiliaryHintValue(uint id)
816 string ret = Interop.Window.GetAuxiliaryHintValue(swigCPtr, id);
817 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 /// Gets an ID of the auxiliary hint string.
824 /// <param name="hint">The auxiliary hint string.</param>
825 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
826 /// <since_tizen> 3 </since_tizen>
827 public uint GetAuxiliaryHintId(string hint)
829 uint ret = Interop.Window.GetAuxiliaryHintId(swigCPtr, hint);
830 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
835 /// Sets a region to accept input events.
837 /// <param name="inputRegion">The region to accept input events.</param>
838 /// <since_tizen> 3 </since_tizen>
839 public void SetInputRegion(Rectangle inputRegion)
841 Interop.Window.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
842 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
846 /// Sets a priority level for the specified notification window.
848 /// <param name="level">The notification window level.</param>
849 /// <returns>True if no error occurred, false otherwise.</returns>
850 /// <since_tizen> 3 </since_tizen>
851 public bool SetNotificationLevel(NotificationLevel level)
853 bool ret = Interop.Window.SetNotificationLevel(swigCPtr, (int)level);
854 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
859 /// Gets a priority level for the specified notification window.
861 /// <returns>The notification window level.</returns>
862 /// <since_tizen> 3 </since_tizen>
863 public NotificationLevel GetNotificationLevel()
865 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(swigCPtr);
866 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
871 /// Sets a transparent window's visual state to opaque. <br />
872 /// If a visual state of a transparent window is opaque, <br />
873 /// then the window manager could handle it as an opaque window when calculating visibility.
875 /// <param name="opaque">Whether the window's visual state is opaque.</param>
876 /// <remarks>This will have no effect on an opaque window. <br />
877 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
879 /// <since_tizen> 3 </since_tizen>
880 public void SetOpaqueState(bool opaque)
882 Interop.Window.SetOpaqueState(swigCPtr, opaque);
883 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
887 /// Returns whether a transparent window's visual state is opaque or not.
889 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
890 /// <remarks> The return value has no meaning on an opaque window. </remarks>
891 /// <since_tizen> 3 </since_tizen>
892 public bool IsOpaqueState()
894 bool ret = Interop.Window.IsOpaqueState(swigCPtr);
895 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
900 /// Sets a window's screen off mode.
902 /// <param name="screenOffMode">The screen mode.</param>
903 /// <returns>True if no error occurred, false otherwise.</returns>
904 /// <since_tizen> 4 </since_tizen>
905 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
907 bool ret = Interop.Window.SetScreenOffMode(swigCPtr, (int)screenOffMode);
908 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
913 /// Gets the screen mode of the window.
915 /// <returns>The screen off mode.</returns>
916 /// <since_tizen> 4 </since_tizen>
917 public ScreenOffMode GetScreenOffMode()
919 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(swigCPtr);
920 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
925 /// Sets preferred brightness of the window.
927 /// <param name="brightness">The preferred brightness (0 to 100).</param>
928 /// <returns>True if no error occurred, false otherwise.</returns>
929 /// <since_tizen> 3 </since_tizen>
930 public bool SetBrightness(int brightness)
932 bool ret = Interop.Window.SetBrightness(swigCPtr, brightness);
933 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
938 /// Gets the preferred brightness of the window.
940 /// <returns>The preferred brightness.</returns>
941 /// <since_tizen> 3 </since_tizen>
942 public int GetBrightness()
944 int ret = Interop.Window.GetBrightness(swigCPtr);
945 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
950 /// Sets the window name and the class string.
952 /// <param name="name">The name of the window.</param>
953 /// <param name="klass">The class of the window.</param>
954 /// <since_tizen> 4 </since_tizen>
955 public void SetClass(string name, string klass)
957 Interop.Window.Window_SetClass(swigCPtr, name, klass);
958 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
962 /// Raises the window to the top of the window stack.
964 /// <since_tizen> 3 </since_tizen>
967 Interop.Window.Window_Raise(swigCPtr);
968 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
972 /// Lowers the window to the bottom of the window stack.
974 /// <since_tizen> 3 </since_tizen>
977 Interop.Window.Window_Lower(swigCPtr);
978 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
982 /// Activates the window to the top of the window stack even it is iconified.
984 /// <since_tizen> 3 </since_tizen>
985 public void Activate()
987 Interop.Window.Window_Activate(swigCPtr);
988 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
992 /// Gets the default ( root ) layer.
994 /// <returns>The root layer.</returns>
995 /// <since_tizen> 3 </since_tizen>
996 public Layer GetDefaultLayer()
998 return this.GetRootLayer();
1002 /// Add a child view to window.
1004 /// <param name="view">the child should be added to the window.</param>
1005 /// <since_tizen> 3 </since_tizen>
1006 public void Add(View view)
1008 Interop.Actor.Actor_Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
1009 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1010 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
1011 view.InternalParent = this.GetRootLayer();
1015 /// Remove a child view from window.
1017 /// <param name="view">the child to be removed.</param>
1018 /// <since_tizen> 3 </since_tizen>
1019 public void Remove(View view)
1021 Interop.Actor.Actor_Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
1022 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
1023 view.InternalParent = null;
1027 /// Retrieves the layer at a specified depth.
1029 /// <param name="depth">The layer's depth index.</param>
1030 /// <returns>The layer found at the given depth.</returns>
1031 /// <since_tizen> 3 </since_tizen>
1032 public Layer GetLayer(uint depth)
1034 if (depth < LayersChildren?.Count)
1036 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1046 /// Keep rendering for at least the given amount of time.
1048 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1049 /// <since_tizen> 3 </since_tizen>
1050 public void KeepRendering(float durationSeconds)
1052 Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds);
1053 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1057 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1058 /// This function can be used for following example scenarios: <br />
1059 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1061 /// <param name="DaliKey">The key code to grab.</param>
1062 /// <returns>True if the grab succeeds.</returns>
1063 /// <since_tizen> 3 </since_tizen>
1064 public bool GrabKeyTopmost(int DaliKey)
1066 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1067 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1072 /// Ungrabs the key specified by a key for the window.<br />
1073 /// 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 />
1075 /// <param name="DaliKey">The key code to ungrab.</param>
1076 /// <returns>True if the ungrab succeeds.</returns>
1077 /// <since_tizen> 3 </since_tizen>
1078 public bool UngrabKeyTopmost(int DaliKey)
1080 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1081 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1086 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1087 /// Details: This function can be used for following example scenarios: <br />
1088 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1089 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1090 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1092 /// <param name="DaliKey">The key code to grab.</param>
1093 /// <param name="GrabMode">The grab mode for the key.</param>
1094 /// <returns>True if the grab succeeds.</returns>
1095 /// <since_tizen> 3 </since_tizen>
1096 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1098 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1099 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1104 /// Ungrabs the key specified by a key for a window.<br />
1105 /// 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 />
1107 /// <param name="DaliKey">The key code to ungrab.</param>
1108 /// <returns>True if the ungrab succeeds.</returns>
1109 /// <since_tizen> 3 </since_tizen>
1110 public bool UngrabKey(int DaliKey)
1112 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1118 /// Sets the keyboard repeat information.
1120 /// <param name="rate">The key repeat rate value in seconds.</param>
1121 /// <param name="delay">The key repeat delay value in seconds.</param>
1122 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1123 /// <since_tizen> 5 </since_tizen>
1124 public bool SetKeyboardRepeatInfo(float rate, float delay)
1126 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1132 /// Gets the keyboard repeat information.
1134 /// <param name="rate">The key repeat rate value in seconds.</param>
1135 /// <param name="delay">The key repeat delay value in seconds.</param>
1136 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1137 /// <since_tizen> 5 </since_tizen>
1138 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1140 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1146 /// Adds a layer to the stage.
1148 /// <param name="layer">Layer to add.</param>
1149 /// <since_tizen> 3 </since_tizen>
1150 public void AddLayer(Layer layer)
1152 Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1155 LayersChildren?.Add(layer);
1156 layer.SetWindow(this);
1160 /// Removes a layer from the stage.
1162 /// <param name="layer">Layer to remove.</param>
1163 /// <since_tizen> 3 </since_tizen>
1164 public void RemoveLayer(Layer layer)
1166 Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1167 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1169 LayersChildren?.Remove(layer);
1170 layer.SetWindow(null);
1174 /// Feeds a key event into the window.
1176 /// <param name="keyEvent">The key event to feed.</param>
1177 /// <since_tizen> 5 </since_tizen>
1178 public void FeedKey(Key keyEvent)
1180 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1185 /// Allows at least one more render, even when paused.
1186 /// The window should be shown, not minimised.
1188 /// <since_tizen> 4 </since_tizen>
1189 public void RenderOnce()
1191 Interop.Window.Window_RenderOnce(swigCPtr);
1192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1195 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1197 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1200 internal static Window GetCurrent()
1202 Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
1203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1207 internal static bool IsInstalled()
1209 bool ret = Interop.Stage.Stage_IsInstalled();
1210 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1214 internal WindowFocusSignalType WindowFocusChangedSignal()
1216 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1221 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1223 Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1227 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1229 Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1233 internal void RotateIndicator(Window.WindowOrientation orientation)
1235 Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
1236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1241 Interop.WindowInternal.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1245 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1247 Interop.WindowInternal.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1251 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1253 Interop.WindowInternal.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1254 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1257 internal Window.WindowOrientation GetPreferredOrientation()
1259 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.WindowInternal.Window_GetPreferredOrientation(swigCPtr);
1260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1264 internal DragAndDropDetector GetDragAndDropDetector()
1266 DragAndDropDetector ret = new DragAndDropDetector(Interop.WindowInternal.Window_GetDragAndDropDetector(swigCPtr), true);
1267 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1271 internal Any GetNativeHandle()
1273 Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1278 internal WindowFocusSignalType FocusChangedSignal()
1280 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1285 internal void Add(Layer layer)
1287 Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1288 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1290 LayersChildren?.Add(layer);
1291 layer.SetWindow(this);
1294 internal void Remove(Layer layer)
1296 Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1297 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1299 LayersChildren?.Remove(layer);
1300 layer.SetWindow(null);
1303 internal Vector2 GetSize()
1305 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1306 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1307 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1311 internal RenderTaskList GetRenderTaskList()
1313 RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1314 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1319 /// Queries the number of on-window layers.
1321 /// <returns>The number of layers.</returns>
1322 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1323 internal uint GetLayerCount()
1325 if (LayersChildren == null || LayersChildren.Count < 0)
1328 return (uint) LayersChildren.Count;
1331 internal Layer GetRootLayer()
1333 // Window.IsInstalled() is actually true only when called from event thread and
1334 // Core has been initialized, not when Stage is ready.
1335 if (_rootLayer == null && Window.IsInstalled())
1337 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1339 LayersChildren?.Add(_rootLayer);
1340 _rootLayer.SetWindow(this);
1345 internal void SetBackgroundColor(Vector4 color)
1347 Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1348 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1351 internal Vector4 GetBackgroundColor()
1353 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1354 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1358 internal Vector2 GetDpi()
1360 Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1361 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1365 internal ObjectRegistry GetObjectRegistry()
1367 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1368 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1372 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1374 Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1378 internal RenderingBehaviorType GetRenderingBehavior()
1380 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1381 if (NDalicPINVOKE.SWIGPendingException.Pending)
1382 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1386 internal KeyEventSignal KeyEventSignal()
1388 KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false);
1389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1393 internal VoidSignal EventProcessingFinishedSignal()
1395 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1396 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1400 internal TouchSignal TouchSignal()
1402 TouchSignal ret = new TouchSignal(Interop.Window.TouchSignal(swigCPtr), false);
1403 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1407 internal TouchDataSignal TouchDataSignal()
1409 TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1410 if (NDalicPINVOKE.SWIGPendingException.Pending)
1411 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1415 internal VoidSignal ContextLostSignal()
1417 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false);
1418 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1422 internal VoidSignal ContextRegainedSignal()
1424 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextRegainedSignal(stageCPtr), false);
1425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1429 internal VoidSignal SceneCreatedSignal()
1431 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false);
1432 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1436 internal ResizedSignal ResizedSignal()
1438 ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false);
1439 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1443 internal void SetWindowSize(Size2D size)
1445 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1446 Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1450 // Resetting Window size should request a relayout of the tree.
1453 internal Size2D GetWindowSize()
1455 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1456 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1458 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1462 internal void SetPosition(Position2D position)
1464 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1465 Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1467 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1469 // Setting Position of the window should request a relayout of the tree.
1473 internal Position2D GetPosition()
1475 var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1476 Position2D ret = new Position2D(val.GetX(), val.GetY());
1478 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1482 internal void SetPositionSize(Rectangle positionSize)
1484 Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1486 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1488 // Setting Position of the window should request a relayout of the tree.
1493 /// Sets whether the window is transparent or not.
1495 /// <param name="transparent">Whether the window is transparent or not.</param>
1496 /// <since_tizen> 5 </since_tizen>
1497 public void SetTransparency(bool transparent) {
1498 Interop.Window.SetTransparency(swigCPtr, transparent);
1499 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1501 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1506 /// Dispose for Window
1508 [EditorBrowsable(EditorBrowsableState.Never)]
1509 protected override void Dispose(DisposeTypes type)
1516 if (type == DisposeTypes.Explicit)
1519 //Release your own managed resources here.
1520 //You should release all of your own disposable objects here.
1524 this.DisconnectNativeSignals();
1526 //Release your own unmanaged resources here.
1527 //You should not access any managed member here except static instance.
1528 //because the execution order of Finalizes is non-deterministic.
1530 if (swigCPtr.Handle != global::System.IntPtr.Zero)
1534 swigCMemOwn = false;
1535 Interop.Window.delete_Window(swigCPtr);
1537 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1543 internal System.IntPtr GetNativeWindowHandler()
1545 System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1546 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1550 private void OnWindowFocusedChanged(bool focusGained)
1552 FocusChangedEventArgs e = new FocusChangedEventArgs();
1554 e.FocusGained = focusGained;
1556 if (_windowFocusChangedEventHandler != null)
1558 _windowFocusChangedEventHandler(this, e);
1562 private StageWheelSignal WheelEventSignal()
1564 StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false);
1565 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1569 private WheelSignal StageWheelEventSignal()
1571 WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1572 if (NDalicPINVOKE.SWIGPendingException.Pending)
1573 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1577 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1579 if (touchData == global::System.IntPtr.Zero)
1581 NUILog.Error("touchData should not be null!");
1585 TouchEventArgs e = new TouchEventArgs();
1587 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1589 if (_rootLayerTouchDataEventHandler != null)
1591 _rootLayerTouchDataEventHandler(this, e);
1596 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1598 if (wheelEvent == global::System.IntPtr.Zero)
1600 NUILog.Error("wheelEvent should not be null!");
1604 WheelEventArgs e = new WheelEventArgs();
1606 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1608 if (_stageWheelHandler != null)
1610 _stageWheelHandler(this, e);
1615 // Callback for Stage KeyEventsignal
1616 private void OnStageKey(IntPtr data)
1618 KeyEventArgs e = new KeyEventArgs();
1619 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1622 if (_stageKeyHandler != null)
1624 //here we send all data to user event handlers
1625 _stageKeyHandler(this, e);
1629 // Callback for Stage EventProcessingFinishedSignal
1630 private void OnEventProcessingFinished()
1632 if (_stageEventProcessingFinishedEventHandler != null)
1634 _stageEventProcessingFinishedEventHandler(this, null);
1638 // Callback for Stage ContextLostSignal
1639 private void OnContextLost()
1641 if (_stageContextLostEventHandler != null)
1643 _stageContextLostEventHandler(this, null);
1647 // Callback for Stage ContextRegainedSignal
1648 private void OnContextRegained()
1650 if (_stageContextRegainedEventHandler != null)
1652 _stageContextRegainedEventHandler(this, null);
1656 // Callback for Stage SceneCreatedSignal
1657 private void OnSceneCreated()
1659 if (_stageSceneCreatedEventHandler != null)
1661 _stageSceneCreatedEventHandler(this, null);
1665 private void OnResized(IntPtr windowSize)
1667 ResizedEventArgs e = new ResizedEventArgs();
1668 var val = new Uint16Pair(windowSize, false);
1669 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1672 if (_windowResizedEventHandler != null)
1674 _windowResizedEventHandler(this, e);
1678 private void OnWindowFocusedChanged2(bool focusGained)
1680 FocusChangedEventArgs e = new FocusChangedEventArgs();
1682 e.FocusGained = focusGained;
1684 if (_windowFocusChangedEventHandler2 != null)
1686 _windowFocusChangedEventHandler2(this, e);
1691 /// The focus changed event argument.
1693 /// <since_tizen> 3 </since_tizen>
1694 public class FocusChangedEventArgs : EventArgs
1697 /// FocusGained flag.
1699 /// <since_tizen> 3 </since_tizen>
1700 public bool FocusGained
1708 /// The touch event argument.
1710 /// <since_tizen> 3 </since_tizen>
1711 public class TouchEventArgs : EventArgs
1713 private Touch _touch;
1718 /// <since_tizen> 3 </since_tizen>
1733 /// Wheel event arguments.
1735 /// <since_tizen> 3 </since_tizen>
1736 public class WheelEventArgs : EventArgs
1738 private Wheel _wheel;
1743 /// <since_tizen> 3 </since_tizen>
1758 /// Key event arguments.
1760 /// <since_tizen> 3 </since_tizen>
1761 public class KeyEventArgs : EventArgs
1768 /// <since_tizen> 3 </since_tizen>
1783 /// Sets position and size of the window. This API guarantees that
1784 /// both moving and resizing of window will appear on the screen at once.
1786 [EditorBrowsable(EditorBrowsableState.Never)]
1787 public Rectangle WindowPositionSize
1791 Position2D position = GetPosition();
1792 Size2D size = GetSize();
1793 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1798 SetPositionSize(value);
1803 /// Feeds a key event into the window.
1804 /// This resized event arguments.
1806 /// <since_tizen> 3 </since_tizen>
1807 public class ResizedEventArgs : EventArgs
1812 /// This window size.
1814 /// <since_tizen> 4 </since_tizen>
1815 public Size2D WindowSize
1823 _windowSize = value;
1829 /// Please do not use! this will be deprecated
1831 /// <since_tizen> 3 </since_tizen>
1832 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1834 "Window.Instance.FocusChanged = OnFocusChanged; " +
1835 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1836 [EditorBrowsable(EditorBrowsableState.Never)]
1837 public class WindowFocusChangedEventArgs : EventArgs
1840 /// Please do not use! this will be deprecated
1842 /// <since_tizen> 3 </since_tizen>
1843 public bool FocusGained
1851 /// Contains and encapsulates Native Window handle.
1853 /// <since_tizen> 4 </since_tizen>
1854 public class SafeNativeWindowHandle : SafeHandle
1857 /// Contructor, Native window handle is set to handle.
1859 /// <since_tizen> 4 </since_tizen>
1860 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1862 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1865 /// Null check if the handle is valid or not.
1867 /// <since_tizen> 4 </since_tizen>
1868 public override bool IsInvalid
1872 return this.handle == IntPtr.Zero;
1876 /// Release handle itself.
1878 /// <returns>true when released successfully.</returns>
1879 /// <since_tizen> 4 </since_tizen>
1880 protected override bool ReleaseHandle()
1887 /// Disconnect all native signals
1889 /// <since_tizen> 5 </since_tizen>
1890 internal void DisconnectNativeSignals()
1892 if( _windowFocusChangedEventCallback != null )
1894 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1897 if( _rootLayerTouchDataCallback != null )
1899 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1902 if( _wheelEventCallback != null )
1904 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1907 if( _stageKeyCallbackDelegate != null )
1909 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1912 if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1914 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1917 if( _stageContextLostEventCallbackDelegate != null )
1919 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1922 if( _stageContextRegainedEventCallbackDelegate != null )
1924 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1927 if( _stageSceneCreatedEventCallbackDelegate != null )
1929 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1932 if( _windowResizedEventCallback != null )
1934 ResizedSignal().Disconnect(_windowResizedEventCallback);
1937 if( _windowFocusChangedEventCallback2 != null )
1939 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);