2 * Copyright(c) 2018 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 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
58 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
59 if (NDalicPINVOKE.Stage_IsInstalled())
61 global::System.IntPtr rootLayoutIntPtr;
62 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
63 // Create a root layout (AbsoluteLayout) that is invisible to the user but enables layouts added to the Window
64 // Enables layouts added to the Window to have a parent layout. As parent layout is needed to store measure spec properties.
65 // Currently without these measure specs the new layout added will always be the size of the window.
66 rootLayoutIntPtr = NDalicManualPINVOKE.Window_NewRootLayout();
67 // Store HandleRef used by Add()
68 rootLayoutCPtr = new global::System.Runtime.InteropServices.HandleRef(this, rootLayoutIntPtr);
69 Layer rootLayer = GetRootLayer();
70 // Add the root layout created above to the root layer.
71 NDalicPINVOKE.Actor_Add( Layer.getCPtr(rootLayer), rootLayoutCPtr );
72 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74 global::System.IntPtr rootControlLayoutIntPtr = Tizen.NUI.NDalicManualPINVOKE.GetLayout__SWIG_1(rootLayoutCPtr);
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
77 rootLayoutItem = new LayoutItem(rootControlLayoutIntPtr, true);
81 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
88 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
93 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
98 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
101 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
102 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
103 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
104 private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
105 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
106 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
107 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
108 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
109 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
110 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
113 /// FocusChanged event.
115 /// <since_tizen> 3 </since_tizen>
116 public event EventHandler<FocusChangedEventArgs> FocusChanged
120 if (_windowFocusChangedEventHandler == null)
122 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
123 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
126 _windowFocusChangedEventHandler += value;
130 _windowFocusChangedEventHandler -= value;
132 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
134 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
140 /// This event is emitted when the screen is touched and when the touch ends.<br />
141 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
142 /// then when the last finger is lifted.<br />
143 /// An interrupted event will also be emitted (if it occurs).<br />
145 /// <since_tizen> 3 </since_tizen>
146 public event EventHandler<TouchEventArgs> TouchEvent
150 if (_rootLayerTouchDataEventHandler == null)
152 _rootLayerTouchDataCallback = OnWindowTouch;
153 this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
155 _rootLayerTouchDataEventHandler += value;
159 _rootLayerTouchDataEventHandler -= value;
160 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
162 this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
168 /// This event is emitted when the wheel event is received.
170 /// <since_tizen> 3 </since_tizen>
171 public event EventHandler<WheelEventArgs> WheelEvent
175 if (_stageWheelHandler == null)
177 _wheelEventCallback = OnStageWheel;
178 this.StageWheelEventSignal().Connect(_wheelEventCallback);
180 _stageWheelHandler += value;
184 _stageWheelHandler -= value;
185 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
187 this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
193 /// This event is emitted when the key event is received.
195 /// <since_tizen> 3 </since_tizen>
196 public event EventHandler<KeyEventArgs> KeyEvent
200 if (_stageKeyHandler == null)
202 _stageKeyCallbackDelegate = OnStageKey;
203 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
205 _stageKeyHandler += value;
209 _stageKeyHandler -= value;
210 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
212 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
218 /// This event is emitted when the window resized.
220 /// <since_tizen> 3 </since_tizen>
221 public event EventHandler<ResizedEventArgs> Resized
225 if (_windowResizedEventHandler == null)
227 _windowResizedEventCallback = OnResized;
228 ResizedSignal().Connect(_windowResizedEventCallback);
231 _windowResizedEventHandler += value;
235 _windowResizedEventHandler -= value;
237 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
239 ResizedSignal().Disconnect(_windowResizedEventCallback);
245 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
247 /// <since_tizen> 3 </since_tizen>
248 /// Please do not use! this will be deprecated!
249 /// Instead please use FocusChanged.
250 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
252 "Window.Instance.FocusChanged = OnFocusChanged; " +
253 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
254 [EditorBrowsable(EditorBrowsableState.Never)]
255 public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
259 if (_windowFocusChangedEventHandler2 == null)
261 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
262 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
265 _windowFocusChangedEventHandler2 += value;
269 _windowFocusChangedEventHandler2 -= value;
271 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
273 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
278 internal event EventHandler EventProcessingFinished
282 if (_stageEventProcessingFinishedEventHandler == null)
284 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
285 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
287 _stageEventProcessingFinishedEventHandler += value;
292 _stageEventProcessingFinishedEventHandler -= value;
293 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
295 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
300 internal event EventHandler ContextLost
304 if (_stageContextLostEventHandler == null)
306 _stageContextLostEventCallbackDelegate = OnContextLost;
307 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
309 _stageContextLostEventHandler += value;
313 _stageContextLostEventHandler -= value;
314 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
316 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
321 internal event EventHandler ContextRegained
325 if (_stageContextRegainedEventHandler == null)
327 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
328 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
330 _stageContextRegainedEventHandler += value;
334 _stageContextRegainedEventHandler -= value;
335 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
337 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
342 internal event EventHandler SceneCreated
346 if (_stageSceneCreatedEventHandler == null)
348 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
349 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
351 _stageSceneCreatedEventHandler += value;
355 _stageSceneCreatedEventHandler -= value;
356 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
358 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
363 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
364 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
365 private event EventHandler<WheelEventArgs> _stageWheelHandler;
366 private event EventHandler<KeyEventArgs> _stageKeyHandler;
367 private event EventHandler _stageEventProcessingFinishedEventHandler;
368 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
369 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
372 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
374 /// <since_tizen> 3 </since_tizen>
375 public enum WindowOrientation
378 /// Portrait orientation. The height of the display area is greater than the width.
380 /// <since_tizen> 3 </since_tizen>
383 /// Landscape orientation. A wide view area is needed.
385 /// <since_tizen> 3 </since_tizen>
388 /// Portrait inverse orientation.
390 /// <since_tizen> 3 </since_tizen>
391 PortraitInverse = 180,
393 /// Landscape inverse orientation.
395 /// <since_tizen> 3 </since_tizen>
396 LandscapeInverse = 270
400 /// Enumeration for the key grab mode for platform-level APIs.
402 /// <since_tizen> 3 </since_tizen>
403 public enum KeyGrabMode
406 /// Grabs a key only when on the top of the grabbing-window stack mode.
410 /// Grabs a key together with the other client window(s) mode.
414 /// 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.
418 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
424 /// Enumeration for opacity of the indicator.
426 internal enum IndicatorBackgroundOpacity
434 /// Enumeration for visible mode of the indicator.
436 internal enum IndicatorVisibleMode
444 /// The stage instance property (read-only).<br />
445 /// Gets the current window.<br />
447 /// <since_tizen> 3 </since_tizen>
448 public static Window Instance
457 /// Gets or sets a window type.
459 /// <since_tizen> 3 </since_tizen>
460 public WindowType Type
464 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
465 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
470 NDalicPINVOKE.SetType(swigCPtr, (int)value);
471 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
476 /// Gets/Sets a window title.
478 /// <since_tizen> 4 </since_tizen>
487 _windowTitle = value;
488 SetClass(_windowTitle, "");
493 /// The rendering behavior of a Window.
495 /// <since_tizen> 5 </since_tizen>
496 public RenderingBehaviorType RenderingBehavior
500 return GetRenderingBehavior();
504 SetRenderingBehavior(value);
509 /// The window size property (read-only).
511 /// <since_tizen> 3 </since_tizen>
516 Size2D ret = GetSize();
522 /// The background color property.
524 /// <since_tizen> 3 </since_tizen>
525 public Color BackgroundColor
529 SetBackgroundColor(value);
533 Color ret = GetBackgroundColor();
539 /// The DPI property (read-only).<br />
540 /// Retrieves the DPI of the display device to which the Window is connected.<br />
542 /// <since_tizen> 3 </since_tizen>
552 /// The layer count property (read-only).<br />
553 /// Queries the number of on-Window layers.<br />
555 /// <since_tizen> 3 </since_tizen>
556 public uint LayerCount
560 return GetLayerCount();
565 /// Gets or sets a size of the window.
567 /// <since_tizen> 4 </since_tizen>
568 public Size2D WindowSize
572 return GetWindowSize();
576 SetWindowSize(value);
581 /// Gets or sets a position of the window.
583 /// <since_tizen> 4 </since_tizen>
584 public Position2D WindowPosition
588 return GetPosition();
595 internal static Vector4 DEFAULT_BACKGROUND_COLOR
599 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
600 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
601 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
606 internal static Vector4 DEBUG_BACKGROUND_COLOR
610 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
611 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
612 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
617 internal List<Layer> LayersChildren
626 /// Feed a key-event into the window.
628 /// <param name="keyEvent">The key event to feed.</param>
629 /// <since_tizen> 4 </since_tizen>
630 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
631 public static void FeedKeyEvent(Key keyEvent)
633 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
634 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
638 /// Sets whether the window accepts a focus or not.
640 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
641 /// <since_tizen> 3 </since_tizen>
642 public void SetAcceptFocus(bool accept)
644 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
645 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
649 /// Returns whether the window accepts a focus or not.
651 /// <returns>True if the window accepts a focus, false otherwise.</returns>
652 /// <since_tizen> 3 </since_tizen>
653 public bool IsFocusAcceptable()
655 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
656 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
662 /// Shows the window if it is hidden.
664 /// <since_tizen> 3 </since_tizen>
667 NDalicPINVOKE.Show(swigCPtr);
668 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
672 /// Hides the window if it is showing.
674 /// <since_tizen> 3 </since_tizen>
677 NDalicPINVOKE.Hide(swigCPtr);
678 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
682 /// Retrieves whether the window is visible or not.
684 /// <returns>True if the window is visible.</returns>
685 /// <since_tizen> 3 </since_tizen>
686 public bool IsVisible()
688 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
689 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
694 /// Gets the count of supported auxiliary hints of the window.
696 /// <returns>The number of supported auxiliary hints.</returns>
697 /// <since_tizen> 3 </since_tizen>
698 public uint GetSupportedAuxiliaryHintCount()
700 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
701 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
706 /// Gets the supported auxiliary hint string of the window.
708 /// <param name="index">The index of the supported auxiliary hint lists.</param>
709 /// <returns>The auxiliary hint string of the index.</returns>
710 /// <since_tizen> 3 </since_tizen>
711 public string GetSupportedAuxiliaryHint(uint index)
713 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
719 /// Creates an auxiliary hint of the window.
721 /// <param name="hint">The auxiliary hint string.</param>
722 /// <param name="value">The value string.</param>
723 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
724 /// <since_tizen> 3 </since_tizen>
725 public uint AddAuxiliaryHint(string hint, string value)
727 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
728 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
733 /// Removes an auxiliary hint of the window.
735 /// <param name="id">The ID of the auxiliary hint.</param>
736 /// <returns>True if no error occurred, false otherwise.</returns>
737 /// <since_tizen> 3 </since_tizen>
738 public bool RemoveAuxiliaryHint(uint id)
740 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
741 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
746 /// Changes a value of the auxiliary hint.
748 /// <param name="id">The auxiliary hint ID.</param>
749 /// <param name="value">The value string to be set.</param>
750 /// <returns>True if no error occurred, false otherwise.</returns>
751 /// <since_tizen> 3 </since_tizen>
752 public bool SetAuxiliaryHintValue(uint id, string value)
754 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
755 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
760 /// Gets a value of the auxiliary hint.
762 /// <param name="id">The auxiliary hint ID.</param>
763 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
764 /// <since_tizen> 3 </since_tizen>
765 public string GetAuxiliaryHintValue(uint id)
767 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
768 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
773 /// Gets an ID of the auxiliary hint string.
775 /// <param name="hint">The auxiliary hint string.</param>
776 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
777 /// <since_tizen> 3 </since_tizen>
778 public uint GetAuxiliaryHintId(string hint)
780 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
781 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
786 /// Sets a region to accept input events.
788 /// <param name="inputRegion">The region to accept input events.</param>
789 /// <since_tizen> 3 </since_tizen>
790 public void SetInputRegion(Rectangle inputRegion)
792 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
793 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
797 /// Sets a priority level for the specified notification window.
799 /// <param name="level">The notification window level.</param>
800 /// <returns>True if no error occurred, false otherwise.</returns>
801 /// <since_tizen> 3 </since_tizen>
802 public bool SetNotificationLevel(NotificationLevel level)
804 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
805 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
810 /// Gets a priority level for the specified notification window.
812 /// <returns>The notification window level.</returns>
813 /// <since_tizen> 3 </since_tizen>
814 public NotificationLevel GetNotificationLevel()
816 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
817 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 /// Sets a transparent window's visual state to opaque. <br />
823 /// If a visual state of a transparent window is opaque, <br />
824 /// then the window manager could handle it as an opaque window when calculating visibility.
826 /// <param name="opaque">Whether the window's visual state is opaque.</param>
827 /// <remarks>This will have no effect on an opaque window. <br />
828 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
830 /// <since_tizen> 3 </since_tizen>
831 public void SetOpaqueState(bool opaque)
833 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
834 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838 /// Returns whether a transparent window's visual state is opaque or not.
840 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
841 /// <remarks> The return value has no meaning on an opaque window. </remarks>
842 /// <since_tizen> 3 </since_tizen>
843 public bool IsOpaqueState()
845 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
846 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
851 /// Sets a window's screen off mode.
853 /// <param name="screenOffMode">The screen mode.</param>
854 /// <returns>True if no error occurred, false otherwise.</returns>
855 /// <since_tizen> 4 </since_tizen>
856 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
858 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
859 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
864 /// Gets the screen mode of the window.
866 /// <returns>The screen off mode.</returns>
867 /// <since_tizen> 4 </since_tizen>
868 public ScreenOffMode GetScreenOffMode()
870 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
871 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
876 /// Sets preferred brightness of the window.
878 /// <param name="brightness">The preferred brightness (0 to 100).</param>
879 /// <returns>True if no error occurred, false otherwise.</returns>
880 /// <since_tizen> 3 </since_tizen>
881 public bool SetBrightness(int brightness)
883 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
884 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
889 /// Gets the preferred brightness of the window.
891 /// <returns>The preferred brightness.</returns>
892 /// <since_tizen> 3 </since_tizen>
893 public int GetBrightness()
895 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
896 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
901 /// Sets the window name and the class string.
903 /// <param name="name">The name of the window.</param>
904 /// <param name="klass">The class of the window.</param>
905 /// <since_tizen> 4 </since_tizen>
906 public void SetClass(string name, string klass)
908 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
909 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
913 /// Raises the window to the top of the window stack.
915 /// <since_tizen> 3 </since_tizen>
918 NDalicPINVOKE.Window_Raise(swigCPtr);
919 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
923 /// Lowers the window to the bottom of the window stack.
925 /// <since_tizen> 3 </since_tizen>
928 NDalicPINVOKE.Window_Lower(swigCPtr);
929 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
933 /// Activates the window to the top of the window stack even it is iconified.
935 /// <since_tizen> 3 </since_tizen>
936 public void Activate()
938 NDalicPINVOKE.Window_Activate(swigCPtr);
939 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
943 /// Gets the default ( root ) layer.
945 /// <returns>The root layer.</returns>
946 /// <since_tizen> 3 </since_tizen>
947 public Layer GetDefaultLayer()
949 return this.GetRootLayer();
953 /// Add a child view to window.
955 /// <param name="view">the child should be added to the window.</param>
956 /// <since_tizen> 3 </since_tizen>
957 public void Add(View view)
959 NDalicPINVOKE.Actor_Add(rootLayoutCPtr, View.getCPtr(view));
960 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
961 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
962 view.InternalParent = this.GetRootLayer();
966 /// Remove a child view from window.
968 /// <param name="view">the child to be removed.</param>
969 /// <since_tizen> 3 </since_tizen>
970 public void Remove(View view)
972 NDalicPINVOKE.Actor_Remove(rootLayoutCPtr, View.getCPtr(view));
973 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
974 view.InternalParent = null;
978 /// Retrieves the layer at a specified depth.
980 /// <param name="depth">The layer's depth index.</param>
981 /// <returns>The layer found at the given depth.</returns>
982 /// <since_tizen> 3 </since_tizen>
983 public Layer GetLayer(uint depth)
985 if (depth < LayersChildren.Count)
987 Layer ret = LayersChildren[Convert.ToInt32(depth)];
997 /// Keep rendering for at least the given amount of time.
999 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1000 /// <since_tizen> 3 </since_tizen>
1001 public void KeepRendering(float durationSeconds)
1003 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
1004 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1008 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1009 /// This function can be used for following example scenarios: <br />
1010 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1012 /// <param name="DaliKey">The key code to grab.</param>
1013 /// <returns>True if the grab succeeds.</returns>
1014 /// <since_tizen> 3 </since_tizen>
1015 public bool GrabKeyTopmost(int DaliKey)
1017 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1018 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1023 /// Ungrabs the key specified by a key for the window.<br />
1024 /// 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 />
1026 /// <param name="DaliKey">The key code to ungrab.</param>
1027 /// <returns>True if the ungrab succeeds.</returns>
1028 /// <since_tizen> 3 </since_tizen>
1029 public bool UngrabKeyTopmost(int DaliKey)
1031 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1032 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1037 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1038 /// Details: This function can be used for following example scenarios: <br />
1039 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1040 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1041 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1043 /// <param name="DaliKey">The key code to grab.</param>
1044 /// <param name="GrabMode">The grab mode for the key.</param>
1045 /// <returns>True if the grab succeeds.</returns>
1046 /// <since_tizen> 3 </since_tizen>
1047 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1049 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1050 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1055 /// Ungrabs the key specified by a key for a window.<br />
1056 /// 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 />
1058 /// <param name="DaliKey">The key code to ungrab.</param>
1059 /// <returns>True if the ungrab succeeds.</returns>
1060 /// <since_tizen> 3 </since_tizen>
1061 public bool UngrabKey(int DaliKey)
1063 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1064 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1069 /// Sets the keyboard repeat information.
1071 /// <param name="rate">The key repeat rate value in seconds.</param>
1072 /// <param name="delay">The key repeat delay value in seconds.</param>
1073 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1074 /// <since_tizen> 5 </since_tizen>
1075 public bool SetKeyboardRepeatInfo(float rate, float delay)
1077 bool ret = NDalicManualPINVOKE.SetKeyboardRepeatInfo(rate, delay);
1078 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1083 /// Gets the keyboard repeat information.
1085 /// <param name="rate">The key repeat rate value in seconds.</param>
1086 /// <param name="delay">The key repeat delay value in seconds.</param>
1087 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1088 /// <since_tizen> 5 </since_tizen>
1089 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1091 bool ret = NDalicManualPINVOKE.GetKeyboardRepeatInfo(out rate, out delay);
1092 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1097 /// Adds a layer to the stage.
1099 /// <param name="layer">Layer to add.</param>
1100 /// <since_tizen> 3 </since_tizen>
1101 public void AddLayer(Layer layer)
1103 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1106 LayersChildren.Add(layer);
1110 /// Removes a layer from the stage.
1112 /// <param name="layer">Layer to remove.</param>
1113 /// <since_tizen> 3 </since_tizen>
1114 public void RemoveLayer(Layer layer)
1116 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1119 LayersChildren.Remove(layer);
1123 /// Feeds a key event into the window.
1125 /// <param name="keyEvent">The key event to feed.</param>
1126 /// <since_tizen> 5 </since_tizen>
1127 public void FeedKey(Key keyEvent)
1129 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1134 /// Allows at least one more render, even when paused.
1135 /// The window should be shown, not minimised.
1137 /// <since_tizen> 4 </since_tizen>
1138 public void RenderOnce()
1140 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1144 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1146 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1149 internal static Window GetCurrent()
1151 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
1152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1156 internal static bool IsInstalled()
1158 bool ret = NDalicPINVOKE.Stage_IsInstalled();
1159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1163 internal WindowFocusSignalType WindowFocusChangedSignal()
1165 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
1166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1170 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1172 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1176 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1178 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1182 internal void RotateIndicator(Window.WindowOrientation orientation)
1184 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
1185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1188 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1190 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1194 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1196 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1200 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1202 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1206 internal Window.WindowOrientation GetPreferredOrientation()
1208 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
1209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1213 internal DragAndDropDetector GetDragAndDropDetector()
1215 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
1216 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1220 internal Any GetNativeHandle()
1222 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
1223 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1227 internal WindowFocusSignalType FocusChangedSignal()
1229 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
1230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1234 internal void Add(Layer layer)
1236 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1237 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239 LayersChildren.Add(layer);
1242 internal void Remove(Layer layer)
1244 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1247 LayersChildren.Remove(layer);
1250 internal Vector2 GetSize()
1252 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
1253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1257 internal RenderTaskList GetRenderTaskList()
1259 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
1260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1265 /// Queries the number of on-window layers.
1267 /// <returns>The number of layers.</returns>
1268 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1269 internal uint GetLayerCount()
1271 if (LayersChildren == null || LayersChildren.Count < 0)
1274 return (uint) LayersChildren.Count;
1277 internal Layer GetRootLayer()
1279 // Window.IsInstalled() is actually true only when called from event thread and
1280 // Core has been initialized, not when Stage is ready.
1281 if (_rootLayer == null && Window.IsInstalled())
1283 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
1284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1285 LayersChildren.Add(_rootLayer);
1290 internal void SetBackgroundColor(Vector4 color)
1292 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
1293 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1296 internal Vector4 GetBackgroundColor()
1298 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
1299 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1303 internal Vector2 GetDpi()
1305 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
1306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1310 internal ObjectRegistry GetObjectRegistry()
1312 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
1313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1317 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1319 NDalicPINVOKE.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1320 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1323 internal RenderingBehaviorType GetRenderingBehavior()
1325 RenderingBehaviorType ret = (RenderingBehaviorType)NDalicPINVOKE.Stage_GetRenderingBehavior(stageCPtr);
1326 if (NDalicPINVOKE.SWIGPendingException.Pending)
1327 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1331 internal KeyEventSignal KeyEventSignal()
1333 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
1334 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1338 internal VoidSignal EventProcessingFinishedSignal()
1340 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1341 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1345 internal TouchSignal TouchSignal()
1347 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
1348 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1352 internal TouchDataSignal TouchDataSignal()
1354 TouchDataSignal ret = new TouchDataSignal(NDalicPINVOKE.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1355 if (NDalicPINVOKE.SWIGPendingException.Pending)
1356 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1360 internal VoidSignal ContextLostSignal()
1362 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
1363 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1367 internal VoidSignal ContextRegainedSignal()
1369 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
1370 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1374 internal VoidSignal SceneCreatedSignal()
1376 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
1377 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1381 internal ResizedSignal ResizedSignal()
1383 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
1384 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1388 internal void SetWindowSize(Size2D size)
1390 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1391 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1393 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1395 if(rootLayoutItem != null)
1397 rootLayoutItem.RequestLayout();
1401 internal Size2D GetWindowSize()
1403 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1404 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1406 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1410 internal void SetPosition(Position2D position)
1412 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1413 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1415 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1417 if(rootLayoutItem != null)
1419 rootLayoutItem.RequestLayout();
1423 internal Position2D GetPosition()
1425 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1426 Position2D ret = new Position2D(val.GetX(), val.GetY());
1428 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1432 internal void SetPositionSize(Rectangle positionSize)
1434 NDalicPINVOKE.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1436 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1438 if(rootLayoutItem != null)
1440 rootLayoutItem.RequestLayout();
1445 /// Sets whether the window is transparent or not.
1447 /// <param name="transparent">Whether the window is transparent or not.</param>
1448 /// <since_tizen> 5 </since_tizen>
1449 public void SetTransparency(bool transparent) {
1450 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1451 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1453 if(rootLayoutItem != null)
1455 rootLayoutItem.RequestLayout();
1459 internal System.IntPtr GetNativeWindowHandler()
1461 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1462 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1466 private void OnWindowFocusedChanged(bool focusGained)
1468 FocusChangedEventArgs e = new FocusChangedEventArgs();
1470 e.FocusGained = focusGained;
1472 if (_windowFocusChangedEventHandler != null)
1474 _windowFocusChangedEventHandler(this, e);
1478 private StageWheelSignal WheelEventSignal()
1480 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
1481 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1485 private WheelSignal StageWheelEventSignal()
1487 WheelSignal ret = new WheelSignal(NDalicPINVOKE.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1488 if (NDalicPINVOKE.SWIGPendingException.Pending)
1489 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1493 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1495 if (touchData == global::System.IntPtr.Zero)
1497 NUILog.Error("touchData should not be null!");
1501 TouchEventArgs e = new TouchEventArgs();
1503 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1505 if (_rootLayerTouchDataEventHandler != null)
1507 _rootLayerTouchDataEventHandler(this, e);
1512 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1514 if (wheelEvent == global::System.IntPtr.Zero)
1516 NUILog.Error("wheelEvent should not be null!");
1520 WheelEventArgs e = new WheelEventArgs();
1522 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1524 if (_stageWheelHandler != null)
1526 _stageWheelHandler(this, e);
1531 // Callback for Stage KeyEventsignal
1532 private void OnStageKey(IntPtr data)
1534 KeyEventArgs e = new KeyEventArgs();
1538 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1541 if (_stageKeyHandler != null)
1543 //here we send all data to user event handlers
1544 _stageKeyHandler(this, e);
1548 // Callback for Stage EventProcessingFinishedSignal
1549 private void OnEventProcessingFinished()
1551 if (_stageEventProcessingFinishedEventHandler != null)
1553 _stageEventProcessingFinishedEventHandler(this, null);
1557 // Callback for Stage ContextLostSignal
1558 private void OnContextLost()
1560 if (_stageContextLostEventHandler != null)
1562 _stageContextLostEventHandler(this, null);
1566 // Callback for Stage ContextRegainedSignal
1567 private void OnContextRegained()
1569 if (_stageContextRegainedEventHandler != null)
1571 _stageContextRegainedEventHandler(this, null);
1575 // Callback for Stage SceneCreatedSignal
1576 private void OnSceneCreated()
1578 if (_stageSceneCreatedEventHandler != null)
1580 _stageSceneCreatedEventHandler(this, null);
1584 private void OnResized(IntPtr windowSize)
1586 ResizedEventArgs e = new ResizedEventArgs();
1587 var val = new Uint16Pair(windowSize, false);
1588 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1591 if (_windowResizedEventHandler != null)
1593 _windowResizedEventHandler(this, e);
1597 private void OnWindowFocusedChanged2(bool focusGained)
1599 FocusChangedEventArgs e = new FocusChangedEventArgs();
1601 e.FocusGained = focusGained;
1603 if (_windowFocusChangedEventHandler2 != null)
1605 _windowFocusChangedEventHandler2(this, e);
1610 /// The focus changed event argument.
1612 /// <since_tizen> 3 </since_tizen>
1613 public class FocusChangedEventArgs : EventArgs
1616 /// FocusGained flag.
1618 /// <since_tizen> 3 </since_tizen>
1619 public bool FocusGained
1627 /// The touch event argument.
1629 /// <since_tizen> 3 </since_tizen>
1630 public class TouchEventArgs : EventArgs
1632 private Touch _touch;
1637 /// <since_tizen> 3 </since_tizen>
1652 /// Wheel event arguments.
1654 /// <since_tizen> 3 </since_tizen>
1655 public class WheelEventArgs : EventArgs
1657 private Wheel _wheel;
1662 /// <since_tizen> 3 </since_tizen>
1677 /// Key event arguments.
1679 /// <since_tizen> 3 </since_tizen>
1680 public class KeyEventArgs : EventArgs
1687 /// <since_tizen> 3 </since_tizen>
1702 /// Sets position and size of the window. This API guarantees that
1703 /// both moving and resizing of window will appear on the screen at once.
1705 [EditorBrowsable(EditorBrowsableState.Never)]
1706 public Rectangle WindowPositionSize
1710 Position2D position = GetPosition();
1711 Size2D size = GetSize();
1712 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1717 SetPositionSize(value);
1722 /// Feeds a key event into the window.
1723 /// This resized event arguments.
1725 /// <since_tizen> 3 </since_tizen>
1726 public class ResizedEventArgs : EventArgs
1731 /// This window size.
1733 /// <since_tizen> 4 </since_tizen>
1734 public Size2D WindowSize
1742 _windowSize = value;
1748 /// Please do not use! this will be deprecated
1750 /// <since_tizen> 3 </since_tizen>
1751 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1753 "Window.Instance.FocusChanged = OnFocusChanged; " +
1754 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1755 [EditorBrowsable(EditorBrowsableState.Never)]
1756 public class WindowFocusChangedEventArgs : EventArgs
1759 /// Please do not use! this will be deprecated
1761 /// <since_tizen> 3 </since_tizen>
1762 public bool FocusGained
1770 /// Contains and encapsulates Native Window handle.
1772 /// <since_tizen> 4 </since_tizen>
1773 public class SafeNativeWindowHandle : SafeHandle
1776 /// Contructor, Native window handle is set to handle.
1778 /// <since_tizen> 4 </since_tizen>
1779 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1781 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1784 /// Null check if the handle is valid or not.
1786 /// <since_tizen> 4 </since_tizen>
1787 public override bool IsInvalid
1791 return this.handle == IntPtr.Zero;
1795 /// Release handle itself.
1797 /// <returns>true when released successfully.</returns>
1798 /// <since_tizen> 4 </since_tizen>
1799 protected override bool ReleaseHandle()
1806 /// Disconnect all native signals
1808 /// <since_tizen> 5 </since_tizen>
1809 internal void DisconnectNativeSignals()
1811 if( _windowFocusChangedEventCallback != null )
1813 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1816 if( _rootLayerTouchDataCallback != null )
1818 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1821 if( _wheelEventCallback != null )
1823 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1826 if( _stageKeyCallbackDelegate != null )
1828 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1831 if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1833 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1836 if( _stageContextLostEventCallbackDelegate != null )
1838 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1841 if( _stageContextRegainedEventCallbackDelegate != null )
1843 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1846 if( _stageSceneCreatedEventCallbackDelegate != null )
1848 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1851 if( _windowResizedEventCallback != null )
1853 ResizedSignal().Disconnect(_windowResizedEventCallback);
1856 if( _windowFocusChangedEventCallback2 != null )
1858 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);