2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
19 using Tizen.NUI.BaseComponents;
20 using System.ComponentModel;
21 using System.Collections.Generic;
26 /// The window class is used internally for drawing.<br />
27 /// The window has an orientation and indicator properties.<br />
29 /// <since_tizen> 3 </since_tizen>
30 public class Window : BaseHandle
32 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33 private global::System.Runtime.InteropServices.HandleRef stageCPtr;
34 private readonly global::System.Runtime.InteropServices.HandleRef rootLayoutCPtr;
35 private Layer _rootLayer;
36 private string _windowTitle;
37 private readonly LayoutItem rootLayoutItem;
39 private List<Layer> _childLayers = new List<Layer>();
40 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
41 private RootLayerTouchDataCallbackType _rootLayerTouchDataCallback;
42 private WheelEventCallbackType _wheelEventCallback;
43 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
44 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
45 private EventHandler _stageContextLostEventHandler;
46 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
47 private EventHandler _stageContextRegainedEventHandler;
48 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
49 private EventHandler _stageSceneCreatedEventHandler;
50 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
51 private WindowResizedEventCallbackType _windowResizedEventCallback;
52 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
54 private static readonly Window instance = Application.Instance?.GetWindow();
56 private LayoutController localController;
58 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
60 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
61 if (NDalicPINVOKE.Stage_IsInstalled())
63 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
65 localController = new LayoutController();
66 NUILog.Debug("layoutController id:" + localController.GetId() );
68 // Create a root layout (AbsoluteLayout) that is invisible to the user but enables layouts added to the Window
69 // Enables layouts added to the Window to have a parent layout. As parent layout is needed to store measure spec properties.
70 // Currently without these measure specs the new layout added will always be the size of the window.
71 global::System.IntPtr rootLayoutIntPtr = NDalicManualPINVOKE.Window_NewRootLayout();
72 // Store HandleRef used by Add()
73 rootLayoutCPtr = new global::System.Runtime.InteropServices.HandleRef(this, rootLayoutIntPtr);
74 Layer rootLayer = GetRootLayer();
75 // Add the root layout created above to the root layer.
76 NDalicPINVOKE.Actor_Add( Layer.getCPtr(rootLayer), rootLayoutCPtr );
77 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79 global::System.IntPtr rootControlLayoutIntPtr = Tizen.NUI.NDalicManualPINVOKE.GetLayout__SWIG_1(rootLayoutCPtr);
80 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82 rootLayoutItem = new LayoutItem(rootControlLayoutIntPtr, true);
86 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
88 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
93 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
98 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
101 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
107 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
108 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
109 private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
110 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
111 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
112 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
113 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
114 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
115 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
118 /// FocusChanged event.
120 /// <since_tizen> 3 </since_tizen>
121 public event EventHandler<FocusChangedEventArgs> FocusChanged
125 if (_windowFocusChangedEventHandler == null)
127 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
128 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
131 _windowFocusChangedEventHandler += value;
135 _windowFocusChangedEventHandler -= value;
137 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
139 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
145 /// This event is emitted when the screen is touched and when the touch ends.<br />
146 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
147 /// then when the last finger is lifted.<br />
148 /// An interrupted event will also be emitted (if it occurs).<br />
150 /// <since_tizen> 3 </since_tizen>
151 public event EventHandler<TouchEventArgs> TouchEvent
155 if (_rootLayerTouchDataEventHandler == null)
157 _rootLayerTouchDataCallback = OnWindowTouch;
158 this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
160 _rootLayerTouchDataEventHandler += value;
164 _rootLayerTouchDataEventHandler -= value;
165 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
167 this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
173 /// This event is emitted when the wheel event is received.
175 /// <since_tizen> 3 </since_tizen>
176 public event EventHandler<WheelEventArgs> WheelEvent
180 if (_stageWheelHandler == null)
182 _wheelEventCallback = OnStageWheel;
183 this.StageWheelEventSignal().Connect(_wheelEventCallback);
185 _stageWheelHandler += value;
189 _stageWheelHandler -= value;
190 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
192 this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
198 /// This event is emitted when the key event is received.
200 /// <since_tizen> 3 </since_tizen>
201 public event EventHandler<KeyEventArgs> KeyEvent
205 if (_stageKeyHandler == null)
207 _stageKeyCallbackDelegate = OnStageKey;
208 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
210 _stageKeyHandler += value;
214 _stageKeyHandler -= value;
215 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
217 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
223 /// This event is emitted when the window resized.
225 /// <since_tizen> 3 </since_tizen>
226 public event EventHandler<ResizedEventArgs> Resized
230 if (_windowResizedEventHandler == null)
232 _windowResizedEventCallback = OnResized;
233 ResizedSignal().Connect(_windowResizedEventCallback);
236 _windowResizedEventHandler += value;
240 _windowResizedEventHandler -= value;
242 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
244 ResizedSignal().Disconnect(_windowResizedEventCallback);
250 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
252 /// <since_tizen> 3 </since_tizen>
253 /// Please do not use! this will be deprecated!
254 /// Instead please use FocusChanged.
255 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
257 "Window.Instance.FocusChanged = OnFocusChanged; " +
258 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
259 [EditorBrowsable(EditorBrowsableState.Never)]
260 public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
264 if (_windowFocusChangedEventHandler2 == null)
266 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
267 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
270 _windowFocusChangedEventHandler2 += value;
274 _windowFocusChangedEventHandler2 -= value;
276 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
278 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
283 internal event EventHandler EventProcessingFinished
287 if (_stageEventProcessingFinishedEventHandler == null)
289 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
290 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
292 _stageEventProcessingFinishedEventHandler += value;
297 _stageEventProcessingFinishedEventHandler -= value;
298 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
300 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
305 internal event EventHandler ContextLost
309 if (_stageContextLostEventHandler == null)
311 _stageContextLostEventCallbackDelegate = OnContextLost;
312 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
314 _stageContextLostEventHandler += value;
318 _stageContextLostEventHandler -= value;
319 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
321 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
326 internal event EventHandler ContextRegained
330 if (_stageContextRegainedEventHandler == null)
332 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
333 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
335 _stageContextRegainedEventHandler += value;
339 _stageContextRegainedEventHandler -= value;
340 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
342 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
347 internal event EventHandler SceneCreated
351 if (_stageSceneCreatedEventHandler == null)
353 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
354 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
356 _stageSceneCreatedEventHandler += value;
360 _stageSceneCreatedEventHandler -= value;
361 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
363 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
368 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
369 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
370 private event EventHandler<WheelEventArgs> _stageWheelHandler;
371 private event EventHandler<KeyEventArgs> _stageKeyHandler;
372 private event EventHandler _stageEventProcessingFinishedEventHandler;
373 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
374 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
377 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
379 /// <since_tizen> 3 </since_tizen>
380 public enum WindowOrientation
383 /// Portrait orientation. The height of the display area is greater than the width.
385 /// <since_tizen> 3 </since_tizen>
388 /// Landscape orientation. A wide view area is needed.
390 /// <since_tizen> 3 </since_tizen>
393 /// Portrait inverse orientation.
395 /// <since_tizen> 3 </since_tizen>
396 PortraitInverse = 180,
398 /// Landscape inverse orientation.
400 /// <since_tizen> 3 </since_tizen>
401 LandscapeInverse = 270
405 /// Enumeration for the key grab mode for platform-level APIs.
407 /// <since_tizen> 3 </since_tizen>
408 public enum KeyGrabMode
411 /// Grabs a key only when on the top of the grabbing-window stack mode.
415 /// Grabs a key together with the other client window(s) mode.
419 /// 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.
423 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
429 /// Enumeration for opacity of the indicator.
431 internal enum IndicatorBackgroundOpacity
439 /// Enumeration for visible mode of the indicator.
441 internal enum IndicatorVisibleMode
449 /// The stage instance property (read-only).<br />
450 /// Gets the current window.<br />
452 /// <since_tizen> 3 </since_tizen>
453 public static Window Instance
462 /// Gets or sets a window type.
464 /// <since_tizen> 3 </since_tizen>
465 public WindowType Type
469 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
470 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
475 NDalicPINVOKE.SetType(swigCPtr, (int)value);
476 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
481 /// Gets/Sets a window title.
483 /// <since_tizen> 4 </since_tizen>
492 _windowTitle = value;
493 SetClass(_windowTitle, "");
498 /// The rendering behavior of a Window.
500 /// <since_tizen> 5 </since_tizen>
501 public RenderingBehaviorType RenderingBehavior
505 return GetRenderingBehavior();
509 SetRenderingBehavior(value);
514 /// The window size property (read-only).
516 /// <since_tizen> 3 </since_tizen>
521 Size2D ret = GetSize();
527 /// The background color property.
529 /// <since_tizen> 3 </since_tizen>
530 public Color BackgroundColor
534 SetBackgroundColor(value);
538 Color ret = GetBackgroundColor();
544 /// The DPI property (read-only).<br />
545 /// Retrieves the DPI of the display device to which the Window is connected.<br />
547 /// <since_tizen> 3 </since_tizen>
557 /// The layer count property (read-only).<br />
558 /// Queries the number of on-Window layers.<br />
560 /// <since_tizen> 3 </since_tizen>
561 public uint LayerCount
565 return GetLayerCount();
570 /// Gets or sets a size of the window.
572 /// <since_tizen> 4 </since_tizen>
573 public Size2D WindowSize
577 return GetWindowSize();
581 SetWindowSize(value);
586 /// Gets or sets a position of the window.
588 /// <since_tizen> 4 </since_tizen>
589 public Position2D WindowPosition
593 return GetPosition();
600 internal static Vector4 DEFAULT_BACKGROUND_COLOR
604 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
605 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
606 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
611 internal static Vector4 DEBUG_BACKGROUND_COLOR
615 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
616 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
617 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
622 internal List<Layer> LayersChildren
631 /// Feed a key-event into the window.
633 /// <param name="keyEvent">The key event to feed.</param>
634 /// <since_tizen> 4 </since_tizen>
635 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
636 public static void FeedKeyEvent(Key keyEvent)
638 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
639 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
643 /// Sets whether the window accepts a focus or not.
645 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
646 /// <since_tizen> 3 </since_tizen>
647 public void SetAcceptFocus(bool accept)
649 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
650 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
654 /// Returns whether the window accepts a focus or not.
656 /// <returns>True if the window accepts a focus, false otherwise.</returns>
657 /// <since_tizen> 3 </since_tizen>
658 public bool IsFocusAcceptable()
660 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
661 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
667 /// Shows the window if it is hidden.
669 /// <since_tizen> 3 </since_tizen>
672 NDalicPINVOKE.Show(swigCPtr);
673 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
677 /// Hides the window if it is showing.
679 /// <since_tizen> 3 </since_tizen>
682 NDalicPINVOKE.Hide(swigCPtr);
683 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
687 /// Retrieves whether the window is visible or not.
689 /// <returns>True if the window is visible.</returns>
690 /// <since_tizen> 3 </since_tizen>
691 public bool IsVisible()
693 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
694 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
699 /// Gets the count of supported auxiliary hints of the window.
701 /// <returns>The number of supported auxiliary hints.</returns>
702 /// <since_tizen> 3 </since_tizen>
703 public uint GetSupportedAuxiliaryHintCount()
705 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
706 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711 /// Gets the supported auxiliary hint string of the window.
713 /// <param name="index">The index of the supported auxiliary hint lists.</param>
714 /// <returns>The auxiliary hint string of the index.</returns>
715 /// <since_tizen> 3 </since_tizen>
716 public string GetSupportedAuxiliaryHint(uint index)
718 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
719 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
724 /// Creates an auxiliary hint of the window.
726 /// <param name="hint">The auxiliary hint string.</param>
727 /// <param name="value">The value string.</param>
728 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
729 /// <since_tizen> 3 </since_tizen>
730 public uint AddAuxiliaryHint(string hint, string value)
732 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
733 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738 /// Removes an auxiliary hint of the window.
740 /// <param name="id">The ID of the auxiliary hint.</param>
741 /// <returns>True if no error occurred, false otherwise.</returns>
742 /// <since_tizen> 3 </since_tizen>
743 public bool RemoveAuxiliaryHint(uint id)
745 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
746 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751 /// Changes a value of the auxiliary hint.
753 /// <param name="id">The auxiliary hint ID.</param>
754 /// <param name="value">The value string to be set.</param>
755 /// <returns>True if no error occurred, false otherwise.</returns>
756 /// <since_tizen> 3 </since_tizen>
757 public bool SetAuxiliaryHintValue(uint id, string value)
759 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
760 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
765 /// Gets a value of the auxiliary hint.
767 /// <param name="id">The auxiliary hint ID.</param>
768 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
769 /// <since_tizen> 3 </since_tizen>
770 public string GetAuxiliaryHintValue(uint id)
772 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
773 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778 /// Gets an ID of the auxiliary hint string.
780 /// <param name="hint">The auxiliary hint string.</param>
781 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
782 /// <since_tizen> 3 </since_tizen>
783 public uint GetAuxiliaryHintId(string hint)
785 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
786 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791 /// Sets a region to accept input events.
793 /// <param name="inputRegion">The region to accept input events.</param>
794 /// <since_tizen> 3 </since_tizen>
795 public void SetInputRegion(Rectangle inputRegion)
797 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
798 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
802 /// Sets a priority level for the specified notification window.
804 /// <param name="level">The notification window level.</param>
805 /// <returns>True if no error occurred, false otherwise.</returns>
806 /// <since_tizen> 3 </since_tizen>
807 public bool SetNotificationLevel(NotificationLevel level)
809 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
810 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815 /// Gets a priority level for the specified notification window.
817 /// <returns>The notification window level.</returns>
818 /// <since_tizen> 3 </since_tizen>
819 public NotificationLevel GetNotificationLevel()
821 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
822 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
827 /// Sets a transparent window's visual state to opaque. <br />
828 /// If a visual state of a transparent window is opaque, <br />
829 /// then the window manager could handle it as an opaque window when calculating visibility.
831 /// <param name="opaque">Whether the window's visual state is opaque.</param>
832 /// <remarks>This will have no effect on an opaque window. <br />
833 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
835 /// <since_tizen> 3 </since_tizen>
836 public void SetOpaqueState(bool opaque)
838 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
839 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
843 /// Returns whether a transparent window's visual state is opaque or not.
845 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
846 /// <remarks> The return value has no meaning on an opaque window. </remarks>
847 /// <since_tizen> 3 </since_tizen>
848 public bool IsOpaqueState()
850 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
851 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
856 /// Sets a window's screen off mode.
858 /// <param name="screenOffMode">The screen mode.</param>
859 /// <returns>True if no error occurred, false otherwise.</returns>
860 /// <since_tizen> 4 </since_tizen>
861 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
863 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
864 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
869 /// Gets the screen mode of the window.
871 /// <returns>The screen off mode.</returns>
872 /// <since_tizen> 4 </since_tizen>
873 public ScreenOffMode GetScreenOffMode()
875 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
876 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
881 /// Sets preferred brightness of the window.
883 /// <param name="brightness">The preferred brightness (0 to 100).</param>
884 /// <returns>True if no error occurred, false otherwise.</returns>
885 /// <since_tizen> 3 </since_tizen>
886 public bool SetBrightness(int brightness)
888 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
889 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
894 /// Gets the preferred brightness of the window.
896 /// <returns>The preferred brightness.</returns>
897 /// <since_tizen> 3 </since_tizen>
898 public int GetBrightness()
900 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
901 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
906 /// Sets the window name and the class string.
908 /// <param name="name">The name of the window.</param>
909 /// <param name="klass">The class of the window.</param>
910 /// <since_tizen> 4 </since_tizen>
911 public void SetClass(string name, string klass)
913 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
914 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
918 /// Raises the window to the top of the window stack.
920 /// <since_tizen> 3 </since_tizen>
923 NDalicPINVOKE.Window_Raise(swigCPtr);
924 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
928 /// Lowers the window to the bottom of the window stack.
930 /// <since_tizen> 3 </since_tizen>
933 NDalicPINVOKE.Window_Lower(swigCPtr);
934 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
938 /// Activates the window to the top of the window stack even it is iconified.
940 /// <since_tizen> 3 </since_tizen>
941 public void Activate()
943 NDalicPINVOKE.Window_Activate(swigCPtr);
944 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
948 /// Gets the default ( root ) layer.
950 /// <returns>The root layer.</returns>
951 /// <since_tizen> 3 </since_tizen>
952 public Layer GetDefaultLayer()
954 return this.GetRootLayer();
958 /// Add a child view to window.
960 /// <param name="view">the child should be added to the window.</param>
961 /// <since_tizen> 3 </since_tizen>
962 public void Add(View view)
964 NDalicPINVOKE.Actor_Add(rootLayoutCPtr, View.getCPtr(view));
965 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
966 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
967 view.InternalParent = this.GetRootLayer();
971 /// Remove a child view from window.
973 /// <param name="view">the child to be removed.</param>
974 /// <since_tizen> 3 </since_tizen>
975 public void Remove(View view)
977 NDalicPINVOKE.Actor_Remove(rootLayoutCPtr, View.getCPtr(view));
978 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
979 view.InternalParent = null;
983 /// Retrieves the layer at a specified depth.
985 /// <param name="depth">The layer's depth index.</param>
986 /// <returns>The layer found at the given depth.</returns>
987 /// <since_tizen> 3 </since_tizen>
988 public Layer GetLayer(uint depth)
990 if (depth < LayersChildren?.Count)
992 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1002 /// Keep rendering for at least the given amount of time.
1004 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1005 /// <since_tizen> 3 </since_tizen>
1006 public void KeepRendering(float durationSeconds)
1008 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
1009 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1013 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1014 /// This function can be used for following example scenarios: <br />
1015 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1017 /// <param name="DaliKey">The key code to grab.</param>
1018 /// <returns>True if the grab succeeds.</returns>
1019 /// <since_tizen> 3 </since_tizen>
1020 public bool GrabKeyTopmost(int DaliKey)
1022 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1023 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1028 /// Ungrabs the key specified by a key for the window.<br />
1029 /// 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 />
1031 /// <param name="DaliKey">The key code to ungrab.</param>
1032 /// <returns>True if the ungrab succeeds.</returns>
1033 /// <since_tizen> 3 </since_tizen>
1034 public bool UngrabKeyTopmost(int DaliKey)
1036 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1037 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1042 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1043 /// Details: This function can be used for following example scenarios: <br />
1044 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1045 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1046 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1048 /// <param name="DaliKey">The key code to grab.</param>
1049 /// <param name="GrabMode">The grab mode for the key.</param>
1050 /// <returns>True if the grab succeeds.</returns>
1051 /// <since_tizen> 3 </since_tizen>
1052 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1054 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1055 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1060 /// Ungrabs the key specified by a key for a window.<br />
1061 /// 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 />
1063 /// <param name="DaliKey">The key code to ungrab.</param>
1064 /// <returns>True if the ungrab succeeds.</returns>
1065 /// <since_tizen> 3 </since_tizen>
1066 public bool UngrabKey(int DaliKey)
1068 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1069 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1074 /// Sets the keyboard repeat information.
1076 /// <param name="rate">The key repeat rate value in seconds.</param>
1077 /// <param name="delay">The key repeat delay value in seconds.</param>
1078 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1079 /// <since_tizen> 5 </since_tizen>
1080 public bool SetKeyboardRepeatInfo(float rate, float delay)
1082 bool ret = NDalicManualPINVOKE.SetKeyboardRepeatInfo(rate, delay);
1083 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1088 /// Gets the keyboard repeat information.
1090 /// <param name="rate">The key repeat rate value in seconds.</param>
1091 /// <param name="delay">The key repeat delay value in seconds.</param>
1092 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1093 /// <since_tizen> 5 </since_tizen>
1094 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1096 bool ret = NDalicManualPINVOKE.GetKeyboardRepeatInfo(out rate, out delay);
1097 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1102 /// Adds a layer to the stage.
1104 /// <param name="layer">Layer to add.</param>
1105 /// <since_tizen> 3 </since_tizen>
1106 public void AddLayer(Layer layer)
1108 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1109 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1111 LayersChildren?.Add(layer);
1115 /// Removes a layer from the stage.
1117 /// <param name="layer">Layer to remove.</param>
1118 /// <since_tizen> 3 </since_tizen>
1119 public void RemoveLayer(Layer layer)
1121 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1122 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1124 LayersChildren?.Remove(layer);
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 NDalicManualPINVOKE.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 NDalicManualPINVOKE.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(NDalicPINVOKE.Stage_GetCurrent(), true);
1157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1161 internal static bool IsInstalled()
1163 bool ret = NDalicPINVOKE.Stage_IsInstalled();
1164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1168 internal WindowFocusSignalType WindowFocusChangedSignal()
1170 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
1171 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1175 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1177 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1181 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1183 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1187 internal void RotateIndicator(Window.WindowOrientation orientation)
1189 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
1190 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1193 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1195 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1199 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1201 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1205 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1207 NDalicPINVOKE.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)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
1214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1218 internal DragAndDropDetector GetDragAndDropDetector()
1220 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
1221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1225 internal Any GetNativeHandle()
1227 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
1228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1232 internal WindowFocusSignalType FocusChangedSignal()
1234 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
1235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239 internal void Add(Layer layer)
1241 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1244 LayersChildren?.Add(layer);
1247 internal void Remove(Layer layer)
1249 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1252 LayersChildren?.Remove(layer);
1255 internal Vector2 GetSize()
1257 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
1258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1262 internal RenderTaskList GetRenderTaskList()
1264 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
1265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1270 /// Queries the number of on-window layers.
1272 /// <returns>The number of layers.</returns>
1273 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1274 internal uint GetLayerCount()
1276 if (LayersChildren == null || LayersChildren.Count < 0)
1279 return (uint) LayersChildren.Count;
1282 internal Layer GetRootLayer()
1284 // Window.IsInstalled() is actually true only when called from event thread and
1285 // Core has been initialized, not when Stage is ready.
1286 if (_rootLayer == null && Window.IsInstalled())
1288 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
1289 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1290 LayersChildren?.Add(_rootLayer);
1295 internal void SetBackgroundColor(Vector4 color)
1297 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
1298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1301 internal Vector4 GetBackgroundColor()
1303 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
1304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1308 internal Vector2 GetDpi()
1310 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
1311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1315 internal ObjectRegistry GetObjectRegistry()
1317 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
1318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1322 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1324 NDalicPINVOKE.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1328 internal RenderingBehaviorType GetRenderingBehavior()
1330 RenderingBehaviorType ret = (RenderingBehaviorType)NDalicPINVOKE.Stage_GetRenderingBehavior(stageCPtr);
1331 if (NDalicPINVOKE.SWIGPendingException.Pending)
1332 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1336 internal KeyEventSignal KeyEventSignal()
1338 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
1339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1343 internal VoidSignal EventProcessingFinishedSignal()
1345 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1350 internal TouchSignal TouchSignal()
1352 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
1353 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1357 internal TouchDataSignal TouchDataSignal()
1359 TouchDataSignal ret = new TouchDataSignal(NDalicPINVOKE.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1360 if (NDalicPINVOKE.SWIGPendingException.Pending)
1361 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1365 internal VoidSignal ContextLostSignal()
1367 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
1368 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1372 internal VoidSignal ContextRegainedSignal()
1374 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
1375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1379 internal VoidSignal SceneCreatedSignal()
1381 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
1382 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1386 internal ResizedSignal ResizedSignal()
1388 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
1389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1393 internal void SetWindowSize(Size2D size)
1395 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1396 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1398 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1400 if(rootLayoutItem != null)
1402 rootLayoutItem.RequestLayout();
1406 internal Size2D GetWindowSize()
1408 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1409 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1411 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1415 internal void SetPosition(Position2D position)
1417 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1418 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1420 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1422 if(rootLayoutItem != null)
1424 rootLayoutItem.RequestLayout();
1428 internal Position2D GetPosition()
1430 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1431 Position2D ret = new Position2D(val.GetX(), val.GetY());
1433 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1437 internal void SetPositionSize(Rectangle positionSize)
1439 NDalicPINVOKE.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1441 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1443 if(rootLayoutItem != null)
1445 rootLayoutItem.RequestLayout();
1450 /// Sets whether the window is transparent or not.
1452 /// <param name="transparent">Whether the window is transparent or not.</param>
1453 /// <since_tizen> 5 </since_tizen>
1454 public void SetTransparency(bool transparent) {
1455 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1456 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1458 if(rootLayoutItem != null)
1460 rootLayoutItem.RequestLayout();
1464 internal System.IntPtr GetNativeWindowHandler()
1466 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1467 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1471 private void OnWindowFocusedChanged(bool focusGained)
1473 FocusChangedEventArgs e = new FocusChangedEventArgs();
1475 e.FocusGained = focusGained;
1477 if (_windowFocusChangedEventHandler != null)
1479 _windowFocusChangedEventHandler(this, e);
1483 private StageWheelSignal WheelEventSignal()
1485 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
1486 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1490 private WheelSignal StageWheelEventSignal()
1492 WheelSignal ret = new WheelSignal(NDalicPINVOKE.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1493 if (NDalicPINVOKE.SWIGPendingException.Pending)
1494 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1498 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1500 if (touchData == global::System.IntPtr.Zero)
1502 NUILog.Error("touchData should not be null!");
1506 TouchEventArgs e = new TouchEventArgs();
1508 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1510 if (_rootLayerTouchDataEventHandler != null)
1512 _rootLayerTouchDataEventHandler(this, e);
1517 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1519 if (wheelEvent == global::System.IntPtr.Zero)
1521 NUILog.Error("wheelEvent should not be null!");
1525 WheelEventArgs e = new WheelEventArgs();
1527 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1529 if (_stageWheelHandler != null)
1531 _stageWheelHandler(this, e);
1536 // Callback for Stage KeyEventsignal
1537 private void OnStageKey(IntPtr data)
1539 KeyEventArgs e = new KeyEventArgs();
1540 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1543 if (_stageKeyHandler != null)
1545 //here we send all data to user event handlers
1546 _stageKeyHandler(this, e);
1550 // Callback for Stage EventProcessingFinishedSignal
1551 private void OnEventProcessingFinished()
1553 if (_stageEventProcessingFinishedEventHandler != null)
1555 _stageEventProcessingFinishedEventHandler(this, null);
1559 // Callback for Stage ContextLostSignal
1560 private void OnContextLost()
1562 if (_stageContextLostEventHandler != null)
1564 _stageContextLostEventHandler(this, null);
1568 // Callback for Stage ContextRegainedSignal
1569 private void OnContextRegained()
1571 if (_stageContextRegainedEventHandler != null)
1573 _stageContextRegainedEventHandler(this, null);
1577 // Callback for Stage SceneCreatedSignal
1578 private void OnSceneCreated()
1580 if (_stageSceneCreatedEventHandler != null)
1582 _stageSceneCreatedEventHandler(this, null);
1586 private void OnResized(IntPtr windowSize)
1588 ResizedEventArgs e = new ResizedEventArgs();
1589 var val = new Uint16Pair(windowSize, false);
1590 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1593 if (_windowResizedEventHandler != null)
1595 _windowResizedEventHandler(this, e);
1599 private void OnWindowFocusedChanged2(bool focusGained)
1601 FocusChangedEventArgs e = new FocusChangedEventArgs();
1603 e.FocusGained = focusGained;
1605 if (_windowFocusChangedEventHandler2 != null)
1607 _windowFocusChangedEventHandler2(this, e);
1612 /// The focus changed event argument.
1614 /// <since_tizen> 3 </since_tizen>
1615 public class FocusChangedEventArgs : EventArgs
1618 /// FocusGained flag.
1620 /// <since_tizen> 3 </since_tizen>
1621 public bool FocusGained
1629 /// The touch event argument.
1631 /// <since_tizen> 3 </since_tizen>
1632 public class TouchEventArgs : EventArgs
1634 private Touch _touch;
1639 /// <since_tizen> 3 </since_tizen>
1654 /// Wheel event arguments.
1656 /// <since_tizen> 3 </since_tizen>
1657 public class WheelEventArgs : EventArgs
1659 private Wheel _wheel;
1664 /// <since_tizen> 3 </since_tizen>
1679 /// Key event arguments.
1681 /// <since_tizen> 3 </since_tizen>
1682 public class KeyEventArgs : EventArgs
1689 /// <since_tizen> 3 </since_tizen>
1704 /// Sets position and size of the window. This API guarantees that
1705 /// both moving and resizing of window will appear on the screen at once.
1707 [EditorBrowsable(EditorBrowsableState.Never)]
1708 public Rectangle WindowPositionSize
1712 Position2D position = GetPosition();
1713 Size2D size = GetSize();
1714 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1719 SetPositionSize(value);
1724 /// Feeds a key event into the window.
1725 /// This resized event arguments.
1727 /// <since_tizen> 3 </since_tizen>
1728 public class ResizedEventArgs : EventArgs
1733 /// This window size.
1735 /// <since_tizen> 4 </since_tizen>
1736 public Size2D WindowSize
1744 _windowSize = value;
1750 /// Please do not use! this will be deprecated
1752 /// <since_tizen> 3 </since_tizen>
1753 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1755 "Window.Instance.FocusChanged = OnFocusChanged; " +
1756 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1757 [EditorBrowsable(EditorBrowsableState.Never)]
1758 public class WindowFocusChangedEventArgs : EventArgs
1761 /// Please do not use! this will be deprecated
1763 /// <since_tizen> 3 </since_tizen>
1764 public bool FocusGained
1772 /// Contains and encapsulates Native Window handle.
1774 /// <since_tizen> 4 </since_tizen>
1775 public class SafeNativeWindowHandle : SafeHandle
1778 /// Contructor, Native window handle is set to handle.
1780 /// <since_tizen> 4 </since_tizen>
1781 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1783 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1786 /// Null check if the handle is valid or not.
1788 /// <since_tizen> 4 </since_tizen>
1789 public override bool IsInvalid
1793 return this.handle == IntPtr.Zero;
1797 /// Release handle itself.
1799 /// <returns>true when released successfully.</returns>
1800 /// <since_tizen> 4 </since_tizen>
1801 protected override bool ReleaseHandle()
1808 /// Disconnect all native signals
1810 /// <since_tizen> 5 </since_tizen>
1811 internal void DisconnectNativeSignals()
1813 if( _windowFocusChangedEventCallback != null )
1815 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1818 if( _rootLayerTouchDataCallback != null )
1820 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1823 if( _wheelEventCallback != null )
1825 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1828 if( _stageKeyCallbackDelegate != null )
1830 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1833 if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1835 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1838 if( _stageContextLostEventCallbackDelegate != null )
1840 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1843 if( _stageContextRegainedEventCallbackDelegate != null )
1845 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1848 if( _stageSceneCreatedEventCallbackDelegate != null )
1850 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1853 if( _windowResizedEventCallback != null )
1855 ResizedSignal().Disconnect(_windowResizedEventCallback);
1858 if( _windowFocusChangedEventCallback2 != null )
1860 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);