4 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.BaseComponents;
22 using System.ComponentModel;
23 using System.Collections.Generic;
28 /// The window class is used internally for drawing.<br />
29 /// The window has an orientation and indicator properties.<br />
31 /// <since_tizen> 3 </since_tizen>
32 public class Window : BaseHandle
34 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35 private global::System.Runtime.InteropServices.HandleRef stageCPtr;
36 private Layer _rootLayer;
37 private string _windowTitle;
38 private List<Layer> _childLayers = new List<Layer>();
39 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
40 private RootLayerTouchDataCallbackType _rootLayerTouchDataCallback;
41 private WheelEventCallbackType _wheelEventCallback;
42 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
43 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
44 private EventHandler _stageContextLostEventHandler;
45 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
46 private EventHandler _stageContextRegainedEventHandler;
47 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
48 private EventHandler _stageSceneCreatedEventHandler;
49 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
50 private WindowResizedEventCallbackType _windowResizedEventCallback;
51 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
53 private static readonly Window instance = Application.Instance?.GetWindow();
55 private LayoutController localController;
57 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Window.Window_SWIGUpcast(cPtr), cMemoryOwn)
59 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
60 if (Interop.Stage.Stage_IsInstalled())
62 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.Stage_GetCurrent());
64 localController = new LayoutController(this);
65 NUILog.Debug("layoutController id:" + localController.GetId() );
69 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
71 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74 internal Window(Rectangle windowPosition, string name) : this(Interop.Window.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
76 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(Interop.Window.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
81 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
84 internal Window(Rectangle windowPosition, string name, string className) : this(Interop.Window.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
86 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
90 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
91 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
92 private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
93 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
94 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
95 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
96 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
97 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
98 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
101 /// FocusChanged event.
103 /// <since_tizen> 3 </since_tizen>
104 public event EventHandler<FocusChangedEventArgs> FocusChanged
108 if (_windowFocusChangedEventHandler == null)
110 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
111 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
114 _windowFocusChangedEventHandler += value;
118 _windowFocusChangedEventHandler -= value;
120 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
122 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
128 /// This event is emitted when the screen is touched and when the touch ends.<br />
129 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
130 /// then when the last finger is lifted.<br />
131 /// An interrupted event will also be emitted (if it occurs).<br />
133 /// <since_tizen> 3 </since_tizen>
134 public event EventHandler<TouchEventArgs> TouchEvent
138 if (_rootLayerTouchDataEventHandler == null)
140 _rootLayerTouchDataCallback = OnWindowTouch;
141 this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
143 _rootLayerTouchDataEventHandler += value;
147 _rootLayerTouchDataEventHandler -= value;
148 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
150 this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
156 /// This event is emitted when the wheel event is received.
158 /// <since_tizen> 3 </since_tizen>
159 public event EventHandler<WheelEventArgs> WheelEvent
163 if (_stageWheelHandler == null)
165 _wheelEventCallback = OnStageWheel;
166 this.StageWheelEventSignal().Connect(_wheelEventCallback);
168 _stageWheelHandler += value;
172 _stageWheelHandler -= value;
173 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
175 this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
181 /// This event is emitted when the key event is received.
183 /// <since_tizen> 3 </since_tizen>
184 public event EventHandler<KeyEventArgs> KeyEvent
188 if (_stageKeyHandler == null)
190 _stageKeyCallbackDelegate = OnStageKey;
191 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
193 _stageKeyHandler += value;
197 _stageKeyHandler -= value;
198 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
200 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
206 /// This event is emitted when the window resized.
208 /// <since_tizen> 3 </since_tizen>
209 public event EventHandler<ResizedEventArgs> Resized
213 if (_windowResizedEventHandler == null)
215 _windowResizedEventCallback = OnResized;
216 ResizedSignal().Connect(_windowResizedEventCallback);
219 _windowResizedEventHandler += value;
223 _windowResizedEventHandler -= value;
225 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
227 ResizedSignal().Disconnect(_windowResizedEventCallback);
233 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
235 /// <since_tizen> 3 </since_tizen>
236 /// Please do not use! this will be deprecated!
237 /// Instead please use FocusChanged.
238 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
240 "Window.Instance.FocusChanged = OnFocusChanged; " +
241 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
242 [EditorBrowsable(EditorBrowsableState.Never)]
243 public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
247 if (_windowFocusChangedEventHandler2 == null)
249 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
250 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
253 _windowFocusChangedEventHandler2 += value;
257 _windowFocusChangedEventHandler2 -= value;
259 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
261 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
267 /// ViewAdded will be triggered when the view added on Window
269 /// <since_tizen> 6 </since_tizen>
270 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
271 [EditorBrowsable(EditorBrowsableState.Never)]
272 public event EventHandler ViewAdded;
274 internal void SendViewAdded(View view)
276 ViewAdded?.Invoke(view, EventArgs.Empty);
279 internal event EventHandler EventProcessingFinished
283 if (_stageEventProcessingFinishedEventHandler == null)
285 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
286 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
288 _stageEventProcessingFinishedEventHandler += value;
293 _stageEventProcessingFinishedEventHandler -= value;
294 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
296 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
301 internal event EventHandler ContextLost
305 if (_stageContextLostEventHandler == null)
307 _stageContextLostEventCallbackDelegate = OnContextLost;
308 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
310 _stageContextLostEventHandler += value;
314 _stageContextLostEventHandler -= value;
315 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
317 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
322 internal event EventHandler ContextRegained
326 if (_stageContextRegainedEventHandler == null)
328 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
329 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
331 _stageContextRegainedEventHandler += value;
335 _stageContextRegainedEventHandler -= value;
336 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
338 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
343 internal event EventHandler SceneCreated
347 if (_stageSceneCreatedEventHandler == null)
349 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
350 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
352 _stageSceneCreatedEventHandler += value;
356 _stageSceneCreatedEventHandler -= value;
357 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
359 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
364 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
365 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
366 private event EventHandler<WheelEventArgs> _stageWheelHandler;
367 private event EventHandler<KeyEventArgs> _stageKeyHandler;
368 private event EventHandler _stageEventProcessingFinishedEventHandler;
369 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
370 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
373 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
375 /// <since_tizen> 3 </since_tizen>
376 public enum WindowOrientation
379 /// Portrait orientation. The height of the display area is greater than the width.
381 /// <since_tizen> 3 </since_tizen>
384 /// Landscape orientation. A wide view area is needed.
386 /// <since_tizen> 3 </since_tizen>
389 /// Portrait inverse orientation.
391 /// <since_tizen> 3 </since_tizen>
392 PortraitInverse = 180,
394 /// Landscape inverse orientation.
396 /// <since_tizen> 3 </since_tizen>
397 LandscapeInverse = 270
401 /// Enumeration for the key grab mode for platform-level APIs.
403 /// <since_tizen> 3 </since_tizen>
404 public enum KeyGrabMode
407 /// Grabs a key only when on the top of the grabbing-window stack mode.
411 /// Grabs a key together with the other client window(s) mode.
415 /// 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.
419 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
425 /// Enumeration for opacity of the indicator.
427 internal enum IndicatorBackgroundOpacity
435 /// Enumeration for visible mode of the indicator.
437 internal enum IndicatorVisibleMode
445 /// The stage instance property (read-only).<br />
446 /// Gets the current window.<br />
448 /// <since_tizen> 3 </since_tizen>
449 public static Window Instance
458 /// Gets or sets a window type.
460 /// <since_tizen> 3 </since_tizen>
461 public WindowType Type
465 WindowType ret = (WindowType)Interop.Window.GetType(swigCPtr);
466 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
471 Interop.Window.SetType(swigCPtr, (int)value);
472 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
477 /// Gets/Sets a window title.
479 /// <since_tizen> 4 </since_tizen>
488 _windowTitle = value;
489 SetClass(_windowTitle, "");
494 /// The rendering behavior of a Window.
496 /// <since_tizen> 5 </since_tizen>
497 public RenderingBehaviorType RenderingBehavior
501 return GetRenderingBehavior();
505 SetRenderingBehavior(value);
510 /// The window size property (read-only).
512 /// <since_tizen> 3 </since_tizen>
517 Size2D ret = GetSize();
523 /// The background color property.
525 /// <since_tizen> 3 </since_tizen>
526 public Color BackgroundColor
530 SetBackgroundColor(value);
534 Color ret = GetBackgroundColor();
540 /// The DPI property (read-only).<br />
541 /// Retrieves the DPI of the display device to which the Window is connected.<br />
543 /// <since_tizen> 3 </since_tizen>
553 /// The layer count property (read-only).<br />
554 /// Queries the number of on-Window layers.<br />
556 /// <since_tizen> 3 </since_tizen>
557 public uint LayerCount
561 return GetLayerCount();
566 /// Gets or sets a size of the window.
568 /// <since_tizen> 4 </since_tizen>
569 public Size2D WindowSize
573 return GetWindowSize();
577 SetWindowSize(value);
582 /// Gets or sets a position of the window.
584 /// <since_tizen> 4 </since_tizen>
585 public Position2D WindowPosition
589 return GetPosition();
596 internal static Vector4 DEFAULT_BACKGROUND_COLOR
600 global::System.IntPtr cPtr = Interop.Stage.Stage_DEFAULT_BACKGROUND_COLOR_get();
601 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
602 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
607 internal static Vector4 DEBUG_BACKGROUND_COLOR
611 global::System.IntPtr cPtr = Interop.Stage.Stage_DEBUG_BACKGROUND_COLOR_get();
612 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
613 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
618 internal List<Layer> LayersChildren
626 internal LayoutController LayoutController
630 return localController;
635 /// Feed a key-event into the window.
637 /// <param name="keyEvent">The key event to feed.</param>
638 /// <since_tizen> 4 </since_tizen>
639 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
640 public static void FeedKeyEvent(Key keyEvent)
642 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
643 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
647 /// Sets whether the window accepts a focus or not.
649 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
650 /// <since_tizen> 3 </since_tizen>
651 public void SetAcceptFocus(bool accept)
653 Interop.Window.SetAcceptFocus(swigCPtr, accept);
654 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
658 /// Returns whether the window accepts a focus or not.
660 /// <returns>True if the window accepts a focus, false otherwise.</returns>
661 /// <since_tizen> 3 </since_tizen>
662 public bool IsFocusAcceptable()
664 bool ret = Interop.Window.IsFocusAcceptable(swigCPtr);
665 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
671 /// Shows the window if it is hidden.
673 /// <since_tizen> 3 </since_tizen>
676 Interop.Window.Show(swigCPtr);
677 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
681 /// Hides the window if it is showing.
683 /// <since_tizen> 3 </since_tizen>
686 Interop.Window.Hide(swigCPtr);
687 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
691 /// Retrieves whether the window is visible or not.
693 /// <returns>True if the window is visible.</returns>
694 /// <since_tizen> 3 </since_tizen>
695 public bool IsVisible()
697 bool temp = Interop.Window.IsVisible(swigCPtr);
698 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
703 /// Gets the count of supported auxiliary hints of the window.
705 /// <returns>The number of supported auxiliary hints.</returns>
706 /// <since_tizen> 3 </since_tizen>
707 public uint GetSupportedAuxiliaryHintCount()
709 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(swigCPtr);
710 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
715 /// Gets the supported auxiliary hint string of the window.
717 /// <param name="index">The index of the supported auxiliary hint lists.</param>
718 /// <returns>The auxiliary hint string of the index.</returns>
719 /// <since_tizen> 3 </since_tizen>
720 public string GetSupportedAuxiliaryHint(uint index)
722 string ret = Interop.Window.GetSupportedAuxiliaryHint(swigCPtr, index);
723 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
728 /// Creates an auxiliary hint of the window.
730 /// <param name="hint">The auxiliary hint string.</param>
731 /// <param name="value">The value string.</param>
732 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
733 /// <since_tizen> 3 </since_tizen>
734 public uint AddAuxiliaryHint(string hint, string value)
736 uint ret = Interop.Window.AddAuxiliaryHint(swigCPtr, hint, value);
737 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
742 /// Removes an auxiliary hint of the window.
744 /// <param name="id">The ID of the auxiliary hint.</param>
745 /// <returns>True if no error occurred, false otherwise.</returns>
746 /// <since_tizen> 3 </since_tizen>
747 public bool RemoveAuxiliaryHint(uint id)
749 bool ret = Interop.Window.RemoveAuxiliaryHint(swigCPtr, id);
750 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
755 /// Changes a value of the auxiliary hint.
757 /// <param name="id">The auxiliary hint ID.</param>
758 /// <param name="value">The value string to be set.</param>
759 /// <returns>True if no error occurred, false otherwise.</returns>
760 /// <since_tizen> 3 </since_tizen>
761 public bool SetAuxiliaryHintValue(uint id, string value)
763 bool ret = Interop.Window.SetAuxiliaryHintValue(swigCPtr, id, value);
764 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769 /// Gets a value of the auxiliary hint.
771 /// <param name="id">The auxiliary hint ID.</param>
772 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
773 /// <since_tizen> 3 </since_tizen>
774 public string GetAuxiliaryHintValue(uint id)
776 string ret = Interop.Window.GetAuxiliaryHintValue(swigCPtr, id);
777 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782 /// Gets an ID of the auxiliary hint string.
784 /// <param name="hint">The auxiliary hint string.</param>
785 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
786 /// <since_tizen> 3 </since_tizen>
787 public uint GetAuxiliaryHintId(string hint)
789 uint ret = Interop.Window.GetAuxiliaryHintId(swigCPtr, hint);
790 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
795 /// Sets a region to accept input events.
797 /// <param name="inputRegion">The region to accept input events.</param>
798 /// <since_tizen> 3 </since_tizen>
799 public void SetInputRegion(Rectangle inputRegion)
801 Interop.Window.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
802 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
806 /// Sets a priority level for the specified notification window.
808 /// <param name="level">The notification window level.</param>
809 /// <returns>True if no error occurred, false otherwise.</returns>
810 /// <since_tizen> 3 </since_tizen>
811 public bool SetNotificationLevel(NotificationLevel level)
813 bool ret = Interop.Window.SetNotificationLevel(swigCPtr, (int)level);
814 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
819 /// Gets a priority level for the specified notification window.
821 /// <returns>The notification window level.</returns>
822 /// <since_tizen> 3 </since_tizen>
823 public NotificationLevel GetNotificationLevel()
825 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(swigCPtr);
826 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
831 /// Sets a transparent window's visual state to opaque. <br />
832 /// If a visual state of a transparent window is opaque, <br />
833 /// then the window manager could handle it as an opaque window when calculating visibility.
835 /// <param name="opaque">Whether the window's visual state is opaque.</param>
836 /// <remarks>This will have no effect on an opaque window. <br />
837 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
839 /// <since_tizen> 3 </since_tizen>
840 public void SetOpaqueState(bool opaque)
842 Interop.Window.SetOpaqueState(swigCPtr, opaque);
843 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
847 /// Returns whether a transparent window's visual state is opaque or not.
849 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
850 /// <remarks> The return value has no meaning on an opaque window. </remarks>
851 /// <since_tizen> 3 </since_tizen>
852 public bool IsOpaqueState()
854 bool ret = Interop.Window.IsOpaqueState(swigCPtr);
855 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
860 /// Sets a window's screen off mode.
862 /// <param name="screenOffMode">The screen mode.</param>
863 /// <returns>True if no error occurred, false otherwise.</returns>
864 /// <since_tizen> 4 </since_tizen>
865 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
867 bool ret = Interop.Window.SetScreenOffMode(swigCPtr, (int)screenOffMode);
868 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
873 /// Gets the screen mode of the window.
875 /// <returns>The screen off mode.</returns>
876 /// <since_tizen> 4 </since_tizen>
877 public ScreenOffMode GetScreenOffMode()
879 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(swigCPtr);
880 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
885 /// Sets preferred brightness of the window.
887 /// <param name="brightness">The preferred brightness (0 to 100).</param>
888 /// <returns>True if no error occurred, false otherwise.</returns>
889 /// <since_tizen> 3 </since_tizen>
890 public bool SetBrightness(int brightness)
892 bool ret = Interop.Window.SetBrightness(swigCPtr, brightness);
893 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
898 /// Gets the preferred brightness of the window.
900 /// <returns>The preferred brightness.</returns>
901 /// <since_tizen> 3 </since_tizen>
902 public int GetBrightness()
904 int ret = Interop.Window.GetBrightness(swigCPtr);
905 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
910 /// Sets the window name and the class string.
912 /// <param name="name">The name of the window.</param>
913 /// <param name="klass">The class of the window.</param>
914 /// <since_tizen> 4 </since_tizen>
915 public void SetClass(string name, string klass)
917 Interop.Window.Window_SetClass(swigCPtr, name, klass);
918 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
922 /// Raises the window to the top of the window stack.
924 /// <since_tizen> 3 </since_tizen>
927 Interop.Window.Window_Raise(swigCPtr);
928 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
932 /// Lowers the window to the bottom of the window stack.
934 /// <since_tizen> 3 </since_tizen>
937 Interop.Window.Window_Lower(swigCPtr);
938 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
942 /// Activates the window to the top of the window stack even it is iconified.
944 /// <since_tizen> 3 </since_tizen>
945 public void Activate()
947 Interop.Window.Window_Activate(swigCPtr);
948 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
952 /// Gets the default ( root ) layer.
954 /// <returns>The root layer.</returns>
955 /// <since_tizen> 3 </since_tizen>
956 public Layer GetDefaultLayer()
958 return this.GetRootLayer();
962 /// Add a child view to window.
964 /// <param name="view">the child should be added to the window.</param>
965 /// <since_tizen> 3 </since_tizen>
966 public void Add(View view)
968 Interop.Actor.Actor_Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
969 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
970 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
971 view.InternalParent = this.GetRootLayer();
975 /// Remove a child view from window.
977 /// <param name="view">the child to be removed.</param>
978 /// <since_tizen> 3 </since_tizen>
979 public void Remove(View view)
981 Interop.Actor.Actor_Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
982 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
983 view.InternalParent = null;
987 /// Retrieves the layer at a specified depth.
989 /// <param name="depth">The layer's depth index.</param>
990 /// <returns>The layer found at the given depth.</returns>
991 /// <since_tizen> 3 </since_tizen>
992 public Layer GetLayer(uint depth)
994 if (depth < LayersChildren?.Count)
996 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1006 /// Keep rendering for at least the given amount of time.
1008 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1009 /// <since_tizen> 3 </since_tizen>
1010 public void KeepRendering(float durationSeconds)
1012 Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds);
1013 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1017 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1018 /// This function can be used for following example scenarios: <br />
1019 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1021 /// <param name="DaliKey">The key code to grab.</param>
1022 /// <returns>True if the grab succeeds.</returns>
1023 /// <since_tizen> 3 </since_tizen>
1024 public bool GrabKeyTopmost(int DaliKey)
1026 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1027 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1032 /// Ungrabs the key specified by a key for the window.<br />
1033 /// 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 />
1035 /// <param name="DaliKey">The key code to ungrab.</param>
1036 /// <returns>True if the ungrab succeeds.</returns>
1037 /// <since_tizen> 3 </since_tizen>
1038 public bool UngrabKeyTopmost(int DaliKey)
1040 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1041 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1046 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1047 /// Details: This function can be used for following example scenarios: <br />
1048 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1049 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1050 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1052 /// <param name="DaliKey">The key code to grab.</param>
1053 /// <param name="GrabMode">The grab mode for the key.</param>
1054 /// <returns>True if the grab succeeds.</returns>
1055 /// <since_tizen> 3 </since_tizen>
1056 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1058 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1059 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1064 /// Ungrabs the key specified by a key for a window.<br />
1065 /// 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 />
1067 /// <param name="DaliKey">The key code to ungrab.</param>
1068 /// <returns>True if the ungrab succeeds.</returns>
1069 /// <since_tizen> 3 </since_tizen>
1070 public bool UngrabKey(int DaliKey)
1072 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1073 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1078 /// Sets the keyboard repeat information.
1080 /// <param name="rate">The key repeat rate value in seconds.</param>
1081 /// <param name="delay">The key repeat delay value in seconds.</param>
1082 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1083 /// <since_tizen> 5 </since_tizen>
1084 public bool SetKeyboardRepeatInfo(float rate, float delay)
1086 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1087 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1092 /// Gets the keyboard repeat information.
1094 /// <param name="rate">The key repeat rate value in seconds.</param>
1095 /// <param name="delay">The key repeat delay value in seconds.</param>
1096 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1097 /// <since_tizen> 5 </since_tizen>
1098 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1100 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1106 /// Adds a layer to the stage.
1108 /// <param name="layer">Layer to add.</param>
1109 /// <since_tizen> 3 </since_tizen>
1110 public void AddLayer(Layer layer)
1112 Interop.Stage.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1115 LayersChildren?.Add(layer);
1119 /// Removes a layer from the stage.
1121 /// <param name="layer">Layer to remove.</param>
1122 /// <since_tizen> 3 </since_tizen>
1123 public void RemoveLayer(Layer layer)
1125 Interop.Stage.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1128 LayersChildren?.Remove(layer);
1132 /// Feeds a key event into the window.
1134 /// <param name="keyEvent">The key event to feed.</param>
1135 /// <since_tizen> 5 </since_tizen>
1136 public void FeedKey(Key keyEvent)
1138 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1139 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1143 /// Allows at least one more render, even when paused.
1144 /// The window should be shown, not minimised.
1146 /// <since_tizen> 4 </since_tizen>
1147 public void RenderOnce()
1149 Interop.Window.Window_RenderOnce(swigCPtr);
1150 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1153 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1155 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1158 internal static Window GetCurrent()
1160 Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
1161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1165 internal static bool IsInstalled()
1167 bool ret = Interop.Stage.Stage_IsInstalled();
1168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1172 internal WindowFocusSignalType WindowFocusChangedSignal()
1174 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1179 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1181 Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1185 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1187 Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1191 internal void RotateIndicator(Window.WindowOrientation orientation)
1193 Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
1194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1197 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1199 Interop.WindowInternal.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1203 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1205 Interop.WindowInternal.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1209 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1211 Interop.WindowInternal.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1215 internal Window.WindowOrientation GetPreferredOrientation()
1217 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.WindowInternal.Window_GetPreferredOrientation(swigCPtr);
1218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1222 internal DragAndDropDetector GetDragAndDropDetector()
1224 DragAndDropDetector ret = new DragAndDropDetector(Interop.WindowInternal.Window_GetDragAndDropDetector(swigCPtr), true);
1225 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1229 internal Any GetNativeHandle()
1231 Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1236 internal WindowFocusSignalType FocusChangedSignal()
1238 WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1239 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1243 internal void Add(Layer layer)
1245 Interop.Stage.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1246 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1248 LayersChildren?.Add(layer);
1251 internal void Remove(Layer layer)
1253 Interop.Stage.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1254 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1256 LayersChildren?.Remove(layer);
1259 internal Vector2 GetSize()
1261 Vector2 ret = new Vector2(Interop.Stage.Stage_GetSize(stageCPtr), true);
1262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1266 internal RenderTaskList GetRenderTaskList()
1268 RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1274 /// Queries the number of on-window layers.
1276 /// <returns>The number of layers.</returns>
1277 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1278 internal uint GetLayerCount()
1280 if (LayersChildren == null || LayersChildren.Count < 0)
1283 return (uint) LayersChildren.Count;
1286 internal Layer GetRootLayer()
1288 // Window.IsInstalled() is actually true only when called from event thread and
1289 // Core has been initialized, not when Stage is ready.
1290 if (_rootLayer == null && Window.IsInstalled())
1292 _rootLayer = new Layer(Interop.Stage.Stage_GetRootLayer(stageCPtr), true);
1293 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1294 LayersChildren?.Add(_rootLayer);
1299 internal void SetBackgroundColor(Vector4 color)
1301 Interop.Stage.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
1302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1305 internal Vector4 GetBackgroundColor()
1307 Vector4 ret = new Vector4(Interop.Stage.Stage_GetBackgroundColor(stageCPtr), true);
1308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1312 internal Vector2 GetDpi()
1314 Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1315 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1319 internal ObjectRegistry GetObjectRegistry()
1321 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1322 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1326 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1328 Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1329 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1332 internal RenderingBehaviorType GetRenderingBehavior()
1334 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1335 if (NDalicPINVOKE.SWIGPendingException.Pending)
1336 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1340 internal KeyEventSignal KeyEventSignal()
1342 KeyEventSignal ret = new KeyEventSignal(Interop.StageSignal.Stage_KeyEventSignal(stageCPtr), false);
1343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1347 internal VoidSignal EventProcessingFinishedSignal()
1349 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1354 internal TouchSignal TouchSignal()
1356 TouchSignal ret = new TouchSignal(Interop.StageSignal.Stage_TouchSignal(stageCPtr), false);
1357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1361 internal TouchDataSignal TouchDataSignal()
1363 TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1364 if (NDalicPINVOKE.SWIGPendingException.Pending)
1365 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1369 internal VoidSignal ContextLostSignal()
1371 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false);
1372 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1376 internal VoidSignal ContextRegainedSignal()
1378 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextRegainedSignal(stageCPtr), false);
1379 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1383 internal VoidSignal SceneCreatedSignal()
1385 VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false);
1386 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1390 internal ResizedSignal ResizedSignal()
1392 ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false);
1393 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1397 internal void SetWindowSize(Size2D size)
1399 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1400 Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1404 // Resetting Window size should request a relayout of the tree.
1407 internal Size2D GetWindowSize()
1409 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1410 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1416 internal void SetPosition(Position2D position)
1418 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1419 Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1421 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1423 // Setting Position of the window should request a relayout of the tree.
1427 internal Position2D GetPosition()
1429 var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1430 Position2D ret = new Position2D(val.GetX(), val.GetY());
1432 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1436 internal void SetPositionSize(Rectangle positionSize)
1438 Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1440 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1442 // Setting Position of the window should request a relayout of the tree.
1447 /// Sets whether the window is transparent or not.
1449 /// <param name="transparent">Whether the window is transparent or not.</param>
1450 /// <since_tizen> 5 </since_tizen>
1451 public void SetTransparency(bool transparent) {
1452 Interop.Window.SetTransparency(swigCPtr, transparent);
1453 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1455 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1459 internal System.IntPtr GetNativeWindowHandler()
1461 System.IntPtr ret = Interop.Window.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(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false);
1481 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1485 private WheelSignal StageWheelEventSignal()
1487 WheelSignal ret = new WheelSignal(Interop.ActorSignal.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();
1535 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1538 if (_stageKeyHandler != null)
1540 //here we send all data to user event handlers
1541 _stageKeyHandler(this, e);
1545 // Callback for Stage EventProcessingFinishedSignal
1546 private void OnEventProcessingFinished()
1548 if (_stageEventProcessingFinishedEventHandler != null)
1550 _stageEventProcessingFinishedEventHandler(this, null);
1554 // Callback for Stage ContextLostSignal
1555 private void OnContextLost()
1557 if (_stageContextLostEventHandler != null)
1559 _stageContextLostEventHandler(this, null);
1563 // Callback for Stage ContextRegainedSignal
1564 private void OnContextRegained()
1566 if (_stageContextRegainedEventHandler != null)
1568 _stageContextRegainedEventHandler(this, null);
1572 // Callback for Stage SceneCreatedSignal
1573 private void OnSceneCreated()
1575 if (_stageSceneCreatedEventHandler != null)
1577 _stageSceneCreatedEventHandler(this, null);
1581 private void OnResized(IntPtr windowSize)
1583 ResizedEventArgs e = new ResizedEventArgs();
1584 var val = new Uint16Pair(windowSize, false);
1585 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1588 if (_windowResizedEventHandler != null)
1590 _windowResizedEventHandler(this, e);
1594 private void OnWindowFocusedChanged2(bool focusGained)
1596 FocusChangedEventArgs e = new FocusChangedEventArgs();
1598 e.FocusGained = focusGained;
1600 if (_windowFocusChangedEventHandler2 != null)
1602 _windowFocusChangedEventHandler2(this, e);
1607 /// The focus changed event argument.
1609 /// <since_tizen> 3 </since_tizen>
1610 public class FocusChangedEventArgs : EventArgs
1613 /// FocusGained flag.
1615 /// <since_tizen> 3 </since_tizen>
1616 public bool FocusGained
1624 /// The touch event argument.
1626 /// <since_tizen> 3 </since_tizen>
1627 public class TouchEventArgs : EventArgs
1629 private Touch _touch;
1634 /// <since_tizen> 3 </since_tizen>
1649 /// Wheel event arguments.
1651 /// <since_tizen> 3 </since_tizen>
1652 public class WheelEventArgs : EventArgs
1654 private Wheel _wheel;
1659 /// <since_tizen> 3 </since_tizen>
1674 /// Key event arguments.
1676 /// <since_tizen> 3 </since_tizen>
1677 public class KeyEventArgs : EventArgs
1684 /// <since_tizen> 3 </since_tizen>
1699 /// Sets position and size of the window. This API guarantees that
1700 /// both moving and resizing of window will appear on the screen at once.
1702 [EditorBrowsable(EditorBrowsableState.Never)]
1703 public Rectangle WindowPositionSize
1707 Position2D position = GetPosition();
1708 Size2D size = GetSize();
1709 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1714 SetPositionSize(value);
1719 /// Feeds a key event into the window.
1720 /// This resized event arguments.
1722 /// <since_tizen> 3 </since_tizen>
1723 public class ResizedEventArgs : EventArgs
1728 /// This window size.
1730 /// <since_tizen> 4 </since_tizen>
1731 public Size2D WindowSize
1739 _windowSize = value;
1745 /// Please do not use! this will be deprecated
1747 /// <since_tizen> 3 </since_tizen>
1748 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1750 "Window.Instance.FocusChanged = OnFocusChanged; " +
1751 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1752 [EditorBrowsable(EditorBrowsableState.Never)]
1753 public class WindowFocusChangedEventArgs : EventArgs
1756 /// Please do not use! this will be deprecated
1758 /// <since_tizen> 3 </since_tizen>
1759 public bool FocusGained
1767 /// Contains and encapsulates Native Window handle.
1769 /// <since_tizen> 4 </since_tizen>
1770 public class SafeNativeWindowHandle : SafeHandle
1773 /// Contructor, Native window handle is set to handle.
1775 /// <since_tizen> 4 </since_tizen>
1776 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1778 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1781 /// Null check if the handle is valid or not.
1783 /// <since_tizen> 4 </since_tizen>
1784 public override bool IsInvalid
1788 return this.handle == IntPtr.Zero;
1792 /// Release handle itself.
1794 /// <returns>true when released successfully.</returns>
1795 /// <since_tizen> 4 </since_tizen>
1796 protected override bool ReleaseHandle()
1803 /// Disconnect all native signals
1805 /// <since_tizen> 5 </since_tizen>
1806 internal void DisconnectNativeSignals()
1808 if( _windowFocusChangedEventCallback != null )
1810 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1813 if( _rootLayerTouchDataCallback != null )
1815 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1818 if( _wheelEventCallback != null )
1820 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1823 if( _stageKeyCallbackDelegate != null )
1825 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1828 if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1830 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1833 if( _stageContextLostEventCallbackDelegate != null )
1835 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1838 if( _stageContextRegainedEventCallbackDelegate != null )
1840 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1843 if( _stageSceneCreatedEventCallbackDelegate != null )
1845 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1848 if( _windowResizedEventCallback != null )
1850 ResizedSignal().Disconnect(_windowResizedEventCallback);
1853 if( _windowFocusChangedEventCallback2 != null )
1855 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);