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();
83 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
84 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
85 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
86 private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
87 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
88 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
89 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
90 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
91 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
92 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
95 /// FocusChanged event.
97 /// <since_tizen> 3 </since_tizen>
98 public event EventHandler<FocusChangedEventArgs> FocusChanged
102 if (_windowFocusChangedEventHandler == null)
104 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
105 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
108 _windowFocusChangedEventHandler += value;
112 _windowFocusChangedEventHandler -= value;
114 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
116 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
122 /// This event is emitted when the screen is touched and when the touch ends.<br />
123 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
124 /// then when the last finger is lifted.<br />
125 /// An interrupted event will also be emitted (if it occurs).<br />
127 /// <since_tizen> 3 </since_tizen>
128 public event EventHandler<TouchEventArgs> TouchEvent
132 if (_rootLayerTouchDataEventHandler == null)
134 _rootLayerTouchDataCallback = OnWindowTouch;
135 this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
137 _rootLayerTouchDataEventHandler += value;
141 _rootLayerTouchDataEventHandler -= value;
142 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
144 this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
150 /// This event is emitted when the wheel event is received.
152 /// <since_tizen> 3 </since_tizen>
153 public event EventHandler<WheelEventArgs> WheelEvent
157 if (_stageWheelHandler == null)
159 _wheelEventCallback = OnStageWheel;
160 this.StageWheelEventSignal().Connect(_wheelEventCallback);
162 _stageWheelHandler += value;
166 _stageWheelHandler -= value;
167 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
169 this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
175 /// This event is emitted when the key event is received.
177 /// <since_tizen> 3 </since_tizen>
178 public event EventHandler<KeyEventArgs> KeyEvent
182 if (_stageKeyHandler == null)
184 _stageKeyCallbackDelegate = OnStageKey;
185 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
187 _stageKeyHandler += value;
191 _stageKeyHandler -= value;
192 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
194 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
200 /// This event is emitted when the window resized.
202 /// <since_tizen> 3 </since_tizen>
203 public event EventHandler<ResizedEventArgs> Resized
207 if (_windowResizedEventHandler == null)
209 _windowResizedEventCallback = OnResized;
210 ResizedSignal().Connect(_windowResizedEventCallback);
213 _windowResizedEventHandler += value;
217 _windowResizedEventHandler -= value;
219 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
221 ResizedSignal().Disconnect(_windowResizedEventCallback);
227 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
229 /// <since_tizen> 3 </since_tizen>
230 /// Please do not use! this will be deprecated!
231 /// Instead please use FocusChanged.
232 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
234 "Window.Instance.FocusChanged = OnFocusChanged; " +
235 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
236 [EditorBrowsable(EditorBrowsableState.Never)]
237 public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
241 if (_windowFocusChangedEventHandler2 == null)
243 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
244 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
247 _windowFocusChangedEventHandler2 += value;
251 _windowFocusChangedEventHandler2 -= value;
253 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
255 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
261 /// ViewAdded will be triggered when the view added on Window
263 /// <since_tizen> 6 </since_tizen>
264 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
265 [EditorBrowsable(EditorBrowsableState.Never)]
266 public event EventHandler ViewAdded;
268 internal void SendViewAdded(View view)
270 ViewAdded?.Invoke(view, EventArgs.Empty);
273 internal event EventHandler EventProcessingFinished
277 if (_stageEventProcessingFinishedEventHandler == null)
279 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
280 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
282 _stageEventProcessingFinishedEventHandler += value;
287 _stageEventProcessingFinishedEventHandler -= value;
288 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
290 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
295 internal event EventHandler ContextLost
299 if (_stageContextLostEventHandler == null)
301 _stageContextLostEventCallbackDelegate = OnContextLost;
302 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
304 _stageContextLostEventHandler += value;
308 _stageContextLostEventHandler -= value;
309 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
311 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
316 internal event EventHandler ContextRegained
320 if (_stageContextRegainedEventHandler == null)
322 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
323 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
325 _stageContextRegainedEventHandler += value;
329 _stageContextRegainedEventHandler -= value;
330 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
332 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
337 internal event EventHandler SceneCreated
341 if (_stageSceneCreatedEventHandler == null)
343 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
344 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
346 _stageSceneCreatedEventHandler += value;
350 _stageSceneCreatedEventHandler -= value;
351 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
353 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
358 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
359 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
360 private event EventHandler<WheelEventArgs> _stageWheelHandler;
361 private event EventHandler<KeyEventArgs> _stageKeyHandler;
362 private event EventHandler _stageEventProcessingFinishedEventHandler;
363 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
364 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
367 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
369 /// <since_tizen> 3 </since_tizen>
370 public enum WindowOrientation
373 /// Portrait orientation. The height of the display area is greater than the width.
375 /// <since_tizen> 3 </since_tizen>
378 /// Landscape orientation. A wide view area is needed.
380 /// <since_tizen> 3 </since_tizen>
383 /// Portrait inverse orientation.
385 /// <since_tizen> 3 </since_tizen>
386 PortraitInverse = 180,
388 /// Landscape inverse orientation.
390 /// <since_tizen> 3 </since_tizen>
391 LandscapeInverse = 270
395 /// Enumeration for the key grab mode for platform-level APIs.
397 /// <since_tizen> 3 </since_tizen>
398 public enum KeyGrabMode
401 /// Grabs a key only when on the top of the grabbing-window stack mode.
405 /// Grabs a key together with the other client window(s) mode.
409 /// 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.
413 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
419 /// Enumeration for opacity of the indicator.
421 internal enum IndicatorBackgroundOpacity
429 /// Enumeration for visible mode of the indicator.
431 internal enum IndicatorVisibleMode
439 /// The stage instance property (read-only).<br />
440 /// Gets the current window.<br />
442 /// <since_tizen> 3 </since_tizen>
443 public static Window Instance
452 /// Gets or sets a window type.
454 /// <since_tizen> 3 </since_tizen>
455 public WindowType Type
459 WindowType ret = (WindowType)Interop.Window.GetType(swigCPtr);
460 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
465 Interop.Window.SetType(swigCPtr, (int)value);
466 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
471 /// Gets/Sets a window title.
473 /// <since_tizen> 4 </since_tizen>
482 _windowTitle = value;
483 SetClass(_windowTitle, "");
488 /// The rendering behavior of a Window.
490 /// <since_tizen> 5 </since_tizen>
491 public RenderingBehaviorType RenderingBehavior
495 return GetRenderingBehavior();
499 SetRenderingBehavior(value);
504 /// The window size property (read-only).
506 /// <since_tizen> 3 </since_tizen>
511 Size2D ret = GetSize();
517 /// The background color property.
519 /// <since_tizen> 3 </since_tizen>
520 public Color BackgroundColor
524 SetBackgroundColor(value);
528 Color ret = GetBackgroundColor();
534 /// The DPI property (read-only).<br />
535 /// Retrieves the DPI of the display device to which the Window is connected.<br />
537 /// <since_tizen> 3 </since_tizen>
547 /// The layer count property (read-only).<br />
548 /// Queries the number of on-Window layers.<br />
550 /// <since_tizen> 3 </since_tizen>
551 public uint LayerCount
555 return GetLayerCount();
560 /// Gets or sets a size of the window.
562 /// <since_tizen> 4 </since_tizen>
563 public Size2D WindowSize
567 return GetWindowSize();
571 SetWindowSize(value);
576 /// Gets or sets a position of the window.
578 /// <since_tizen> 4 </since_tizen>
579 public Position2D WindowPosition
583 return GetPosition();
590 internal static Vector4 DEFAULT_BACKGROUND_COLOR
594 global::System.IntPtr cPtr = Interop.Stage.Stage_DEFAULT_BACKGROUND_COLOR_get();
595 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
596 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
601 internal static Vector4 DEBUG_BACKGROUND_COLOR
605 global::System.IntPtr cPtr = Interop.Stage.Stage_DEBUG_BACKGROUND_COLOR_get();
606 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
607 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612 internal List<Layer> LayersChildren
620 internal LayoutController LayoutController
624 return localController;
629 /// Feed a key-event into the window.
631 /// <param name="keyEvent">The key event to feed.</param>
632 /// <since_tizen> 4 </since_tizen>
633 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
634 public static void FeedKeyEvent(Key keyEvent)
636 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
637 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
641 /// Sets whether the window accepts a focus or not.
643 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
644 /// <since_tizen> 3 </since_tizen>
645 public void SetAcceptFocus(bool accept)
647 Interop.Window.SetAcceptFocus(swigCPtr, accept);
648 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
652 /// Returns whether the window accepts a focus or not.
654 /// <returns>True if the window accepts a focus, false otherwise.</returns>
655 /// <since_tizen> 3 </since_tizen>
656 public bool IsFocusAcceptable()
658 bool ret = Interop.Window.IsFocusAcceptable(swigCPtr);
659 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665 /// Shows the window if it is hidden.
667 /// <since_tizen> 3 </since_tizen>
670 Interop.Window.Show(swigCPtr);
671 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
675 /// Hides the window if it is showing.
677 /// <since_tizen> 3 </since_tizen>
680 Interop.Window.Hide(swigCPtr);
681 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
685 /// Retrieves whether the window is visible or not.
687 /// <returns>True if the window is visible.</returns>
688 /// <since_tizen> 3 </since_tizen>
689 public bool IsVisible()
691 bool temp = Interop.Window.IsVisible(swigCPtr);
692 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
697 /// Gets the count of supported auxiliary hints of the window.
699 /// <returns>The number of supported auxiliary hints.</returns>
700 /// <since_tizen> 3 </since_tizen>
701 public uint GetSupportedAuxiliaryHintCount()
703 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(swigCPtr);
704 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
709 /// Gets the supported auxiliary hint string of the window.
711 /// <param name="index">The index of the supported auxiliary hint lists.</param>
712 /// <returns>The auxiliary hint string of the index.</returns>
713 /// <since_tizen> 3 </since_tizen>
714 public string GetSupportedAuxiliaryHint(uint index)
716 string ret = Interop.Window.GetSupportedAuxiliaryHint(swigCPtr, index);
717 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
722 /// Creates an auxiliary hint of the window.
724 /// <param name="hint">The auxiliary hint string.</param>
725 /// <param name="value">The value string.</param>
726 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
727 /// <since_tizen> 3 </since_tizen>
728 public uint AddAuxiliaryHint(string hint, string value)
730 uint ret = Interop.Window.AddAuxiliaryHint(swigCPtr, hint, value);
731 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
736 /// Removes an auxiliary hint of the window.
738 /// <param name="id">The ID of the auxiliary hint.</param>
739 /// <returns>True if no error occurred, false otherwise.</returns>
740 /// <since_tizen> 3 </since_tizen>
741 public bool RemoveAuxiliaryHint(uint id)
743 bool ret = Interop.Window.RemoveAuxiliaryHint(swigCPtr, id);
744 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
749 /// Changes a value of the auxiliary hint.
751 /// <param name="id">The auxiliary hint ID.</param>
752 /// <param name="value">The value string to be set.</param>
753 /// <returns>True if no error occurred, false otherwise.</returns>
754 /// <since_tizen> 3 </since_tizen>
755 public bool SetAuxiliaryHintValue(uint id, string value)
757 bool ret = Interop.Window.SetAuxiliaryHintValue(swigCPtr, id, value);
758 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763 /// Gets a value of the auxiliary hint.
765 /// <param name="id">The auxiliary hint ID.</param>
766 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
767 /// <since_tizen> 3 </since_tizen>
768 public string GetAuxiliaryHintValue(uint id)
770 string ret = Interop.Window.GetAuxiliaryHintValue(swigCPtr, id);
771 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
776 /// Gets an ID of the auxiliary hint string.
778 /// <param name="hint">The auxiliary hint string.</param>
779 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
780 /// <since_tizen> 3 </since_tizen>
781 public uint GetAuxiliaryHintId(string hint)
783 uint ret = Interop.Window.GetAuxiliaryHintId(swigCPtr, hint);
784 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
789 /// Sets a region to accept input events.
791 /// <param name="inputRegion">The region to accept input events.</param>
792 /// <since_tizen> 3 </since_tizen>
793 public void SetInputRegion(Rectangle inputRegion)
795 Interop.Window.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
796 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
800 /// Sets a priority level for the specified notification window.
802 /// <param name="level">The notification window level.</param>
803 /// <returns>True if no error occurred, false otherwise.</returns>
804 /// <since_tizen> 3 </since_tizen>
805 public bool SetNotificationLevel(NotificationLevel level)
807 bool ret = Interop.Window.SetNotificationLevel(swigCPtr, (int)level);
808 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
813 /// Gets a priority level for the specified notification window.
815 /// <returns>The notification window level.</returns>
816 /// <since_tizen> 3 </since_tizen>
817 public NotificationLevel GetNotificationLevel()
819 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(swigCPtr);
820 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
825 /// Sets a transparent window's visual state to opaque. <br />
826 /// If a visual state of a transparent window is opaque, <br />
827 /// then the window manager could handle it as an opaque window when calculating visibility.
829 /// <param name="opaque">Whether the window's visual state is opaque.</param>
830 /// <remarks>This will have no effect on an opaque window. <br />
831 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
833 /// <since_tizen> 3 </since_tizen>
834 public void SetOpaqueState(bool opaque)
836 Interop.Window.SetOpaqueState(swigCPtr, opaque);
837 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
841 /// Returns whether a transparent window's visual state is opaque or not.
843 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
844 /// <remarks> The return value has no meaning on an opaque window. </remarks>
845 /// <since_tizen> 3 </since_tizen>
846 public bool IsOpaqueState()
848 bool ret = Interop.Window.IsOpaqueState(swigCPtr);
849 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
854 /// Sets a window's screen off mode.
856 /// <param name="screenOffMode">The screen mode.</param>
857 /// <returns>True if no error occurred, false otherwise.</returns>
858 /// <since_tizen> 4 </since_tizen>
859 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
861 bool ret = Interop.Window.SetScreenOffMode(swigCPtr, (int)screenOffMode);
862 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
867 /// Gets the screen mode of the window.
869 /// <returns>The screen off mode.</returns>
870 /// <since_tizen> 4 </since_tizen>
871 public ScreenOffMode GetScreenOffMode()
873 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(swigCPtr);
874 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
879 /// Sets preferred brightness of the window.
881 /// <param name="brightness">The preferred brightness (0 to 100).</param>
882 /// <returns>True if no error occurred, false otherwise.</returns>
883 /// <since_tizen> 3 </since_tizen>
884 public bool SetBrightness(int brightness)
886 bool ret = Interop.Window.SetBrightness(swigCPtr, brightness);
887 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
892 /// Gets the preferred brightness of the window.
894 /// <returns>The preferred brightness.</returns>
895 /// <since_tizen> 3 </since_tizen>
896 public int GetBrightness()
898 int ret = Interop.Window.GetBrightness(swigCPtr);
899 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
904 /// Sets the window name and the class string.
906 /// <param name="name">The name of the window.</param>
907 /// <param name="klass">The class of the window.</param>
908 /// <since_tizen> 4 </since_tizen>
909 public void SetClass(string name, string klass)
911 Interop.Window.Window_SetClass(swigCPtr, name, klass);
912 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
916 /// Raises the window to the top of the window stack.
918 /// <since_tizen> 3 </since_tizen>
921 Interop.Window.Window_Raise(swigCPtr);
922 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
926 /// Lowers the window to the bottom of the window stack.
928 /// <since_tizen> 3 </since_tizen>
931 Interop.Window.Window_Lower(swigCPtr);
932 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
936 /// Activates the window to the top of the window stack even it is iconified.
938 /// <since_tizen> 3 </since_tizen>
939 public void Activate()
941 Interop.Window.Window_Activate(swigCPtr);
942 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
946 /// Gets the default ( root ) layer.
948 /// <returns>The root layer.</returns>
949 /// <since_tizen> 3 </since_tizen>
950 public Layer GetDefaultLayer()
952 return this.GetRootLayer();
956 /// Add a child view to window.
958 /// <param name="view">the child should be added to the window.</param>
959 /// <since_tizen> 3 </since_tizen>
960 public void Add(View view)
962 Interop.Actor.Actor_Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
963 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
964 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
965 view.InternalParent = this.GetRootLayer();
969 /// Remove a child view from window.
971 /// <param name="view">the child to be removed.</param>
972 /// <since_tizen> 3 </since_tizen>
973 public void Remove(View view)
975 Interop.Actor.Actor_Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
976 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
977 view.InternalParent = null;
981 /// Retrieves the layer at a specified depth.
983 /// <param name="depth">The layer's depth index.</param>
984 /// <returns>The layer found at the given depth.</returns>
985 /// <since_tizen> 3 </since_tizen>
986 public Layer GetLayer(uint depth)
988 if (depth < LayersChildren?.Count)
990 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1000 /// Destroy the window immediately.
1002 [EditorBrowsable(EditorBrowsableState.Never)]
1003 public void Destroy()
1009 /// Keep rendering for at least the given amount of time.
1011 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1012 /// <since_tizen> 3 </since_tizen>
1013 public void KeepRendering(float durationSeconds)
1015 Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds);
1016 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1020 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1021 /// This function can be used for following example scenarios: <br />
1022 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1024 /// <param name="DaliKey">The key code to grab.</param>
1025 /// <returns>True if the grab succeeds.</returns>
1026 /// <since_tizen> 3 </since_tizen>
1027 public bool GrabKeyTopmost(int DaliKey)
1029 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1030 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1035 /// Ungrabs the key specified by a key for the window.<br />
1036 /// 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 />
1038 /// <param name="DaliKey">The key code to ungrab.</param>
1039 /// <returns>True if the ungrab succeeds.</returns>
1040 /// <since_tizen> 3 </since_tizen>
1041 public bool UngrabKeyTopmost(int DaliKey)
1043 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1044 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1049 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1050 /// Details: This function can be used for following example scenarios: <br />
1051 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1052 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1053 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1055 /// <param name="DaliKey">The key code to grab.</param>
1056 /// <param name="GrabMode">The grab mode for the key.</param>
1057 /// <returns>True if the grab succeeds.</returns>
1058 /// <since_tizen> 3 </since_tizen>
1059 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1061 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1062 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1067 /// Ungrabs the key specified by a key for a window.<br />
1068 /// 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 />
1070 /// <param name="DaliKey">The key code to ungrab.</param>
1071 /// <returns>True if the ungrab succeeds.</returns>
1072 /// <since_tizen> 3 </since_tizen>
1073 public bool UngrabKey(int DaliKey)
1075 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1076 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1081 /// Sets the keyboard repeat information.
1083 /// <param name="rate">The key repeat rate value in seconds.</param>
1084 /// <param name="delay">The key repeat delay value in seconds.</param>
1085 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1086 /// <since_tizen> 5 </since_tizen>
1087 public bool SetKeyboardRepeatInfo(float rate, float delay)
1089 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1090 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1095 /// Gets the keyboard repeat information.
1097 /// <param name="rate">The key repeat rate value in seconds.</param>
1098 /// <param name="delay">The key repeat delay value in seconds.</param>
1099 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1100 /// <since_tizen> 5 </since_tizen>
1101 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1103 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1109 /// Adds a layer to the stage.
1111 /// <param name="layer">Layer to add.</param>
1112 /// <since_tizen> 3 </since_tizen>
1113 public void AddLayer(Layer layer)
1115 Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1118 LayersChildren?.Add(layer);
1119 layer.SetWindow(this);
1123 /// Removes a layer from the stage.
1125 /// <param name="layer">Layer to remove.</param>
1126 /// <since_tizen> 3 </since_tizen>
1127 public void RemoveLayer(Layer layer)
1129 Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1132 LayersChildren?.Remove(layer);
1133 layer.SetWindow(null);
1137 /// Feeds a key event into the window.
1139 /// <param name="keyEvent">The key event to feed.</param>
1140 /// <since_tizen> 5 </since_tizen>
1141 public void FeedKey(Key keyEvent)
1143 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1148 /// Allows at least one more render, even when paused.
1149 /// The window should be shown, not minimised.
1151 /// <since_tizen> 4 </since_tizen>
1152 public void RenderOnce()
1154 Interop.Window.Window_RenderOnce(swigCPtr);
1155 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1158 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1160 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1163 internal static Window GetCurrent()
1165 Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
1166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1170 internal static bool IsInstalled()
1172 bool ret = Interop.Stage.Stage_IsInstalled();
1173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1177 internal WindowFocusSignalType WindowFocusChangedSignal()
1179 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1184 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1186 Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1187 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1190 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1192 Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1193 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1196 internal void RotateIndicator(Window.WindowOrientation orientation)
1198 Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
1199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1202 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1204 Interop.WindowInternal.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1208 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1210 Interop.WindowInternal.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1211 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1214 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1216 Interop.WindowInternal.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1220 internal Window.WindowOrientation GetPreferredOrientation()
1222 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.WindowInternal.Window_GetPreferredOrientation(swigCPtr);
1223 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1227 internal Any GetNativeHandle()
1229 Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1234 internal WindowFocusSignalType FocusChangedSignal()
1236 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1237 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1241 internal void Add(Layer layer)
1243 Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1246 LayersChildren?.Add(layer);
1247 layer.SetWindow(this);
1250 internal void Remove(Layer layer)
1252 Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1255 LayersChildren?.Remove(layer);
1256 layer.SetWindow(null);
1259 internal Vector2 GetSize()
1261 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1262 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1267 internal RenderTaskList GetRenderTaskList()
1269 RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1275 /// Queries the number of on-window layers.
1277 /// <returns>The number of layers.</returns>
1278 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1279 internal uint GetLayerCount()
1281 if (LayersChildren == null || LayersChildren.Count < 0)
1284 return (uint) LayersChildren.Count;
1287 internal Layer GetRootLayer()
1289 // Window.IsInstalled() is actually true only when called from event thread and
1290 // Core has been initialized, not when Stage is ready.
1291 if (_rootLayer == null && Window.IsInstalled())
1293 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1295 LayersChildren?.Add(_rootLayer);
1296 _rootLayer.SetWindow(this);
1301 internal void SetBackgroundColor(Vector4 color)
1303 Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1307 internal Vector4 GetBackgroundColor()
1309 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1310 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1314 internal Vector2 GetDpi()
1316 Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1317 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1321 internal ObjectRegistry GetObjectRegistry()
1323 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1328 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1330 Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1334 internal RenderingBehaviorType GetRenderingBehavior()
1336 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1337 if (NDalicPINVOKE.SWIGPendingException.Pending)
1338 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1342 internal KeyEventSignal KeyEventSignal()
1344 KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false);
1345 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1349 internal VoidSignal EventProcessingFinishedSignal()
1351 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1356 internal TouchSignal TouchSignal()
1358 TouchSignal ret = new TouchSignal(Interop.Window.TouchSignal(swigCPtr), false);
1359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1363 internal TouchDataSignal TouchDataSignal()
1365 TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1366 if (NDalicPINVOKE.SWIGPendingException.Pending)
1367 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1371 internal VoidSignal ContextLostSignal()
1373 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false);
1374 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1378 internal VoidSignal ContextRegainedSignal()
1380 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextRegainedSignal(stageCPtr), false);
1381 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1385 internal VoidSignal SceneCreatedSignal()
1387 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false);
1388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1392 internal ResizedSignal ResizedSignal()
1394 ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false);
1395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1399 internal void SetWindowSize(Size2D size)
1401 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1402 Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1404 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1406 // Resetting Window size should request a relayout of the tree.
1409 internal Size2D GetWindowSize()
1411 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1412 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1414 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1418 internal void SetPosition(Position2D position)
1420 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1421 Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1423 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1425 // Setting Position of the window should request a relayout of the tree.
1429 internal Position2D GetPosition()
1431 var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1432 Position2D ret = new Position2D(val.GetX(), val.GetY());
1434 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1438 internal void SetPositionSize(Rectangle positionSize)
1440 Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1442 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1444 // Setting Position of the window should request a relayout of the tree.
1449 /// Sets whether the window is transparent or not.
1451 /// <param name="transparent">Whether the window is transparent or not.</param>
1452 /// <since_tizen> 5 </since_tizen>
1453 public void SetTransparency(bool transparent) {
1454 Interop.Window.SetTransparency(swigCPtr, transparent);
1455 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1457 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1462 /// Dispose for Window
1464 [EditorBrowsable(EditorBrowsableState.Never)]
1465 protected override void Dispose(DisposeTypes type)
1472 if (type == DisposeTypes.Explicit)
1475 //Release your own managed resources here.
1476 //You should release all of your own disposable objects here.
1478 _rootLayer.Dispose();
1479 localController.Dispose();
1481 foreach(var layer in _childLayers)
1485 _childLayers.Clear();
1488 this.DisconnectNativeSignals();
1490 //Release your own unmanaged resources here.
1491 //You should not access any managed member here except static instance.
1492 //because the execution order of Finalizes is non-deterministic.
1494 if (swigCPtr.Handle != global::System.IntPtr.Zero)
1498 swigCMemOwn = false;
1499 Interop.Window.delete_Window(swigCPtr);
1501 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1507 internal System.IntPtr GetNativeWindowHandler()
1509 System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1510 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1514 private void OnWindowFocusedChanged(bool focusGained)
1516 FocusChangedEventArgs e = new FocusChangedEventArgs();
1518 e.FocusGained = focusGained;
1520 if (_windowFocusChangedEventHandler != null)
1522 _windowFocusChangedEventHandler(this, e);
1526 private StageWheelSignal WheelEventSignal()
1528 StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false);
1529 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1533 private WheelSignal StageWheelEventSignal()
1535 WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1536 if (NDalicPINVOKE.SWIGPendingException.Pending)
1537 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1541 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1543 if (touchData == global::System.IntPtr.Zero)
1545 NUILog.Error("touchData should not be null!");
1549 TouchEventArgs e = new TouchEventArgs();
1551 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1553 if (_rootLayerTouchDataEventHandler != null)
1555 _rootLayerTouchDataEventHandler(this, e);
1560 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1562 if (wheelEvent == global::System.IntPtr.Zero)
1564 NUILog.Error("wheelEvent should not be null!");
1568 WheelEventArgs e = new WheelEventArgs();
1570 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1572 if (_stageWheelHandler != null)
1574 _stageWheelHandler(this, e);
1579 // Callback for Stage KeyEventsignal
1580 private void OnStageKey(IntPtr data)
1582 KeyEventArgs e = new KeyEventArgs();
1583 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1586 if (_stageKeyHandler != null)
1588 //here we send all data to user event handlers
1589 _stageKeyHandler(this, e);
1593 // Callback for Stage EventProcessingFinishedSignal
1594 private void OnEventProcessingFinished()
1596 if (_stageEventProcessingFinishedEventHandler != null)
1598 _stageEventProcessingFinishedEventHandler(this, null);
1602 // Callback for Stage ContextLostSignal
1603 private void OnContextLost()
1605 if (_stageContextLostEventHandler != null)
1607 _stageContextLostEventHandler(this, null);
1611 // Callback for Stage ContextRegainedSignal
1612 private void OnContextRegained()
1614 if (_stageContextRegainedEventHandler != null)
1616 _stageContextRegainedEventHandler(this, null);
1620 // Callback for Stage SceneCreatedSignal
1621 private void OnSceneCreated()
1623 if (_stageSceneCreatedEventHandler != null)
1625 _stageSceneCreatedEventHandler(this, null);
1629 private void OnResized(IntPtr windowSize)
1631 ResizedEventArgs e = new ResizedEventArgs();
1632 var val = new Uint16Pair(windowSize, false);
1633 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1636 if (_windowResizedEventHandler != null)
1638 _windowResizedEventHandler(this, e);
1642 private void OnWindowFocusedChanged2(bool focusGained)
1644 FocusChangedEventArgs e = new FocusChangedEventArgs();
1646 e.FocusGained = focusGained;
1648 if (_windowFocusChangedEventHandler2 != null)
1650 _windowFocusChangedEventHandler2(this, e);
1655 /// The focus changed event argument.
1657 /// <since_tizen> 3 </since_tizen>
1658 public class FocusChangedEventArgs : EventArgs
1661 /// FocusGained flag.
1663 /// <since_tizen> 3 </since_tizen>
1664 public bool FocusGained
1672 /// The touch event argument.
1674 /// <since_tizen> 3 </since_tizen>
1675 public class TouchEventArgs : EventArgs
1677 private Touch _touch;
1682 /// <since_tizen> 3 </since_tizen>
1697 /// Wheel event arguments.
1699 /// <since_tizen> 3 </since_tizen>
1700 public class WheelEventArgs : EventArgs
1702 private Wheel _wheel;
1707 /// <since_tizen> 3 </since_tizen>
1722 /// Key event arguments.
1724 /// <since_tizen> 3 </since_tizen>
1725 public class KeyEventArgs : EventArgs
1732 /// <since_tizen> 3 </since_tizen>
1747 /// Sets position and size of the window. This API guarantees that
1748 /// both moving and resizing of window will appear on the screen at once.
1750 [EditorBrowsable(EditorBrowsableState.Never)]
1751 public Rectangle WindowPositionSize
1755 Position2D position = GetPosition();
1756 Size2D size = GetSize();
1757 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1762 SetPositionSize(value);
1767 /// Feeds a key event into the window.
1768 /// This resized event arguments.
1770 /// <since_tizen> 3 </since_tizen>
1771 public class ResizedEventArgs : EventArgs
1776 /// This window size.
1778 /// <since_tizen> 4 </since_tizen>
1779 public Size2D WindowSize
1787 _windowSize = value;
1793 /// Please do not use! this will be deprecated
1795 /// <since_tizen> 3 </since_tizen>
1796 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1798 "Window.Instance.FocusChanged = OnFocusChanged; " +
1799 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1800 [EditorBrowsable(EditorBrowsableState.Never)]
1801 public class WindowFocusChangedEventArgs : EventArgs
1804 /// Please do not use! this will be deprecated
1806 /// <since_tizen> 3 </since_tizen>
1807 public bool FocusGained
1815 /// Contains and encapsulates Native Window handle.
1817 /// <since_tizen> 4 </since_tizen>
1818 public class SafeNativeWindowHandle : SafeHandle
1821 /// Contructor, Native window handle is set to handle.
1823 /// <since_tizen> 4 </since_tizen>
1824 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1826 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1829 /// Null check if the handle is valid or not.
1831 /// <since_tizen> 4 </since_tizen>
1832 public override bool IsInvalid
1836 return this.handle == IntPtr.Zero;
1840 /// Release handle itself.
1842 /// <returns>true when released successfully.</returns>
1843 /// <since_tizen> 4 </since_tizen>
1844 protected override bool ReleaseHandle()
1851 /// Disconnect all native signals
1853 /// <since_tizen> 5 </since_tizen>
1854 internal void DisconnectNativeSignals()
1856 if( _windowFocusChangedEventCallback != null )
1858 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1861 if( _rootLayerTouchDataCallback != null )
1863 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1866 if( _wheelEventCallback != null )
1868 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1871 if( _stageKeyCallbackDelegate != null )
1873 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1876 if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1878 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1881 if( _stageContextLostEventCallbackDelegate != null )
1883 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1886 if( _stageContextRegainedEventCallbackDelegate != null )
1888 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1891 if( _stageSceneCreatedEventCallbackDelegate != null )
1893 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1896 if( _windowResizedEventCallback != null )
1898 ResizedSignal().Disconnect(_windowResizedEventCallback);
1901 if( _windowFocusChangedEventCallback2 != null )
1903 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);