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);
284 /// ViewAdded will be triggered when the view added on Window
286 /// <since_tizen> 6 </since_tizen>
287 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
288 [EditorBrowsable(EditorBrowsableState.Never)]
289 public event EventHandler ViewAdded;
291 internal void SendViewAdded(View view)
293 ViewAdded?.Invoke(view, EventArgs.Empty);
296 internal event EventHandler EventProcessingFinished
300 if (_stageEventProcessingFinishedEventHandler == null)
302 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
303 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
305 _stageEventProcessingFinishedEventHandler += value;
310 _stageEventProcessingFinishedEventHandler -= value;
311 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
313 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
318 internal event EventHandler ContextLost
322 if (_stageContextLostEventHandler == null)
324 _stageContextLostEventCallbackDelegate = OnContextLost;
325 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
327 _stageContextLostEventHandler += value;
331 _stageContextLostEventHandler -= value;
332 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
334 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
339 internal event EventHandler ContextRegained
343 if (_stageContextRegainedEventHandler == null)
345 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
346 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
348 _stageContextRegainedEventHandler += value;
352 _stageContextRegainedEventHandler -= value;
353 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
355 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
360 internal event EventHandler SceneCreated
364 if (_stageSceneCreatedEventHandler == null)
366 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
367 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
369 _stageSceneCreatedEventHandler += value;
373 _stageSceneCreatedEventHandler -= value;
374 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
376 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
381 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
382 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
383 private event EventHandler<WheelEventArgs> _stageWheelHandler;
384 private event EventHandler<KeyEventArgs> _stageKeyHandler;
385 private event EventHandler _stageEventProcessingFinishedEventHandler;
386 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
387 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
390 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
392 /// <since_tizen> 3 </since_tizen>
393 public enum WindowOrientation
396 /// Portrait orientation. The height of the display area is greater than the width.
398 /// <since_tizen> 3 </since_tizen>
401 /// Landscape orientation. A wide view area is needed.
403 /// <since_tizen> 3 </since_tizen>
406 /// Portrait inverse orientation.
408 /// <since_tizen> 3 </since_tizen>
409 PortraitInverse = 180,
411 /// Landscape inverse orientation.
413 /// <since_tizen> 3 </since_tizen>
414 LandscapeInverse = 270
418 /// Enumeration for the key grab mode for platform-level APIs.
420 /// <since_tizen> 3 </since_tizen>
421 public enum KeyGrabMode
424 /// Grabs a key only when on the top of the grabbing-window stack mode.
428 /// Grabs a key together with the other client window(s) mode.
432 /// 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.
436 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
442 /// Enumeration for opacity of the indicator.
444 internal enum IndicatorBackgroundOpacity
452 /// Enumeration for visible mode of the indicator.
454 internal enum IndicatorVisibleMode
462 /// The stage instance property (read-only).<br />
463 /// Gets the current window.<br />
465 /// <since_tizen> 3 </since_tizen>
466 public static Window Instance
475 /// Gets or sets a window type.
477 /// <since_tizen> 3 </since_tizen>
478 public WindowType Type
482 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
483 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
488 NDalicPINVOKE.SetType(swigCPtr, (int)value);
489 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
494 /// Gets/Sets a window title.
496 /// <since_tizen> 4 </since_tizen>
505 _windowTitle = value;
506 SetClass(_windowTitle, "");
511 /// The rendering behavior of a Window.
513 /// <since_tizen> 5 </since_tizen>
514 public RenderingBehaviorType RenderingBehavior
518 return GetRenderingBehavior();
522 SetRenderingBehavior(value);
527 /// The window size property (read-only).
529 /// <since_tizen> 3 </since_tizen>
534 Size2D ret = GetSize();
540 /// The background color property.
542 /// <since_tizen> 3 </since_tizen>
543 public Color BackgroundColor
547 SetBackgroundColor(value);
551 Color ret = GetBackgroundColor();
557 /// The DPI property (read-only).<br />
558 /// Retrieves the DPI of the display device to which the Window is connected.<br />
560 /// <since_tizen> 3 </since_tizen>
570 /// The layer count property (read-only).<br />
571 /// Queries the number of on-Window layers.<br />
573 /// <since_tizen> 3 </since_tizen>
574 public uint LayerCount
578 return GetLayerCount();
583 /// Gets or sets a size of the window.
585 /// <since_tizen> 4 </since_tizen>
586 public Size2D WindowSize
590 return GetWindowSize();
594 SetWindowSize(value);
599 /// Gets or sets a position of the window.
601 /// <since_tizen> 4 </since_tizen>
602 public Position2D WindowPosition
606 return GetPosition();
613 internal static Vector4 DEFAULT_BACKGROUND_COLOR
617 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
618 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
619 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
624 internal static Vector4 DEBUG_BACKGROUND_COLOR
628 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
629 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
630 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
635 internal List<Layer> LayersChildren
644 /// Feed a key-event into the window.
646 /// <param name="keyEvent">The key event to feed.</param>
647 /// <since_tizen> 4 </since_tizen>
648 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
649 public static void FeedKeyEvent(Key keyEvent)
651 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
652 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
656 /// Sets whether the window accepts a focus or not.
658 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
659 /// <since_tizen> 3 </since_tizen>
660 public void SetAcceptFocus(bool accept)
662 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
663 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
667 /// Returns whether the window accepts a focus or not.
669 /// <returns>True if the window accepts a focus, false otherwise.</returns>
670 /// <since_tizen> 3 </since_tizen>
671 public bool IsFocusAcceptable()
673 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
674 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
680 /// Shows the window if it is hidden.
682 /// <since_tizen> 3 </since_tizen>
685 NDalicPINVOKE.Show(swigCPtr);
686 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
690 /// Hides the window if it is showing.
692 /// <since_tizen> 3 </since_tizen>
695 NDalicPINVOKE.Hide(swigCPtr);
696 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700 /// Retrieves whether the window is visible or not.
702 /// <returns>True if the window is visible.</returns>
703 /// <since_tizen> 3 </since_tizen>
704 public bool IsVisible()
706 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
707 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
712 /// Gets the count of supported auxiliary hints of the window.
714 /// <returns>The number of supported auxiliary hints.</returns>
715 /// <since_tizen> 3 </since_tizen>
716 public uint GetSupportedAuxiliaryHintCount()
718 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
719 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
724 /// Gets the supported auxiliary hint string of the window.
726 /// <param name="index">The index of the supported auxiliary hint lists.</param>
727 /// <returns>The auxiliary hint string of the index.</returns>
728 /// <since_tizen> 3 </since_tizen>
729 public string GetSupportedAuxiliaryHint(uint index)
731 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
732 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
737 /// Creates an auxiliary hint of the window.
739 /// <param name="hint">The auxiliary hint string.</param>
740 /// <param name="value">The value string.</param>
741 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
742 /// <since_tizen> 3 </since_tizen>
743 public uint AddAuxiliaryHint(string hint, string value)
745 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
746 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751 /// Removes an auxiliary hint of the window.
753 /// <param name="id">The ID of the auxiliary hint.</param>
754 /// <returns>True if no error occurred, false otherwise.</returns>
755 /// <since_tizen> 3 </since_tizen>
756 public bool RemoveAuxiliaryHint(uint id)
758 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
759 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764 /// Changes a value of the auxiliary hint.
766 /// <param name="id">The auxiliary hint ID.</param>
767 /// <param name="value">The value string to be set.</param>
768 /// <returns>True if no error occurred, false otherwise.</returns>
769 /// <since_tizen> 3 </since_tizen>
770 public bool SetAuxiliaryHintValue(uint id, string value)
772 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
773 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778 /// Gets a value of the auxiliary hint.
780 /// <param name="id">The auxiliary hint ID.</param>
781 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
782 /// <since_tizen> 3 </since_tizen>
783 public string GetAuxiliaryHintValue(uint id)
785 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
786 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791 /// Gets an ID of the auxiliary hint string.
793 /// <param name="hint">The auxiliary hint string.</param>
794 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
795 /// <since_tizen> 3 </since_tizen>
796 public uint GetAuxiliaryHintId(string hint)
798 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
799 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
804 /// Sets a region to accept input events.
806 /// <param name="inputRegion">The region to accept input events.</param>
807 /// <since_tizen> 3 </since_tizen>
808 public void SetInputRegion(Rectangle inputRegion)
810 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
811 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815 /// Sets a priority level for the specified notification window.
817 /// <param name="level">The notification window level.</param>
818 /// <returns>True if no error occurred, false otherwise.</returns>
819 /// <since_tizen> 3 </since_tizen>
820 public bool SetNotificationLevel(NotificationLevel level)
822 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
823 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
828 /// Gets a priority level for the specified notification window.
830 /// <returns>The notification window level.</returns>
831 /// <since_tizen> 3 </since_tizen>
832 public NotificationLevel GetNotificationLevel()
834 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
835 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
840 /// Sets a transparent window's visual state to opaque. <br />
841 /// If a visual state of a transparent window is opaque, <br />
842 /// then the window manager could handle it as an opaque window when calculating visibility.
844 /// <param name="opaque">Whether the window's visual state is opaque.</param>
845 /// <remarks>This will have no effect on an opaque window. <br />
846 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
848 /// <since_tizen> 3 </since_tizen>
849 public void SetOpaqueState(bool opaque)
851 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
852 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
856 /// Returns whether a transparent window's visual state is opaque or not.
858 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
859 /// <remarks> The return value has no meaning on an opaque window. </remarks>
860 /// <since_tizen> 3 </since_tizen>
861 public bool IsOpaqueState()
863 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
864 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
869 /// Sets a window's screen off mode.
871 /// <param name="screenOffMode">The screen mode.</param>
872 /// <returns>True if no error occurred, false otherwise.</returns>
873 /// <since_tizen> 4 </since_tizen>
874 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
876 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
877 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
882 /// Gets the screen mode of the window.
884 /// <returns>The screen off mode.</returns>
885 /// <since_tizen> 4 </since_tizen>
886 public ScreenOffMode GetScreenOffMode()
888 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
889 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
894 /// Sets preferred brightness of the window.
896 /// <param name="brightness">The preferred brightness (0 to 100).</param>
897 /// <returns>True if no error occurred, false otherwise.</returns>
898 /// <since_tizen> 3 </since_tizen>
899 public bool SetBrightness(int brightness)
901 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
902 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
907 /// Gets the preferred brightness of the window.
909 /// <returns>The preferred brightness.</returns>
910 /// <since_tizen> 3 </since_tizen>
911 public int GetBrightness()
913 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
914 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
919 /// Sets the window name and the class string.
921 /// <param name="name">The name of the window.</param>
922 /// <param name="klass">The class of the window.</param>
923 /// <since_tizen> 4 </since_tizen>
924 public void SetClass(string name, string klass)
926 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
927 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
931 /// Raises the window to the top of the window stack.
933 /// <since_tizen> 3 </since_tizen>
936 NDalicPINVOKE.Window_Raise(swigCPtr);
937 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
941 /// Lowers the window to the bottom of the window stack.
943 /// <since_tizen> 3 </since_tizen>
946 NDalicPINVOKE.Window_Lower(swigCPtr);
947 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
951 /// Activates the window to the top of the window stack even it is iconified.
953 /// <since_tizen> 3 </since_tizen>
954 public void Activate()
956 NDalicPINVOKE.Window_Activate(swigCPtr);
957 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
961 /// Gets the default ( root ) layer.
963 /// <returns>The root layer.</returns>
964 /// <since_tizen> 3 </since_tizen>
965 public Layer GetDefaultLayer()
967 return this.GetRootLayer();
971 /// Add a child view to window.
973 /// <param name="view">the child should be added to the window.</param>
974 /// <since_tizen> 3 </since_tizen>
975 public void Add(View view)
977 NDalicPINVOKE.Actor_Add(rootLayoutCPtr, View.getCPtr(view));
978 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
979 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
980 view.InternalParent = this.GetRootLayer();
984 /// Remove a child view from window.
986 /// <param name="view">the child to be removed.</param>
987 /// <since_tizen> 3 </since_tizen>
988 public void Remove(View view)
990 NDalicPINVOKE.Actor_Remove(rootLayoutCPtr, View.getCPtr(view));
991 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
992 view.InternalParent = null;
996 /// Retrieves the layer at a specified depth.
998 /// <param name="depth">The layer's depth index.</param>
999 /// <returns>The layer found at the given depth.</returns>
1000 /// <since_tizen> 3 </since_tizen>
1001 public Layer GetLayer(uint depth)
1003 if (depth < LayersChildren?.Count)
1005 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1015 /// Keep rendering for at least the given amount of time.
1017 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1018 /// <since_tizen> 3 </since_tizen>
1019 public void KeepRendering(float durationSeconds)
1021 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
1022 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1026 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1027 /// This function can be used for following example scenarios: <br />
1028 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1030 /// <param name="DaliKey">The key code to grab.</param>
1031 /// <returns>True if the grab succeeds.</returns>
1032 /// <since_tizen> 3 </since_tizen>
1033 public bool GrabKeyTopmost(int DaliKey)
1035 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1036 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1041 /// Ungrabs the key specified by a key for the window.<br />
1042 /// 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 />
1044 /// <param name="DaliKey">The key code to ungrab.</param>
1045 /// <returns>True if the ungrab succeeds.</returns>
1046 /// <since_tizen> 3 </since_tizen>
1047 public bool UngrabKeyTopmost(int DaliKey)
1049 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1050 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1055 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1056 /// Details: This function can be used for following example scenarios: <br />
1057 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1058 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1059 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1061 /// <param name="DaliKey">The key code to grab.</param>
1062 /// <param name="GrabMode">The grab mode for the key.</param>
1063 /// <returns>True if the grab succeeds.</returns>
1064 /// <since_tizen> 3 </since_tizen>
1065 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1067 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1068 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1073 /// Ungrabs the key specified by a key for a window.<br />
1074 /// 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 />
1076 /// <param name="DaliKey">The key code to ungrab.</param>
1077 /// <returns>True if the ungrab succeeds.</returns>
1078 /// <since_tizen> 3 </since_tizen>
1079 public bool UngrabKey(int DaliKey)
1081 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1082 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1087 /// Sets the keyboard repeat information.
1089 /// <param name="rate">The key repeat rate value in seconds.</param>
1090 /// <param name="delay">The key repeat delay value in seconds.</param>
1091 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1092 /// <since_tizen> 5 </since_tizen>
1093 public bool SetKeyboardRepeatInfo(float rate, float delay)
1095 bool ret = NDalicManualPINVOKE.SetKeyboardRepeatInfo(rate, delay);
1096 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1101 /// Gets the keyboard repeat information.
1103 /// <param name="rate">The key repeat rate value in seconds.</param>
1104 /// <param name="delay">The key repeat delay value in seconds.</param>
1105 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1106 /// <since_tizen> 5 </since_tizen>
1107 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1109 bool ret = NDalicManualPINVOKE.GetKeyboardRepeatInfo(out rate, out delay);
1110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1115 /// Adds a layer to the stage.
1117 /// <param name="layer">Layer to add.</param>
1118 /// <since_tizen> 3 </since_tizen>
1119 public void AddLayer(Layer layer)
1121 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1122 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1124 LayersChildren?.Add(layer);
1128 /// Removes a layer from the stage.
1130 /// <param name="layer">Layer to remove.</param>
1131 /// <since_tizen> 3 </since_tizen>
1132 public void RemoveLayer(Layer layer)
1134 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1135 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1137 LayersChildren?.Remove(layer);
1141 /// Feeds a key event into the window.
1143 /// <param name="keyEvent">The key event to feed.</param>
1144 /// <since_tizen> 5 </since_tizen>
1145 public void FeedKey(Key keyEvent)
1147 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1152 /// Allows at least one more render, even when paused.
1153 /// The window should be shown, not minimised.
1155 /// <since_tizen> 4 </since_tizen>
1156 public void RenderOnce()
1158 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1162 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1164 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1167 internal static Window GetCurrent()
1169 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
1170 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1174 internal static bool IsInstalled()
1176 bool ret = NDalicPINVOKE.Stage_IsInstalled();
1177 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1181 internal WindowFocusSignalType WindowFocusChangedSignal()
1183 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
1184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1188 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1190 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1194 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1196 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1200 internal void RotateIndicator(Window.WindowOrientation orientation)
1202 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
1203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1206 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1208 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1212 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1214 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1218 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1220 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1224 internal Window.WindowOrientation GetPreferredOrientation()
1226 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
1227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1231 internal DragAndDropDetector GetDragAndDropDetector()
1233 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
1234 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1238 internal Any GetNativeHandle()
1240 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
1241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1245 internal WindowFocusSignalType FocusChangedSignal()
1247 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
1248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1252 internal void Add(Layer layer)
1254 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1255 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1257 LayersChildren?.Add(layer);
1260 internal void Remove(Layer layer)
1262 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1265 LayersChildren?.Remove(layer);
1268 internal Vector2 GetSize()
1270 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
1271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1275 internal RenderTaskList GetRenderTaskList()
1277 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
1278 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1283 /// Queries the number of on-window layers.
1285 /// <returns>The number of layers.</returns>
1286 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1287 internal uint GetLayerCount()
1289 if (LayersChildren == null || LayersChildren.Count < 0)
1292 return (uint) LayersChildren.Count;
1295 internal Layer GetRootLayer()
1297 // Window.IsInstalled() is actually true only when called from event thread and
1298 // Core has been initialized, not when Stage is ready.
1299 if (_rootLayer == null && Window.IsInstalled())
1301 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
1302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1303 LayersChildren?.Add(_rootLayer);
1308 internal void SetBackgroundColor(Vector4 color)
1310 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
1311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1314 internal Vector4 GetBackgroundColor()
1316 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
1317 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1321 internal Vector2 GetDpi()
1323 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
1324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1328 internal ObjectRegistry GetObjectRegistry()
1330 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
1331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1335 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1337 NDalicPINVOKE.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1341 internal RenderingBehaviorType GetRenderingBehavior()
1343 RenderingBehaviorType ret = (RenderingBehaviorType)NDalicPINVOKE.Stage_GetRenderingBehavior(stageCPtr);
1344 if (NDalicPINVOKE.SWIGPendingException.Pending)
1345 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1349 internal KeyEventSignal KeyEventSignal()
1351 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
1352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1356 internal VoidSignal EventProcessingFinishedSignal()
1358 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1363 internal TouchSignal TouchSignal()
1365 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
1366 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1370 internal TouchDataSignal TouchDataSignal()
1372 TouchDataSignal ret = new TouchDataSignal(NDalicPINVOKE.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1373 if (NDalicPINVOKE.SWIGPendingException.Pending)
1374 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1378 internal VoidSignal ContextLostSignal()
1380 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
1381 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1385 internal VoidSignal ContextRegainedSignal()
1387 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
1388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1392 internal VoidSignal SceneCreatedSignal()
1394 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
1395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1399 internal ResizedSignal ResizedSignal()
1401 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
1402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1406 internal void SetWindowSize(Size2D size)
1408 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1409 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1411 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1413 if(rootLayoutItem != null)
1415 rootLayoutItem.RequestLayout();
1419 internal Size2D GetWindowSize()
1421 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1422 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1424 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1428 internal void SetPosition(Position2D position)
1430 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1431 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1433 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1435 if(rootLayoutItem != null)
1437 rootLayoutItem.RequestLayout();
1441 internal Position2D GetPosition()
1443 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1444 Position2D ret = new Position2D(val.GetX(), val.GetY());
1446 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1450 internal void SetPositionSize(Rectangle positionSize)
1452 NDalicPINVOKE.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1454 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1456 if(rootLayoutItem != null)
1458 rootLayoutItem.RequestLayout();
1463 /// Sets whether the window is transparent or not.
1465 /// <param name="transparent">Whether the window is transparent or not.</param>
1466 /// <since_tizen> 5 </since_tizen>
1467 public void SetTransparency(bool transparent) {
1468 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1469 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1471 if(rootLayoutItem != null)
1473 rootLayoutItem.RequestLayout();
1477 internal System.IntPtr GetNativeWindowHandler()
1479 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1480 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1484 private void OnWindowFocusedChanged(bool focusGained)
1486 FocusChangedEventArgs e = new FocusChangedEventArgs();
1488 e.FocusGained = focusGained;
1490 if (_windowFocusChangedEventHandler != null)
1492 _windowFocusChangedEventHandler(this, e);
1496 private StageWheelSignal WheelEventSignal()
1498 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
1499 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1503 private WheelSignal StageWheelEventSignal()
1505 WheelSignal ret = new WheelSignal(NDalicPINVOKE.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1506 if (NDalicPINVOKE.SWIGPendingException.Pending)
1507 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1511 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1513 if (touchData == global::System.IntPtr.Zero)
1515 NUILog.Error("touchData should not be null!");
1519 TouchEventArgs e = new TouchEventArgs();
1521 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1523 if (_rootLayerTouchDataEventHandler != null)
1525 _rootLayerTouchDataEventHandler(this, e);
1530 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1532 if (wheelEvent == global::System.IntPtr.Zero)
1534 NUILog.Error("wheelEvent should not be null!");
1538 WheelEventArgs e = new WheelEventArgs();
1540 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1542 if (_stageWheelHandler != null)
1544 _stageWheelHandler(this, e);
1549 // Callback for Stage KeyEventsignal
1550 private void OnStageKey(IntPtr data)
1552 KeyEventArgs e = new KeyEventArgs();
1553 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1556 if (_stageKeyHandler != null)
1558 //here we send all data to user event handlers
1559 _stageKeyHandler(this, e);
1563 // Callback for Stage EventProcessingFinishedSignal
1564 private void OnEventProcessingFinished()
1566 if (_stageEventProcessingFinishedEventHandler != null)
1568 _stageEventProcessingFinishedEventHandler(this, null);
1572 // Callback for Stage ContextLostSignal
1573 private void OnContextLost()
1575 if (_stageContextLostEventHandler != null)
1577 _stageContextLostEventHandler(this, null);
1581 // Callback for Stage ContextRegainedSignal
1582 private void OnContextRegained()
1584 if (_stageContextRegainedEventHandler != null)
1586 _stageContextRegainedEventHandler(this, null);
1590 // Callback for Stage SceneCreatedSignal
1591 private void OnSceneCreated()
1593 if (_stageSceneCreatedEventHandler != null)
1595 _stageSceneCreatedEventHandler(this, null);
1599 private void OnResized(IntPtr windowSize)
1601 ResizedEventArgs e = new ResizedEventArgs();
1602 var val = new Uint16Pair(windowSize, false);
1603 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1606 if (_windowResizedEventHandler != null)
1608 _windowResizedEventHandler(this, e);
1612 private void OnWindowFocusedChanged2(bool focusGained)
1614 FocusChangedEventArgs e = new FocusChangedEventArgs();
1616 e.FocusGained = focusGained;
1618 if (_windowFocusChangedEventHandler2 != null)
1620 _windowFocusChangedEventHandler2(this, e);
1625 /// The focus changed event argument.
1627 /// <since_tizen> 3 </since_tizen>
1628 public class FocusChangedEventArgs : EventArgs
1631 /// FocusGained flag.
1633 /// <since_tizen> 3 </since_tizen>
1634 public bool FocusGained
1642 /// The touch event argument.
1644 /// <since_tizen> 3 </since_tizen>
1645 public class TouchEventArgs : EventArgs
1647 private Touch _touch;
1652 /// <since_tizen> 3 </since_tizen>
1667 /// Wheel event arguments.
1669 /// <since_tizen> 3 </since_tizen>
1670 public class WheelEventArgs : EventArgs
1672 private Wheel _wheel;
1677 /// <since_tizen> 3 </since_tizen>
1692 /// Key event arguments.
1694 /// <since_tizen> 3 </since_tizen>
1695 public class KeyEventArgs : EventArgs
1702 /// <since_tizen> 3 </since_tizen>
1717 /// Sets position and size of the window. This API guarantees that
1718 /// both moving and resizing of window will appear on the screen at once.
1720 [EditorBrowsable(EditorBrowsableState.Never)]
1721 public Rectangle WindowPositionSize
1725 Position2D position = GetPosition();
1726 Size2D size = GetSize();
1727 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1732 SetPositionSize(value);
1737 /// Feeds a key event into the window.
1738 /// This resized event arguments.
1740 /// <since_tizen> 3 </since_tizen>
1741 public class ResizedEventArgs : EventArgs
1746 /// This window size.
1748 /// <since_tizen> 4 </since_tizen>
1749 public Size2D WindowSize
1757 _windowSize = value;
1763 /// Please do not use! this will be deprecated
1765 /// <since_tizen> 3 </since_tizen>
1766 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1768 "Window.Instance.FocusChanged = OnFocusChanged; " +
1769 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1770 [EditorBrowsable(EditorBrowsableState.Never)]
1771 public class WindowFocusChangedEventArgs : EventArgs
1774 /// Please do not use! this will be deprecated
1776 /// <since_tizen> 3 </since_tizen>
1777 public bool FocusGained
1785 /// Contains and encapsulates Native Window handle.
1787 /// <since_tizen> 4 </since_tizen>
1788 public class SafeNativeWindowHandle : SafeHandle
1791 /// Contructor, Native window handle is set to handle.
1793 /// <since_tizen> 4 </since_tizen>
1794 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1796 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1799 /// Null check if the handle is valid or not.
1801 /// <since_tizen> 4 </since_tizen>
1802 public override bool IsInvalid
1806 return this.handle == IntPtr.Zero;
1810 /// Release handle itself.
1812 /// <returns>true when released successfully.</returns>
1813 /// <since_tizen> 4 </since_tizen>
1814 protected override bool ReleaseHandle()
1821 /// Disconnect all native signals
1823 /// <since_tizen> 5 </since_tizen>
1824 internal void DisconnectNativeSignals()
1826 if( _windowFocusChangedEventCallback != null )
1828 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1831 if( _rootLayerTouchDataCallback != null )
1833 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1836 if( _wheelEventCallback != null )
1838 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1841 if( _stageKeyCallbackDelegate != null )
1843 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1846 if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1848 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1851 if( _stageContextLostEventCallbackDelegate != null )
1853 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1856 if( _stageContextRegainedEventCallbackDelegate != null )
1858 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1861 if( _stageSceneCreatedEventCallbackDelegate != null )
1863 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1866 if( _windowResizedEventCallback != null )
1868 ResizedSignal().Disconnect(_windowResizedEventCallback);
1871 if( _windowFocusChangedEventCallback2 != null )
1873 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);