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 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
62 // Create a root layout (AbsoluteLayout) that is invisible to the user but enables layouts added to the Window
63 // Enables layouts added to the Window to have a parent layout. As parent layout is needed to store measure spec properties.
64 // Currently without these measure specs the new layout added will always be the size of the window.
65 global::System.IntPtr rootLayoutIntPtr = NDalicManualPINVOKE.Window_NewRootLayout();
66 // Store HandleRef used by Add()
67 rootLayoutCPtr = new global::System.Runtime.InteropServices.HandleRef(this, rootLayoutIntPtr);
68 Layer rootLayer = GetRootLayer();
69 // Add the root layout created above to the root layer.
70 NDalicPINVOKE.Actor_Add( Layer.getCPtr(rootLayer), rootLayoutCPtr );
71 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
73 global::System.IntPtr rootControlLayoutIntPtr = Tizen.NUI.NDalicManualPINVOKE.GetLayout__SWIG_1(rootLayoutCPtr);
74 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76 rootLayoutItem = new LayoutItem(rootControlLayoutIntPtr, true);
80 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
82 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
87 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
101 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
102 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
103 private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
104 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
105 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
106 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
107 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
108 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
109 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
112 /// FocusChanged event.
114 /// <since_tizen> 3 </since_tizen>
115 public event EventHandler<FocusChangedEventArgs> FocusChanged
119 if (_windowFocusChangedEventHandler == null)
121 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
122 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
125 _windowFocusChangedEventHandler += value;
129 _windowFocusChangedEventHandler -= value;
131 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
133 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
139 /// This event is emitted when the screen is touched and when the touch ends.<br />
140 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
141 /// then when the last finger is lifted.<br />
142 /// An interrupted event will also be emitted (if it occurs).<br />
144 /// <since_tizen> 3 </since_tizen>
145 public event EventHandler<TouchEventArgs> TouchEvent
149 if (_rootLayerTouchDataEventHandler == null)
151 _rootLayerTouchDataCallback = OnWindowTouch;
152 this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
154 _rootLayerTouchDataEventHandler += value;
158 _rootLayerTouchDataEventHandler -= value;
159 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
161 this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
167 /// This event is emitted when the wheel event is received.
169 /// <since_tizen> 3 </since_tizen>
170 public event EventHandler<WheelEventArgs> WheelEvent
174 if (_stageWheelHandler == null)
176 _wheelEventCallback = OnStageWheel;
177 this.StageWheelEventSignal().Connect(_wheelEventCallback);
179 _stageWheelHandler += value;
183 _stageWheelHandler -= value;
184 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
186 this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
192 /// This event is emitted when the key event is received.
194 /// <since_tizen> 3 </since_tizen>
195 public event EventHandler<KeyEventArgs> KeyEvent
199 if (_stageKeyHandler == null)
201 _stageKeyCallbackDelegate = OnStageKey;
202 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
204 _stageKeyHandler += value;
208 _stageKeyHandler -= value;
209 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
211 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
217 /// This event is emitted when the window resized.
219 /// <since_tizen> 3 </since_tizen>
220 public event EventHandler<ResizedEventArgs> Resized
224 if (_windowResizedEventHandler == null)
226 _windowResizedEventCallback = OnResized;
227 ResizedSignal().Connect(_windowResizedEventCallback);
230 _windowResizedEventHandler += value;
234 _windowResizedEventHandler -= value;
236 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
238 ResizedSignal().Disconnect(_windowResizedEventCallback);
244 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
246 /// <since_tizen> 3 </since_tizen>
247 /// Please do not use! this will be deprecated!
248 /// Instead please use FocusChanged.
249 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
251 "Window.Instance.FocusChanged = OnFocusChanged; " +
252 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
253 [EditorBrowsable(EditorBrowsableState.Never)]
254 public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
258 if (_windowFocusChangedEventHandler2 == null)
260 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
261 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
264 _windowFocusChangedEventHandler2 += value;
268 _windowFocusChangedEventHandler2 -= value;
270 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
272 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
277 internal event EventHandler EventProcessingFinished
281 if (_stageEventProcessingFinishedEventHandler == null)
283 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
284 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
286 _stageEventProcessingFinishedEventHandler += value;
291 _stageEventProcessingFinishedEventHandler -= value;
292 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
294 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
299 internal event EventHandler ContextLost
303 if (_stageContextLostEventHandler == null)
305 _stageContextLostEventCallbackDelegate = OnContextLost;
306 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
308 _stageContextLostEventHandler += value;
312 _stageContextLostEventHandler -= value;
313 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
315 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
320 internal event EventHandler ContextRegained
324 if (_stageContextRegainedEventHandler == null)
326 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
327 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
329 _stageContextRegainedEventHandler += value;
333 _stageContextRegainedEventHandler -= value;
334 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
336 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
341 internal event EventHandler SceneCreated
345 if (_stageSceneCreatedEventHandler == null)
347 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
348 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
350 _stageSceneCreatedEventHandler += value;
354 _stageSceneCreatedEventHandler -= value;
355 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
357 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
362 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
363 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
364 private event EventHandler<WheelEventArgs> _stageWheelHandler;
365 private event EventHandler<KeyEventArgs> _stageKeyHandler;
366 private event EventHandler _stageEventProcessingFinishedEventHandler;
367 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
368 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
371 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
373 /// <since_tizen> 3 </since_tizen>
374 public enum WindowOrientation
377 /// Portrait orientation. The height of the display area is greater than the width.
379 /// <since_tizen> 3 </since_tizen>
382 /// Landscape orientation. A wide view area is needed.
384 /// <since_tizen> 3 </since_tizen>
387 /// Portrait inverse orientation.
389 /// <since_tizen> 3 </since_tizen>
390 PortraitInverse = 180,
392 /// Landscape inverse orientation.
394 /// <since_tizen> 3 </since_tizen>
395 LandscapeInverse = 270
399 /// Enumeration for the key grab mode for platform-level APIs.
401 /// <since_tizen> 3 </since_tizen>
402 public enum KeyGrabMode
405 /// Grabs a key only when on the top of the grabbing-window stack mode.
409 /// Grabs a key together with the other client window(s) mode.
413 /// 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.
417 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
423 /// Enumeration for opacity of the indicator.
425 internal enum IndicatorBackgroundOpacity
433 /// Enumeration for visible mode of the indicator.
435 internal enum IndicatorVisibleMode
443 /// The stage instance property (read-only).<br />
444 /// Gets the current window.<br />
446 /// <since_tizen> 3 </since_tizen>
447 public static Window Instance
456 /// Gets or sets a window type.
458 /// <since_tizen> 3 </since_tizen>
459 public WindowType Type
463 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
464 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
469 NDalicPINVOKE.SetType(swigCPtr, (int)value);
470 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
475 /// Gets/Sets a window title.
477 /// <since_tizen> 4 </since_tizen>
486 _windowTitle = value;
487 SetClass(_windowTitle, "");
492 /// The rendering behavior of a Window.
494 /// <since_tizen> 5 </since_tizen>
495 public RenderingBehaviorType RenderingBehavior
499 return GetRenderingBehavior();
503 SetRenderingBehavior(value);
508 /// The window size property (read-only).
510 /// <since_tizen> 3 </since_tizen>
515 Size2D ret = GetSize();
521 /// The background color property.
523 /// <since_tizen> 3 </since_tizen>
524 public Color BackgroundColor
528 SetBackgroundColor(value);
532 Color ret = GetBackgroundColor();
538 /// The DPI property (read-only).<br />
539 /// Retrieves the DPI of the display device to which the Window is connected.<br />
541 /// <since_tizen> 3 </since_tizen>
551 /// The layer count property (read-only).<br />
552 /// Queries the number of on-Window layers.<br />
554 /// <since_tizen> 3 </since_tizen>
555 public uint LayerCount
559 return GetLayerCount();
564 /// Gets or sets a size of the window.
566 /// <since_tizen> 4 </since_tizen>
567 public Size2D WindowSize
571 return GetWindowSize();
575 SetWindowSize(value);
580 /// Gets or sets a position of the window.
582 /// <since_tizen> 4 </since_tizen>
583 public Position2D WindowPosition
587 return GetPosition();
594 internal static Vector4 DEFAULT_BACKGROUND_COLOR
598 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
599 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
600 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
605 internal static Vector4 DEBUG_BACKGROUND_COLOR
609 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
610 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
611 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
616 internal List<Layer> LayersChildren
625 /// Feed a key-event into the window.
627 /// <param name="keyEvent">The key event to feed.</param>
628 /// <since_tizen> 4 </since_tizen>
629 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
630 public static void FeedKeyEvent(Key keyEvent)
632 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
633 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637 /// Sets whether the window accepts a focus or not.
639 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
640 /// <since_tizen> 3 </since_tizen>
641 public void SetAcceptFocus(bool accept)
643 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
644 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
648 /// Returns whether the window accepts a focus or not.
650 /// <returns>True if the window accepts a focus, false otherwise.</returns>
651 /// <since_tizen> 3 </since_tizen>
652 public bool IsFocusAcceptable()
654 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
655 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
661 /// Shows the window if it is hidden.
663 /// <since_tizen> 3 </since_tizen>
666 NDalicPINVOKE.Show(swigCPtr);
667 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
671 /// Hides the window if it is showing.
673 /// <since_tizen> 3 </since_tizen>
676 NDalicPINVOKE.Hide(swigCPtr);
677 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
681 /// Retrieves whether the window is visible or not.
683 /// <returns>True if the window is visible.</returns>
684 /// <since_tizen> 3 </since_tizen>
685 public bool IsVisible()
687 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
688 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
693 /// Gets the count of supported auxiliary hints of the window.
695 /// <returns>The number of supported auxiliary hints.</returns>
696 /// <since_tizen> 3 </since_tizen>
697 public uint GetSupportedAuxiliaryHintCount()
699 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
700 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
705 /// Gets the supported auxiliary hint string of the window.
707 /// <param name="index">The index of the supported auxiliary hint lists.</param>
708 /// <returns>The auxiliary hint string of the index.</returns>
709 /// <since_tizen> 3 </since_tizen>
710 public string GetSupportedAuxiliaryHint(uint index)
712 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
713 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
718 /// Creates an auxiliary hint of the window.
720 /// <param name="hint">The auxiliary hint string.</param>
721 /// <param name="value">The value string.</param>
722 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
723 /// <since_tizen> 3 </since_tizen>
724 public uint AddAuxiliaryHint(string hint, string value)
726 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
727 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
732 /// Removes an auxiliary hint of the window.
734 /// <param name="id">The ID of the auxiliary hint.</param>
735 /// <returns>True if no error occurred, false otherwise.</returns>
736 /// <since_tizen> 3 </since_tizen>
737 public bool RemoveAuxiliaryHint(uint id)
739 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
740 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
745 /// Changes a value of the auxiliary hint.
747 /// <param name="id">The auxiliary hint ID.</param>
748 /// <param name="value">The value string to be set.</param>
749 /// <returns>True if no error occurred, false otherwise.</returns>
750 /// <since_tizen> 3 </since_tizen>
751 public bool SetAuxiliaryHintValue(uint id, string value)
753 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
759 /// Gets a value of the auxiliary hint.
761 /// <param name="id">The auxiliary hint ID.</param>
762 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
763 /// <since_tizen> 3 </since_tizen>
764 public string GetAuxiliaryHintValue(uint id)
766 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
767 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
772 /// Gets an ID of the auxiliary hint string.
774 /// <param name="hint">The auxiliary hint string.</param>
775 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
776 /// <since_tizen> 3 </since_tizen>
777 public uint GetAuxiliaryHintId(string hint)
779 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
780 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
785 /// Sets a region to accept input events.
787 /// <param name="inputRegion">The region to accept input events.</param>
788 /// <since_tizen> 3 </since_tizen>
789 public void SetInputRegion(Rectangle inputRegion)
791 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
792 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
796 /// Sets a priority level for the specified notification window.
798 /// <param name="level">The notification window level.</param>
799 /// <returns>True if no error occurred, false otherwise.</returns>
800 /// <since_tizen> 3 </since_tizen>
801 public bool SetNotificationLevel(NotificationLevel level)
803 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
804 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
809 /// Gets a priority level for the specified notification window.
811 /// <returns>The notification window level.</returns>
812 /// <since_tizen> 3 </since_tizen>
813 public NotificationLevel GetNotificationLevel()
815 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
816 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
821 /// Sets a transparent window's visual state to opaque. <br />
822 /// If a visual state of a transparent window is opaque, <br />
823 /// then the window manager could handle it as an opaque window when calculating visibility.
825 /// <param name="opaque">Whether the window's visual state is opaque.</param>
826 /// <remarks>This will have no effect on an opaque window. <br />
827 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
829 /// <since_tizen> 3 </since_tizen>
830 public void SetOpaqueState(bool opaque)
832 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
833 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
837 /// Returns whether a transparent window's visual state is opaque or not.
839 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
840 /// <remarks> The return value has no meaning on an opaque window. </remarks>
841 /// <since_tizen> 3 </since_tizen>
842 public bool IsOpaqueState()
844 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
845 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
850 /// Sets a window's screen off mode.
852 /// <param name="screenOffMode">The screen mode.</param>
853 /// <returns>True if no error occurred, false otherwise.</returns>
854 /// <since_tizen> 4 </since_tizen>
855 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
857 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
858 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
863 /// Gets the screen mode of the window.
865 /// <returns>The screen off mode.</returns>
866 /// <since_tizen> 4 </since_tizen>
867 public ScreenOffMode GetScreenOffMode()
869 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
870 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
875 /// Sets preferred brightness of the window.
877 /// <param name="brightness">The preferred brightness (0 to 100).</param>
878 /// <returns>True if no error occurred, false otherwise.</returns>
879 /// <since_tizen> 3 </since_tizen>
880 public bool SetBrightness(int brightness)
882 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
883 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
888 /// Gets the preferred brightness of the window.
890 /// <returns>The preferred brightness.</returns>
891 /// <since_tizen> 3 </since_tizen>
892 public int GetBrightness()
894 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
895 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
900 /// Sets the window name and the class string.
902 /// <param name="name">The name of the window.</param>
903 /// <param name="klass">The class of the window.</param>
904 /// <since_tizen> 4 </since_tizen>
905 public void SetClass(string name, string klass)
907 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
908 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
912 /// Raises the window to the top of the window stack.
914 /// <since_tizen> 3 </since_tizen>
917 NDalicPINVOKE.Window_Raise(swigCPtr);
918 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
922 /// Lowers the window to the bottom of the window stack.
924 /// <since_tizen> 3 </since_tizen>
927 NDalicPINVOKE.Window_Lower(swigCPtr);
928 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
932 /// Activates the window to the top of the window stack even it is iconified.
934 /// <since_tizen> 3 </since_tizen>
935 public void Activate()
937 NDalicPINVOKE.Window_Activate(swigCPtr);
938 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
942 /// Gets the default ( root ) layer.
944 /// <returns>The root layer.</returns>
945 /// <since_tizen> 3 </since_tizen>
946 public Layer GetDefaultLayer()
948 return this.GetRootLayer();
952 /// Add a child view to window.
954 /// <param name="view">the child should be added to the window.</param>
955 /// <since_tizen> 3 </since_tizen>
956 public void Add(View view)
958 NDalicPINVOKE.Actor_Add(rootLayoutCPtr, View.getCPtr(view));
959 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
960 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
961 view.InternalParent = this.GetRootLayer();
965 /// Remove a child view from window.
967 /// <param name="view">the child to be removed.</param>
968 /// <since_tizen> 3 </since_tizen>
969 public void Remove(View view)
971 NDalicPINVOKE.Actor_Remove(rootLayoutCPtr, View.getCPtr(view));
972 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
973 view.InternalParent = null;
977 /// Retrieves the layer at a specified depth.
979 /// <param name="depth">The layer's depth index.</param>
980 /// <returns>The layer found at the given depth.</returns>
981 /// <since_tizen> 3 </since_tizen>
982 public Layer GetLayer(uint depth)
984 if (depth < LayersChildren?.Count)
986 Layer ret = LayersChildren[Convert.ToInt32(depth)];
996 /// Keep rendering for at least the given amount of time.
998 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
999 /// <since_tizen> 3 </since_tizen>
1000 public void KeepRendering(float durationSeconds)
1002 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
1003 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1007 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1008 /// This function can be used for following example scenarios: <br />
1009 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1011 /// <param name="DaliKey">The key code to grab.</param>
1012 /// <returns>True if the grab succeeds.</returns>
1013 /// <since_tizen> 3 </since_tizen>
1014 public bool GrabKeyTopmost(int DaliKey)
1016 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1017 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1022 /// Ungrabs the key specified by a key for the window.<br />
1023 /// 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 />
1025 /// <param name="DaliKey">The key code to ungrab.</param>
1026 /// <returns>True if the ungrab succeeds.</returns>
1027 /// <since_tizen> 3 </since_tizen>
1028 public bool UngrabKeyTopmost(int DaliKey)
1030 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1031 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1036 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1037 /// Details: This function can be used for following example scenarios: <br />
1038 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1039 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1040 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1042 /// <param name="DaliKey">The key code to grab.</param>
1043 /// <param name="GrabMode">The grab mode for the key.</param>
1044 /// <returns>True if the grab succeeds.</returns>
1045 /// <since_tizen> 3 </since_tizen>
1046 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1048 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1049 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1054 /// Ungrabs the key specified by a key for a window.<br />
1055 /// 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 />
1057 /// <param name="DaliKey">The key code to ungrab.</param>
1058 /// <returns>True if the ungrab succeeds.</returns>
1059 /// <since_tizen> 3 </since_tizen>
1060 public bool UngrabKey(int DaliKey)
1062 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1063 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1068 /// Sets the keyboard repeat information.
1070 /// <param name="rate">The key repeat rate value in seconds.</param>
1071 /// <param name="delay">The key repeat delay value in seconds.</param>
1072 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1073 /// <since_tizen> 5 </since_tizen>
1074 public bool SetKeyboardRepeatInfo(float rate, float delay)
1076 bool ret = NDalicManualPINVOKE.SetKeyboardRepeatInfo(rate, delay);
1077 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1082 /// Gets the keyboard repeat information.
1084 /// <param name="rate">The key repeat rate value in seconds.</param>
1085 /// <param name="delay">The key repeat delay value in seconds.</param>
1086 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1087 /// <since_tizen> 5 </since_tizen>
1088 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1090 bool ret = NDalicManualPINVOKE.GetKeyboardRepeatInfo(out rate, out delay);
1091 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1096 /// Adds a layer to the stage.
1098 /// <param name="layer">Layer to add.</param>
1099 /// <since_tizen> 3 </since_tizen>
1100 public void AddLayer(Layer layer)
1102 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1105 LayersChildren?.Add(layer);
1109 /// Removes a layer from the stage.
1111 /// <param name="layer">Layer to remove.</param>
1112 /// <since_tizen> 3 </since_tizen>
1113 public void RemoveLayer(Layer layer)
1115 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1118 LayersChildren?.Remove(layer);
1122 /// Feeds a key event into the window.
1124 /// <param name="keyEvent">The key event to feed.</param>
1125 /// <since_tizen> 5 </since_tizen>
1126 public void FeedKey(Key keyEvent)
1128 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1129 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1133 /// Allows at least one more render, even when paused.
1134 /// The window should be shown, not minimised.
1136 /// <since_tizen> 4 </since_tizen>
1137 public void RenderOnce()
1139 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1143 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1145 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1148 internal static Window GetCurrent()
1150 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
1151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1155 internal static bool IsInstalled()
1157 bool ret = NDalicPINVOKE.Stage_IsInstalled();
1158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1162 internal WindowFocusSignalType WindowFocusChangedSignal()
1164 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
1165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1169 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1171 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1175 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1177 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1181 internal void RotateIndicator(Window.WindowOrientation orientation)
1183 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
1184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1187 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1189 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1190 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1193 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1195 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1199 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1201 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1205 internal Window.WindowOrientation GetPreferredOrientation()
1207 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
1208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1212 internal DragAndDropDetector GetDragAndDropDetector()
1214 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
1215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1219 internal Any GetNativeHandle()
1221 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
1222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1226 internal WindowFocusSignalType FocusChangedSignal()
1228 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
1229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1233 internal void Add(Layer layer)
1235 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1238 LayersChildren?.Add(layer);
1241 internal void Remove(Layer layer)
1243 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1246 LayersChildren?.Remove(layer);
1249 internal Vector2 GetSize()
1251 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
1252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1256 internal RenderTaskList GetRenderTaskList()
1258 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
1259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1264 /// Queries the number of on-window layers.
1266 /// <returns>The number of layers.</returns>
1267 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1268 internal uint GetLayerCount()
1270 if (LayersChildren == null || LayersChildren.Count < 0)
1273 return (uint) LayersChildren.Count;
1276 internal Layer GetRootLayer()
1278 // Window.IsInstalled() is actually true only when called from event thread and
1279 // Core has been initialized, not when Stage is ready.
1280 if (_rootLayer == null && Window.IsInstalled())
1282 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
1283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1284 LayersChildren?.Add(_rootLayer);
1289 internal void SetBackgroundColor(Vector4 color)
1291 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
1292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1295 internal Vector4 GetBackgroundColor()
1297 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
1298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1302 internal Vector2 GetDpi()
1304 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
1305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1309 internal ObjectRegistry GetObjectRegistry()
1311 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
1312 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1316 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1318 NDalicPINVOKE.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1319 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1322 internal RenderingBehaviorType GetRenderingBehavior()
1324 RenderingBehaviorType ret = (RenderingBehaviorType)NDalicPINVOKE.Stage_GetRenderingBehavior(stageCPtr);
1325 if (NDalicPINVOKE.SWIGPendingException.Pending)
1326 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1330 internal KeyEventSignal KeyEventSignal()
1332 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
1333 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1337 internal VoidSignal EventProcessingFinishedSignal()
1339 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1340 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1344 internal TouchSignal TouchSignal()
1346 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
1347 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1351 internal TouchDataSignal TouchDataSignal()
1353 TouchDataSignal ret = new TouchDataSignal(NDalicPINVOKE.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1354 if (NDalicPINVOKE.SWIGPendingException.Pending)
1355 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1359 internal VoidSignal ContextLostSignal()
1361 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
1362 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1366 internal VoidSignal ContextRegainedSignal()
1368 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
1369 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1373 internal VoidSignal SceneCreatedSignal()
1375 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
1376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1380 internal ResizedSignal ResizedSignal()
1382 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
1383 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1387 internal void SetWindowSize(Size2D size)
1389 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1390 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1392 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1394 if(rootLayoutItem != null)
1396 rootLayoutItem.RequestLayout();
1400 internal Size2D GetWindowSize()
1402 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1403 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1405 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1409 internal void SetPosition(Position2D position)
1411 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1412 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1414 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1416 if(rootLayoutItem != null)
1418 rootLayoutItem.RequestLayout();
1422 internal Position2D GetPosition()
1424 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1425 Position2D ret = new Position2D(val.GetX(), val.GetY());
1427 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1431 internal void SetPositionSize(Rectangle positionSize)
1433 NDalicPINVOKE.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1435 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1437 if(rootLayoutItem != null)
1439 rootLayoutItem.RequestLayout();
1444 /// Sets whether the window is transparent or not.
1446 /// <param name="transparent">Whether the window is transparent or not.</param>
1447 /// <since_tizen> 5 </since_tizen>
1448 public void SetTransparency(bool transparent) {
1449 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1450 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1452 if(rootLayoutItem != null)
1454 rootLayoutItem.RequestLayout();
1458 internal System.IntPtr GetNativeWindowHandler()
1460 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1461 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1465 private void OnWindowFocusedChanged(bool focusGained)
1467 FocusChangedEventArgs e = new FocusChangedEventArgs();
1469 e.FocusGained = focusGained;
1471 if (_windowFocusChangedEventHandler != null)
1473 _windowFocusChangedEventHandler(this, e);
1477 private StageWheelSignal WheelEventSignal()
1479 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
1480 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1484 private WheelSignal StageWheelEventSignal()
1486 WheelSignal ret = new WheelSignal(NDalicPINVOKE.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1487 if (NDalicPINVOKE.SWIGPendingException.Pending)
1488 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1492 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1494 if (touchData == global::System.IntPtr.Zero)
1496 NUILog.Error("touchData should not be null!");
1500 TouchEventArgs e = new TouchEventArgs();
1502 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1504 if (_rootLayerTouchDataEventHandler != null)
1506 _rootLayerTouchDataEventHandler(this, e);
1511 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1513 if (wheelEvent == global::System.IntPtr.Zero)
1515 NUILog.Error("wheelEvent should not be null!");
1519 WheelEventArgs e = new WheelEventArgs();
1521 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1523 if (_stageWheelHandler != null)
1525 _stageWheelHandler(this, e);
1530 // Callback for Stage KeyEventsignal
1531 private void OnStageKey(IntPtr data)
1533 KeyEventArgs e = new KeyEventArgs();
1534 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1537 if (_stageKeyHandler != null)
1539 //here we send all data to user event handlers
1540 _stageKeyHandler(this, e);
1544 // Callback for Stage EventProcessingFinishedSignal
1545 private void OnEventProcessingFinished()
1547 if (_stageEventProcessingFinishedEventHandler != null)
1549 _stageEventProcessingFinishedEventHandler(this, null);
1553 // Callback for Stage ContextLostSignal
1554 private void OnContextLost()
1556 if (_stageContextLostEventHandler != null)
1558 _stageContextLostEventHandler(this, null);
1562 // Callback for Stage ContextRegainedSignal
1563 private void OnContextRegained()
1565 if (_stageContextRegainedEventHandler != null)
1567 _stageContextRegainedEventHandler(this, null);
1571 // Callback for Stage SceneCreatedSignal
1572 private void OnSceneCreated()
1574 if (_stageSceneCreatedEventHandler != null)
1576 _stageSceneCreatedEventHandler(this, null);
1580 private void OnResized(IntPtr windowSize)
1582 ResizedEventArgs e = new ResizedEventArgs();
1583 var val = new Uint16Pair(windowSize, false);
1584 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1587 if (_windowResizedEventHandler != null)
1589 _windowResizedEventHandler(this, e);
1593 private void OnWindowFocusedChanged2(bool focusGained)
1595 FocusChangedEventArgs e = new FocusChangedEventArgs();
1597 e.FocusGained = focusGained;
1599 if (_windowFocusChangedEventHandler2 != null)
1601 _windowFocusChangedEventHandler2(this, e);
1606 /// The focus changed event argument.
1608 /// <since_tizen> 3 </since_tizen>
1609 public class FocusChangedEventArgs : EventArgs
1612 /// FocusGained flag.
1614 /// <since_tizen> 3 </since_tizen>
1615 public bool FocusGained
1623 /// The touch event argument.
1625 /// <since_tizen> 3 </since_tizen>
1626 public class TouchEventArgs : EventArgs
1628 private Touch _touch;
1633 /// <since_tizen> 3 </since_tizen>
1648 /// Wheel event arguments.
1650 /// <since_tizen> 3 </since_tizen>
1651 public class WheelEventArgs : EventArgs
1653 private Wheel _wheel;
1658 /// <since_tizen> 3 </since_tizen>
1673 /// Key event arguments.
1675 /// <since_tizen> 3 </since_tizen>
1676 public class KeyEventArgs : EventArgs
1683 /// <since_tizen> 3 </since_tizen>
1698 /// Sets position and size of the window. This API guarantees that
1699 /// both moving and resizing of window will appear on the screen at once.
1701 [EditorBrowsable(EditorBrowsableState.Never)]
1702 public Rectangle WindowPositionSize
1706 Position2D position = GetPosition();
1707 Size2D size = GetSize();
1708 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1713 SetPositionSize(value);
1718 /// Feeds a key event into the window.
1719 /// This resized event arguments.
1721 /// <since_tizen> 3 </since_tizen>
1722 public class ResizedEventArgs : EventArgs
1727 /// This window size.
1729 /// <since_tizen> 4 </since_tizen>
1730 public Size2D WindowSize
1738 _windowSize = value;
1744 /// Please do not use! this will be deprecated
1746 /// <since_tizen> 3 </since_tizen>
1747 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1749 "Window.Instance.FocusChanged = OnFocusChanged; " +
1750 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1751 [EditorBrowsable(EditorBrowsableState.Never)]
1752 public class WindowFocusChangedEventArgs : EventArgs
1755 /// Please do not use! this will be deprecated
1757 /// <since_tizen> 3 </since_tizen>
1758 public bool FocusGained
1766 /// Contains and encapsulates Native Window handle.
1768 /// <since_tizen> 4 </since_tizen>
1769 public class SafeNativeWindowHandle : SafeHandle
1772 /// Contructor, Native window handle is set to handle.
1774 /// <since_tizen> 4 </since_tizen>
1775 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1777 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1780 /// Null check if the handle is valid or not.
1782 /// <since_tizen> 4 </since_tizen>
1783 public override bool IsInvalid
1787 return this.handle == IntPtr.Zero;
1791 /// Release handle itself.
1793 /// <returns>true when released successfully.</returns>
1794 /// <since_tizen> 4 </since_tizen>
1795 protected override bool ReleaseHandle()
1802 /// Disconnect all native signals
1804 /// <since_tizen> 5 </since_tizen>
1805 internal void DisconnectNativeSignals()
1807 if( _windowFocusChangedEventCallback != null )
1809 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1812 if( _rootLayerTouchDataCallback != null )
1814 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1817 if( _wheelEventCallback != null )
1819 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1822 if( _stageKeyCallbackDelegate != null )
1824 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1827 if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1829 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1832 if( _stageContextLostEventCallbackDelegate != null )
1834 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1837 if( _stageContextRegainedEventCallbackDelegate != null )
1839 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1842 if( _stageSceneCreatedEventCallbackDelegate != null )
1844 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1847 if( _windowResizedEventCallback != null )
1849 ResizedSignal().Disconnect(_windowResizedEventCallback);
1852 if( _windowFocusChangedEventCallback2 != null )
1854 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);