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 /// Keep rendering for at least the given amount of time.
1002 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1003 /// <since_tizen> 3 </since_tizen>
1004 public void KeepRendering(float durationSeconds)
1006 Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds);
1007 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1011 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1012 /// This function can be used for following example scenarios: <br />
1013 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1015 /// <param name="DaliKey">The key code to grab.</param>
1016 /// <returns>True if the grab succeeds.</returns>
1017 /// <since_tizen> 3 </since_tizen>
1018 public bool GrabKeyTopmost(int DaliKey)
1020 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1021 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1026 /// Ungrabs the key specified by a key for the window.<br />
1027 /// 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 />
1029 /// <param name="DaliKey">The key code to ungrab.</param>
1030 /// <returns>True if the ungrab succeeds.</returns>
1031 /// <since_tizen> 3 </since_tizen>
1032 public bool UngrabKeyTopmost(int DaliKey)
1034 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1035 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1040 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1041 /// Details: This function can be used for following example scenarios: <br />
1042 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1043 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1044 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1046 /// <param name="DaliKey">The key code to grab.</param>
1047 /// <param name="GrabMode">The grab mode for the key.</param>
1048 /// <returns>True if the grab succeeds.</returns>
1049 /// <since_tizen> 3 </since_tizen>
1050 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1052 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1053 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1058 /// Ungrabs the key specified by a key for a window.<br />
1059 /// 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 />
1061 /// <param name="DaliKey">The key code to ungrab.</param>
1062 /// <returns>True if the ungrab succeeds.</returns>
1063 /// <since_tizen> 3 </since_tizen>
1064 public bool UngrabKey(int DaliKey)
1066 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1067 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1072 /// Sets the keyboard repeat information.
1074 /// <param name="rate">The key repeat rate value in seconds.</param>
1075 /// <param name="delay">The key repeat delay value in seconds.</param>
1076 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1077 /// <since_tizen> 5 </since_tizen>
1078 public bool SetKeyboardRepeatInfo(float rate, float delay)
1080 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1081 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1086 /// Gets the keyboard repeat information.
1088 /// <param name="rate">The key repeat rate value in seconds.</param>
1089 /// <param name="delay">The key repeat delay value in seconds.</param>
1090 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1091 /// <since_tizen> 5 </since_tizen>
1092 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1094 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1095 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1100 /// Adds a layer to the stage.
1102 /// <param name="layer">Layer to add.</param>
1103 /// <since_tizen> 3 </since_tizen>
1104 public void AddLayer(Layer layer)
1106 Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1107 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1109 LayersChildren?.Add(layer);
1110 layer.SetWindow(this);
1114 /// Removes a layer from the stage.
1116 /// <param name="layer">Layer to remove.</param>
1117 /// <since_tizen> 3 </since_tizen>
1118 public void RemoveLayer(Layer layer)
1120 Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1121 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1123 LayersChildren?.Remove(layer);
1124 layer.SetWindow(null);
1128 /// Feeds a key event into the window.
1130 /// <param name="keyEvent">The key event to feed.</param>
1131 /// <since_tizen> 5 </since_tizen>
1132 public void FeedKey(Key keyEvent)
1134 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1135 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1139 /// Allows at least one more render, even when paused.
1140 /// The window should be shown, not minimised.
1142 /// <since_tizen> 4 </since_tizen>
1143 public void RenderOnce()
1145 Interop.Window.Window_RenderOnce(swigCPtr);
1146 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1149 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1151 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1154 internal static Window GetCurrent()
1156 Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
1157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1161 internal static bool IsInstalled()
1163 bool ret = Interop.Stage.Stage_IsInstalled();
1164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1168 internal WindowFocusSignalType WindowFocusChangedSignal()
1170 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1171 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1175 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1177 Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1181 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1183 Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1187 internal void RotateIndicator(Window.WindowOrientation orientation)
1189 Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
1190 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1193 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1195 Interop.WindowInternal.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1199 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1201 Interop.WindowInternal.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1205 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1207 Interop.WindowInternal.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1211 internal Window.WindowOrientation GetPreferredOrientation()
1213 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.WindowInternal.Window_GetPreferredOrientation(swigCPtr);
1214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1218 internal DragAndDropDetector GetDragAndDropDetector()
1220 DragAndDropDetector ret = new DragAndDropDetector(Interop.WindowInternal.Window_GetDragAndDropDetector(swigCPtr), true);
1221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1225 internal Any GetNativeHandle()
1227 Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1232 internal WindowFocusSignalType FocusChangedSignal()
1234 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239 internal void Add(Layer layer)
1241 Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1244 LayersChildren?.Add(layer);
1245 layer.SetWindow(this);
1248 internal void Remove(Layer layer)
1250 Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1251 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1253 LayersChildren?.Remove(layer);
1254 layer.SetWindow(null);
1257 internal Vector2 GetSize()
1259 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1260 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1265 internal RenderTaskList GetRenderTaskList()
1267 RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1273 /// Queries the number of on-window layers.
1275 /// <returns>The number of layers.</returns>
1276 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1277 internal uint GetLayerCount()
1279 if (LayersChildren == null || LayersChildren.Count < 0)
1282 return (uint) LayersChildren.Count;
1285 internal Layer GetRootLayer()
1287 // Window.IsInstalled() is actually true only when called from event thread and
1288 // Core has been initialized, not when Stage is ready.
1289 if (_rootLayer == null && Window.IsInstalled())
1291 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1293 LayersChildren?.Add(_rootLayer);
1294 _rootLayer.SetWindow(this);
1299 internal void SetBackgroundColor(Vector4 color)
1301 Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1305 internal Vector4 GetBackgroundColor()
1307 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1312 internal Vector2 GetDpi()
1314 Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1315 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1319 internal ObjectRegistry GetObjectRegistry()
1321 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1326 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1328 Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1329 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1332 internal RenderingBehaviorType GetRenderingBehavior()
1334 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1335 if (NDalicPINVOKE.SWIGPendingException.Pending)
1336 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1340 internal KeyEventSignal KeyEventSignal()
1342 KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false);
1343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1347 internal VoidSignal EventProcessingFinishedSignal()
1349 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1354 internal TouchSignal TouchSignal()
1356 TouchSignal ret = new TouchSignal(Interop.Window.TouchSignal(swigCPtr), false);
1357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1361 internal TouchDataSignal TouchDataSignal()
1363 TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1364 if (NDalicPINVOKE.SWIGPendingException.Pending)
1365 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1369 internal VoidSignal ContextLostSignal()
1371 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false);
1372 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1376 internal VoidSignal ContextRegainedSignal()
1378 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextRegainedSignal(stageCPtr), false);
1379 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1383 internal VoidSignal SceneCreatedSignal()
1385 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false);
1386 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1390 internal ResizedSignal ResizedSignal()
1392 ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false);
1393 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1397 internal void SetWindowSize(Size2D size)
1399 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1400 Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1404 // Resetting Window size should request a relayout of the tree.
1407 internal Size2D GetWindowSize()
1409 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1410 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1416 internal void SetPosition(Position2D position)
1418 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1419 Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1421 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1423 // Setting Position of the window should request a relayout of the tree.
1427 internal Position2D GetPosition()
1429 var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1430 Position2D ret = new Position2D(val.GetX(), val.GetY());
1432 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1436 internal void SetPositionSize(Rectangle positionSize)
1438 Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1440 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1442 // Setting Position of the window should request a relayout of the tree.
1447 /// Sets whether the window is transparent or not.
1449 /// <param name="transparent">Whether the window is transparent or not.</param>
1450 /// <since_tizen> 5 </since_tizen>
1451 public void SetTransparency(bool transparent) {
1452 Interop.Window.SetTransparency(swigCPtr, transparent);
1453 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1455 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1460 /// Dispose for Window
1462 [EditorBrowsable(EditorBrowsableState.Never)]
1463 protected override void Dispose(DisposeTypes type)
1470 if (type == DisposeTypes.Explicit)
1473 //Release your own managed resources here.
1474 //You should release all of your own disposable objects here.
1478 this.DisconnectNativeSignals();
1480 //Release your own unmanaged resources here.
1481 //You should not access any managed member here except static instance.
1482 //because the execution order of Finalizes is non-deterministic.
1484 if (swigCPtr.Handle != global::System.IntPtr.Zero)
1488 swigCMemOwn = false;
1489 Interop.Window.delete_Window(swigCPtr);
1491 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1497 internal System.IntPtr GetNativeWindowHandler()
1499 System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1500 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1504 private void OnWindowFocusedChanged(bool focusGained)
1506 FocusChangedEventArgs e = new FocusChangedEventArgs();
1508 e.FocusGained = focusGained;
1510 if (_windowFocusChangedEventHandler != null)
1512 _windowFocusChangedEventHandler(this, e);
1516 private StageWheelSignal WheelEventSignal()
1518 StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false);
1519 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1523 private WheelSignal StageWheelEventSignal()
1525 WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1526 if (NDalicPINVOKE.SWIGPendingException.Pending)
1527 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1531 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1533 if (touchData == global::System.IntPtr.Zero)
1535 NUILog.Error("touchData should not be null!");
1539 TouchEventArgs e = new TouchEventArgs();
1541 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1543 if (_rootLayerTouchDataEventHandler != null)
1545 _rootLayerTouchDataEventHandler(this, e);
1550 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1552 if (wheelEvent == global::System.IntPtr.Zero)
1554 NUILog.Error("wheelEvent should not be null!");
1558 WheelEventArgs e = new WheelEventArgs();
1560 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1562 if (_stageWheelHandler != null)
1564 _stageWheelHandler(this, e);
1569 // Callback for Stage KeyEventsignal
1570 private void OnStageKey(IntPtr data)
1572 KeyEventArgs e = new KeyEventArgs();
1573 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1576 if (_stageKeyHandler != null)
1578 //here we send all data to user event handlers
1579 _stageKeyHandler(this, e);
1583 // Callback for Stage EventProcessingFinishedSignal
1584 private void OnEventProcessingFinished()
1586 if (_stageEventProcessingFinishedEventHandler != null)
1588 _stageEventProcessingFinishedEventHandler(this, null);
1592 // Callback for Stage ContextLostSignal
1593 private void OnContextLost()
1595 if (_stageContextLostEventHandler != null)
1597 _stageContextLostEventHandler(this, null);
1601 // Callback for Stage ContextRegainedSignal
1602 private void OnContextRegained()
1604 if (_stageContextRegainedEventHandler != null)
1606 _stageContextRegainedEventHandler(this, null);
1610 // Callback for Stage SceneCreatedSignal
1611 private void OnSceneCreated()
1613 if (_stageSceneCreatedEventHandler != null)
1615 _stageSceneCreatedEventHandler(this, null);
1619 private void OnResized(IntPtr windowSize)
1621 ResizedEventArgs e = new ResizedEventArgs();
1622 var val = new Uint16Pair(windowSize, false);
1623 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1626 if (_windowResizedEventHandler != null)
1628 _windowResizedEventHandler(this, e);
1632 private void OnWindowFocusedChanged2(bool focusGained)
1634 FocusChangedEventArgs e = new FocusChangedEventArgs();
1636 e.FocusGained = focusGained;
1638 if (_windowFocusChangedEventHandler2 != null)
1640 _windowFocusChangedEventHandler2(this, e);
1645 /// The focus changed event argument.
1647 /// <since_tizen> 3 </since_tizen>
1648 public class FocusChangedEventArgs : EventArgs
1651 /// FocusGained flag.
1653 /// <since_tizen> 3 </since_tizen>
1654 public bool FocusGained
1662 /// The touch event argument.
1664 /// <since_tizen> 3 </since_tizen>
1665 public class TouchEventArgs : EventArgs
1667 private Touch _touch;
1672 /// <since_tizen> 3 </since_tizen>
1687 /// Wheel event arguments.
1689 /// <since_tizen> 3 </since_tizen>
1690 public class WheelEventArgs : EventArgs
1692 private Wheel _wheel;
1697 /// <since_tizen> 3 </since_tizen>
1712 /// Key event arguments.
1714 /// <since_tizen> 3 </since_tizen>
1715 public class KeyEventArgs : EventArgs
1722 /// <since_tizen> 3 </since_tizen>
1737 /// Sets position and size of the window. This API guarantees that
1738 /// both moving and resizing of window will appear on the screen at once.
1740 [EditorBrowsable(EditorBrowsableState.Never)]
1741 public Rectangle WindowPositionSize
1745 Position2D position = GetPosition();
1746 Size2D size = GetSize();
1747 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1752 SetPositionSize(value);
1757 /// Feeds a key event into the window.
1758 /// This resized event arguments.
1760 /// <since_tizen> 3 </since_tizen>
1761 public class ResizedEventArgs : EventArgs
1766 /// This window size.
1768 /// <since_tizen> 4 </since_tizen>
1769 public Size2D WindowSize
1777 _windowSize = value;
1783 /// Please do not use! this will be deprecated
1785 /// <since_tizen> 3 </since_tizen>
1786 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1788 "Window.Instance.FocusChanged = OnFocusChanged; " +
1789 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1790 [EditorBrowsable(EditorBrowsableState.Never)]
1791 public class WindowFocusChangedEventArgs : EventArgs
1794 /// Please do not use! this will be deprecated
1796 /// <since_tizen> 3 </since_tizen>
1797 public bool FocusGained
1805 /// Contains and encapsulates Native Window handle.
1807 /// <since_tizen> 4 </since_tizen>
1808 public class SafeNativeWindowHandle : SafeHandle
1811 /// Contructor, Native window handle is set to handle.
1813 /// <since_tizen> 4 </since_tizen>
1814 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1816 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1819 /// Null check if the handle is valid or not.
1821 /// <since_tizen> 4 </since_tizen>
1822 public override bool IsInvalid
1826 return this.handle == IntPtr.Zero;
1830 /// Release handle itself.
1832 /// <returns>true when released successfully.</returns>
1833 /// <since_tizen> 4 </since_tizen>
1834 protected override bool ReleaseHandle()
1841 /// Disconnect all native signals
1843 /// <since_tizen> 5 </since_tizen>
1844 internal void DisconnectNativeSignals()
1846 if( _windowFocusChangedEventCallback != null )
1848 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1851 if( _rootLayerTouchDataCallback != null )
1853 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1856 if( _wheelEventCallback != null )
1858 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1861 if( _stageKeyCallbackDelegate != null )
1863 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1866 if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1868 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1871 if( _stageContextLostEventCallbackDelegate != null )
1873 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1876 if( _stageContextRegainedEventCallbackDelegate != null )
1878 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1881 if( _stageSceneCreatedEventCallbackDelegate != null )
1883 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1886 if( _windowResizedEventCallback != null )
1888 ResizedSignal().Disconnect(_windowResizedEventCallback);
1891 if( _windowFocusChangedEventCallback2 != null )
1893 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);