2 * Copyright(c) 2017 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 Layer _rootLayer;
35 private string _windowTitle;
37 private List<Layer> _childLayers = new List<Layer>();
38 internal List<Layer> LayersChildren
46 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
48 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
49 if (NDalicPINVOKE.Stage_IsInstalled())
51 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
55 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
57 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
61 /// To make the window instance be disposed.
63 /// Please DO NOT use! This will be deprecated!
64 /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, IMFManager, TtsPlayer, Window) is not required.
65 /// Because it is Sigletone, so it is alive for one thread until the NUI is terminated, so it never be disposed.
66 /// <since_tizen> 3 </since_tizen>
67 [Obsolete("Please do not use! This will be deprecated!")]
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 protected override void Dispose(DisposeTypes type)
76 if (type == DisposeTypes.Explicit)
79 //Release your own managed resources here.
80 //You should release all of your own disposable objects here.
83 //Release your own unmanaged resources here.
84 //You should not access any managed member here except static instance.
85 //because the execution order of Finalizes is non-deterministic.
87 if (_windowFocusChangedEventCallback != null)
89 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
92 if (_stageTouchCallbackDelegate != null)
94 TouchSignal().Disconnect(_stageTouchCallbackDelegate);
97 if (_stageWheelCallbackDelegate != null)
99 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
102 if (_stageKeyCallbackDelegate != null)
104 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
107 if (_stageEventProcessingFinishedEventCallbackDelegate != null)
109 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
112 if (_stageContextLostEventCallbackDelegate != null)
114 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
117 if (_stageContextRegainedEventCallbackDelegate != null)
119 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
122 if (_stageSceneCreatedEventCallbackDelegate != null)
124 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
127 if (_windowResizedEventCallback != null)
129 ResizedSignal().Disconnect(_windowResizedEventCallback);
132 if (_windowFocusChangedEventCallback2 != null)
134 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
137 if (swigCPtr.Handle != global::System.IntPtr.Zero)
142 NDalicPINVOKE.delete_Window(swigCPtr);
143 NDalicPINVOKE.delete_Stage(stageCPtr);
145 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
151 internal static Window GetCurrent()
153 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
154 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158 internal static bool IsInstalled()
160 bool ret = NDalicPINVOKE.Stage_IsInstalled();
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166 /// Sets whether the window accepts a focus or not.
168 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
169 /// <since_tizen> 3 </since_tizen>
170 public void SetAcceptFocus(bool accept)
172 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 /// Returns whether the window accepts a focus or not.
179 /// <returns>True if the window accepts a focus, false otherwise.</returns>
180 /// <since_tizen> 3 </since_tizen>
181 public bool IsFocusAcceptable()
183 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190 /// Shows the window if it is hidden.
192 /// <since_tizen> 3 </since_tizen>
195 NDalicPINVOKE.Show(swigCPtr);
196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200 /// Hides the window if it is showing.
202 /// <since_tizen> 3 </since_tizen>
205 NDalicPINVOKE.Hide(swigCPtr);
206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210 /// Retrieves whether the window is visible or not.
212 /// <returns>True if the window is visible.</returns>
213 /// <since_tizen> 3 </since_tizen>
214 public bool IsVisible()
216 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222 /// Gets the count of supported auxiliary hints of the window.
224 /// <returns>The number of supported auxiliary hints.</returns>
225 /// <since_tizen> 3 </since_tizen>
226 public uint GetSupportedAuxiliaryHintCount()
228 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 /// Gets the supported auxiliary hint string of the window.
236 /// <param name="index">The index of the supported auxiliary hint lists.</param>
237 /// <returns>The auxiliary hint string of the index.</returns>
238 /// <since_tizen> 3 </since_tizen>
239 public string GetSupportedAuxiliaryHint(uint index)
241 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 /// Creates an auxiliary hint of the window.
249 /// <param name="hint">The auxiliary hint string.</param>
250 /// <param name="value">The value string.</param>
251 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
252 /// <since_tizen> 3 </since_tizen>
253 public uint AddAuxiliaryHint(string hint, string value)
255 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
261 /// Removes an auxiliary hint of the window.
263 /// <param name="id">The ID of the auxiliary hint.</param>
264 /// <returns>True if no error occurred, false otherwise.</returns>
265 /// <since_tizen> 3 </since_tizen>
266 public bool RemoveAuxiliaryHint(uint id)
268 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
274 /// Changes a value of the auxiliary hint.
276 /// <param name="id">The auxiliary hint ID.</param>
277 /// <param name="value">The value string to be set.</param>
278 /// <returns>True if no error occurred, false otherwise.</returns>
279 /// <since_tizen> 3 </since_tizen>
280 public bool SetAuxiliaryHintValue(uint id, string value)
282 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288 /// Gets a value of the auxiliary hint.
290 /// <param name="id">The auxiliary hint ID.</param>
291 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
292 /// <since_tizen> 3 </since_tizen>
293 public string GetAuxiliaryHintValue(uint id)
295 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301 /// Gets an ID of the auxiliary hint string.
303 /// <param name="hint">The auxiliary hint string.</param>
304 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
305 /// <since_tizen> 3 </since_tizen>
306 public uint GetAuxiliaryHintId(string hint)
308 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
314 /// Sets a region to accept input events.
316 /// <param name="inputRegion">The region to accept input events.</param>
317 /// <since_tizen> 3 </since_tizen>
318 public void SetInputRegion(Rectangle inputRegion)
320 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
321 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325 /// Gets or sets a window type.
327 /// <since_tizen> 3 </since_tizen>
328 public WindowType Type
332 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
333 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338 NDalicPINVOKE.SetType(swigCPtr, (int)value);
339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344 /// Sets a priority level for the specified notification window.
346 /// <param name="level">The notification window level.</param>
347 /// <returns>True if no error occurred, false otherwise.</returns>
348 /// <since_tizen> 3 </since_tizen>
349 public bool SetNotificationLevel(NotificationLevel level)
351 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
357 /// Gets a priority level for the specified notification window.
359 /// <returns>The notification window level.</returns>
360 /// <since_tizen> 3 </since_tizen>
361 public NotificationLevel GetNotificationLevel()
363 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
364 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369 /// Sets a transparent window's visual state to opaque. <br />
370 /// If a visual state of a transparent window is opaque, <br />
371 /// then the window manager could handle it as an opaque window when calculating visibility.
373 /// <param name="opaque">Whether the window's visual state is opaque.</param>
374 /// <remarks>This will have no effect on an opaque window. <br />
375 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
377 /// <since_tizen> 3 </since_tizen>
378 public void SetOpaqueState(bool opaque)
380 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
381 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
385 /// Returns whether a transparent window's visual state is opaque or not.
387 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
388 /// <remarks> The return value has no meaning on an opaque window. </remarks>
389 /// <since_tizen> 3 </since_tizen>
390 public bool IsOpaqueState()
392 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
393 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398 /// Sets a window's screen off mode.
400 /// <param name="screenOffMode">The screen mode.</param>
401 /// <returns>True if no error occurred, false otherwise.</returns>
402 /// <since_tizen> 4 </since_tizen>
403 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
405 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
406 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
411 /// Gets the screen mode of the window.
413 /// <returns>The screen off mode.</returns>
414 /// <since_tizen> 4 </since_tizen>
415 public ScreenOffMode GetScreenOffMode()
417 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
418 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
423 /// Sets preferred brightness of the window.
425 /// <param name="brightness">The preferred brightness (0 to 100).</param>
426 /// <returns>True if no error occurred, false otherwise.</returns>
427 /// <since_tizen> 3 </since_tizen>
428 public bool SetBrightness(int brightness)
430 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
431 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
436 /// Gets the preferred brightness of the window.
438 /// <returns>The preferred brightness.</returns>
439 /// <since_tizen> 3 </since_tizen>
440 public int GetBrightness()
442 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
443 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
448 /// The focus changed event argument.
450 /// <since_tizen> 3 </since_tizen>
451 public class FocusChangedEventArgs : EventArgs
454 /// FocusGained flag.
456 /// <since_tizen> 3 </since_tizen>
457 public bool FocusGained
464 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
465 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
466 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
467 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
470 /// FocusChanged event.
472 /// <since_tizen> 3 </since_tizen>
473 public event EventHandler<FocusChangedEventArgs> FocusChanged
477 if (_windowFocusChangedEventHandler == null)
479 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
480 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
483 _windowFocusChangedEventHandler += value;
487 _windowFocusChangedEventHandler -= value;
489 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
491 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
496 private void OnWindowFocusedChanged(bool focusGained)
498 FocusChangedEventArgs e = new FocusChangedEventArgs();
500 e.FocusGained = focusGained;
502 if (_windowFocusChangedEventHandler != null)
504 _windowFocusChangedEventHandler(this, e);
509 /// Gets/Sets a window title.
511 /// <since_tizen> 4 </since_tizen>
520 _windowTitle = value;
521 SetClass(_windowTitle, "");
525 internal WindowFocusSignalType WindowFocusChangedSignal()
527 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
528 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
532 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
534 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
537 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
539 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
544 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
547 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
549 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
552 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
554 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
555 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
558 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
560 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
561 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
564 internal void RotateIndicator(Window.WindowOrientation orientation)
566 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
567 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
571 /// Sets the window name and the class string.
573 /// <param name="name">The name of the window.</param>
574 /// <param name="klass">The class of the window.</param>
575 /// <since_tizen> 4 </since_tizen>
576 public void SetClass(string name, string klass)
578 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
579 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
583 /// Raises the window to the top of the window stack.
585 /// <since_tizen> 3 </since_tizen>
588 NDalicPINVOKE.Window_Raise(swigCPtr);
589 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
593 /// Lowers the window to the bottom of the window stack.
595 /// <since_tizen> 3 </since_tizen>
598 NDalicPINVOKE.Window_Lower(swigCPtr);
599 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
603 /// Activates the window to the top of the window stack even it is iconified.
605 /// <since_tizen> 3 </since_tizen>
606 public void Activate()
608 NDalicPINVOKE.Window_Activate(swigCPtr);
609 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
614 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
615 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
618 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
620 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
621 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
624 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
626 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
627 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
630 internal Window.WindowOrientation GetPreferredOrientation()
632 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
633 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637 internal DragAndDropDetector GetDragAndDropDetector()
639 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
640 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
644 internal Any GetNativeHandle()
646 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
647 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
651 internal WindowFocusSignalType FocusChangedSignal()
653 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
654 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
659 /// Gets the default ( root ) layer.
661 /// <returns>The root layer.</returns>
662 /// <since_tizen> 3 </since_tizen>
663 public Layer GetDefaultLayer()
665 return this.GetRootLayer();
668 internal void Add(Layer layer)
670 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
671 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
673 LayersChildren.Add(layer);
676 internal void Remove(Layer layer)
678 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
679 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
681 LayersChildren.Remove(layer);
685 /// Add a child view to window.
687 /// <param name="view">the child should be added to the window.</param>
688 /// <since_tizen> 3 </since_tizen>
689 public void Add(View view)
691 GetRootLayer()?.Add(view);
695 /// Remove a child view from window.
697 /// <param name="view">the child to be removed.</param>
698 /// <since_tizen> 3 </since_tizen>
699 public void Remove(View view)
701 GetRootLayer()?.Remove(view);
704 internal Vector2 GetSize()
706 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
707 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711 internal RenderTaskList GetRenderTaskList()
713 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
719 /// Queries the number of on-window layers.
721 /// <returns>The number of layers.</returns>
722 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
723 internal uint GetLayerCount()
725 if (LayersChildren == null || LayersChildren.Count < 0)
728 return (uint) LayersChildren.Count;
732 /// Retrieves the layer at a specified depth.
734 /// <param name="depth">The layer's depth index.</param>
735 /// <returns>The layer found at the given depth.</returns>
736 /// <since_tizen> 3 </since_tizen>
737 public Layer GetLayer(uint depth)
739 if (depth < LayersChildren.Count)
741 Layer ret = LayersChildren[Convert.ToInt32(depth)];
750 internal Layer GetRootLayer()
752 // Window.IsInstalled() is actually true only when called from event thread and
753 // Core has been initialized, not when Stage is ready.
754 if (_rootLayer == null && Window.IsInstalled())
756 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
757 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
758 LayersChildren.Add(_rootLayer);
763 internal void SetBackgroundColor(Vector4 color)
765 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
766 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769 internal Vector4 GetBackgroundColor()
771 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
772 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
776 internal Vector2 GetDpi()
778 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
779 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
783 internal ObjectRegistry GetObjectRegistry()
785 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
786 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791 /// Keep rendering for at least the given amount of time.
793 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
794 /// <since_tizen> 3 </since_tizen>
795 public void KeepRendering(float durationSeconds)
797 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
798 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
801 internal KeyEventSignal KeyEventSignal()
803 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
804 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
808 internal VoidSignal EventProcessingFinishedSignal()
810 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
811 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815 internal TouchSignal TouchSignal()
817 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
818 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 private StageWheelSignal WheelEventSignal()
824 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
825 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
829 internal VoidSignal ContextLostSignal()
831 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
832 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
836 internal VoidSignal ContextRegainedSignal()
838 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
839 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
843 internal VoidSignal SceneCreatedSignal()
845 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
846 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
850 internal ResizedSignal ResizedSignal()
852 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
853 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
857 internal static Vector4 DEFAULT_BACKGROUND_COLOR
861 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
862 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
863 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
868 internal static Vector4 DEBUG_BACKGROUND_COLOR
872 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
873 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
874 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
879 private static readonly Window instance = Application.Instance.GetWindow();
882 /// The stage instance property (read-only).<br />
883 /// Gets the current window.<br />
885 /// <since_tizen> 3 </since_tizen>
886 public static Window Instance
895 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
896 /// This function can be used for following example scenarios: <br />
897 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
899 /// <param name="DaliKey">The key code to grab.</param>
900 /// <returns>True if the grab succeeds.</returns>
901 /// <since_tizen> 3 </since_tizen>
902 public bool GrabKeyTopmost(int DaliKey)
904 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
905 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
910 /// Ungrabs the key specified by a key for the window.<br />
911 /// 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 />
913 /// <param name="DaliKey">The key code to ungrab.</param>
914 /// <returns>True if the ungrab succeeds.</returns>
915 /// <since_tizen> 3 </since_tizen>
916 public bool UngrabKeyTopmost(int DaliKey)
918 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
919 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
924 /// Grabs the key specified by a key for a window in a GrabMode. <br />
925 /// Details: This function can be used for following example scenarios: <br />
926 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
927 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
928 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
930 /// <param name="DaliKey">The key code to grab.</param>
931 /// <param name="GrabMode">The grab mode for the key.</param>
932 /// <returns>True if the grab succeeds.</returns>
933 /// <since_tizen> 3 </since_tizen>
934 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
936 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
937 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
942 /// Ungrabs the key specified by a key for a window.<br />
943 /// 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 />
945 /// <param name="DaliKey">The key code to ungrab.</param>
946 /// <returns>True if the ungrab succeeds.</returns>
947 /// <since_tizen> 3 </since_tizen>
948 public bool UngrabKey(int DaliKey)
950 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
951 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
955 internal System.IntPtr GetNativeWindowHandler()
957 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
958 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
963 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
965 /// <since_tizen> 3 </since_tizen>
966 public enum WindowOrientation
969 /// Portrait orientation. The height of the display area is greater than the width.
971 /// <since_tizen> 3 </since_tizen>
974 /// Landscape orientation. A wide view area is needed.
976 /// <since_tizen> 3 </since_tizen>
979 /// Portrait inverse orientation.
981 /// <since_tizen> 3 </since_tizen>
982 PortraitInverse = 180,
984 /// Landscape inverse orientation.
986 /// <since_tizen> 3 </since_tizen>
987 LandscapeInverse = 270
991 /// Enumeration for the key grab mode for platform-level APIs.
993 /// <since_tizen> 3 </since_tizen>
994 public enum KeyGrabMode
997 /// Grabs a key only when on the top of the grabbing-window stack mode.
1001 /// Grabs a key together with the other client window(s) mode.
1005 /// 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.
1009 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
1015 /// Enumeration for opacity of the indicator.
1017 internal enum IndicatorBackgroundOpacity
1025 /// Enumeration for visible mode of the indicator.
1027 internal enum IndicatorVisibleMode
1035 /// The touch event argument.
1037 /// <since_tizen> 3 </since_tizen>
1038 public class TouchEventArgs : EventArgs
1040 private Touch _touch;
1045 /// <since_tizen> 3 </since_tizen>
1059 private event EventHandler<TouchEventArgs> _stageTouchHandler;
1060 private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
1063 /// This event is emitted when the screen is touched and when the touch ends.<br />
1064 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
1065 /// then when the last finger is lifted.<br />
1066 /// An interrupted event will also be emitted (if it occurs).<br />
1068 /// <since_tizen> 3 </since_tizen>
1069 public event EventHandler<TouchEventArgs> TouchEvent
1075 _stageTouchHandler += value;
1076 _stageTouchCallbackDelegate = OnStageTouch;
1077 this.TouchSignal().Connect(_stageTouchCallbackDelegate);
1084 if (_stageTouchHandler != null)
1086 this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
1088 _stageTouchHandler -= value;
1093 private void OnStageTouch(IntPtr data)
1095 TouchEventArgs e = new TouchEventArgs();
1099 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
1102 if (_stageTouchHandler != null)
1104 _stageTouchHandler(this, e);
1109 /// Wheel event arguments.
1111 /// <since_tizen> 3 </since_tizen>
1112 public class WheelEventArgs : EventArgs
1114 private Wheel _wheel;
1119 /// <since_tizen> 3 </since_tizen>
1133 private event EventHandler<WheelEventArgs> _stageWheelHandler;
1134 private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
1137 /// This event is emitted when the wheel event is received.
1139 /// <since_tizen> 3 </since_tizen>
1140 public event EventHandler<WheelEventArgs> WheelEvent
1144 if (_stageWheelHandler == null)
1146 _stageWheelCallbackDelegate = OnStageWheel;
1147 WheelEventSignal().Connect(_stageWheelCallbackDelegate);
1149 _stageWheelHandler += value;
1153 _stageWheelHandler -= value;
1154 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
1156 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
1161 private void OnStageWheel(IntPtr data)
1163 WheelEventArgs e = new WheelEventArgs();
1167 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
1170 if (_stageWheelHandler != null)
1172 _stageWheelHandler(this, e);
1177 /// Key event arguments.
1179 /// <since_tizen> 3 </since_tizen>
1180 public class KeyEventArgs : EventArgs
1187 /// <since_tizen> 3 </since_tizen>
1201 private event EventHandler<KeyEventArgs> _stageKeyHandler;
1202 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1205 /// This event is emitted when the key event is received.
1207 /// <since_tizen> 3 </since_tizen>
1208 public event EventHandler<KeyEventArgs> KeyEvent
1212 if (_stageKeyHandler == null)
1214 _stageKeyCallbackDelegate = OnStageKey;
1215 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1217 _stageKeyHandler += value;
1221 _stageKeyHandler -= value;
1222 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1224 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1229 // Callback for Stage KeyEventsignal
1230 private void OnStageKey(IntPtr data)
1232 KeyEventArgs e = new KeyEventArgs();
1236 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1239 if (_stageKeyHandler != null)
1241 //here we send all data to user event handlers
1242 _stageKeyHandler(this, e);
1247 private event EventHandler _stageEventProcessingFinishedEventHandler;
1248 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1250 internal event EventHandler EventProcessingFinished
1254 if (_stageEventProcessingFinishedEventHandler == null)
1256 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1257 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1259 _stageEventProcessingFinishedEventHandler += value;
1264 _stageEventProcessingFinishedEventHandler -= value;
1265 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1267 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1272 // Callback for Stage EventProcessingFinishedSignal
1273 private void OnEventProcessingFinished()
1275 if (_stageEventProcessingFinishedEventHandler != null)
1277 _stageEventProcessingFinishedEventHandler(this, null);
1282 private EventHandler _stageContextLostEventHandler;
1283 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1285 internal event EventHandler ContextLost
1289 if (_stageContextLostEventHandler == null)
1291 _stageContextLostEventCallbackDelegate = OnContextLost;
1292 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1294 _stageContextLostEventHandler += value;
1298 _stageContextLostEventHandler -= value;
1299 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1301 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1306 // Callback for Stage ContextLostSignal
1307 private void OnContextLost()
1309 if (_stageContextLostEventHandler != null)
1311 _stageContextLostEventHandler(this, null);
1316 private EventHandler _stageContextRegainedEventHandler;
1317 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1319 internal event EventHandler ContextRegained
1323 if (_stageContextRegainedEventHandler == null)
1325 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1326 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1328 _stageContextRegainedEventHandler += value;
1332 _stageContextRegainedEventHandler -= value;
1333 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1335 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1340 // Callback for Stage ContextRegainedSignal
1341 private void OnContextRegained()
1343 if (_stageContextRegainedEventHandler != null)
1345 _stageContextRegainedEventHandler(this, null);
1350 private EventHandler _stageSceneCreatedEventHandler;
1351 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1353 internal event EventHandler SceneCreated
1357 if (_stageSceneCreatedEventHandler == null)
1359 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1360 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1362 _stageSceneCreatedEventHandler += value;
1366 _stageSceneCreatedEventHandler -= value;
1367 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1369 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1374 // Callback for Stage SceneCreatedSignal
1375 private void OnSceneCreated()
1377 if (_stageSceneCreatedEventHandler != null)
1379 _stageSceneCreatedEventHandler(this, null);
1384 /// This resized event arguments.
1386 /// <since_tizen> 3 </since_tizen>
1387 public class ResizedEventArgs : EventArgs
1392 /// This window size.
1394 /// <since_tizen> 4 </since_tizen>
1395 public Size2D WindowSize
1403 _windowSize = value;
1408 private WindowResizedEventCallbackType _windowResizedEventCallback;
1409 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1410 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1411 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1414 /// This event is emitted when the window resized.
1416 /// <since_tizen> 3 </since_tizen>
1417 public event EventHandler<ResizedEventArgs> Resized
1421 if (_windowResizedEventHandler == null)
1423 _windowResizedEventCallback = OnResized;
1424 ResizedSignal().Connect(_windowResizedEventCallback);
1427 _windowResizedEventHandler += value;
1431 _windowResizedEventHandler -= value;
1433 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1435 ResizedSignal().Disconnect(_windowResizedEventCallback);
1440 private void OnResized(IntPtr windowSize)
1442 ResizedEventArgs e = new ResizedEventArgs();
1443 var val = new Uint16Pair(windowSize, false);
1444 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1447 if (_windowResizedEventHandler != null)
1449 _windowResizedEventHandler(this, e);
1453 internal void SetWindowSize(Size2D size)
1455 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1456 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1458 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1461 internal Size2D GetWindowSize()
1463 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1464 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1466 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1470 internal void SetPosition(Position2D position)
1472 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1473 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1475 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1478 internal Position2D GetPosition()
1480 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1481 Position2D ret = new Position2D(val.GetX(), val.GetY());
1483 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1488 /// Sets whether the window is transparent or not.
1490 /// <param name="transparent">Whether the window is transparent.</param>
1491 /// <since_tizen> 5 </since_tizen>
1492 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1493 [EditorBrowsable(EditorBrowsableState.Never)]
1494 public void SetTransparency(bool transparent)
1496 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1497 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1501 /// The window size property (read-only).
1503 /// <since_tizen> 3 </since_tizen>
1508 Size2D ret = GetSize();
1514 /// The background color property.
1516 /// <since_tizen> 3 </since_tizen>
1517 public Color BackgroundColor
1521 SetBackgroundColor(value);
1525 Color ret = GetBackgroundColor();
1531 /// The DPI property (read-only).<br />
1532 /// Retrieves the DPI of the display device to which the Window is connected.<br />
1534 /// <since_tizen> 3 </since_tizen>
1544 /// The layer count property (read-only).<br />
1545 /// Queries the number of on-Window layers.<br />
1547 /// <since_tizen> 3 </since_tizen>
1548 public uint LayerCount
1552 return GetLayerCount();
1558 /// Adds a layer to the stage.
1560 /// <param name="layer">Layer to add.</param>
1561 /// <since_tizen> 3 </since_tizen>
1562 public void AddLayer(Layer layer)
1564 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1565 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1567 LayersChildren.Add(layer);
1571 /// Removes a layer from the stage.
1573 /// <param name="layer">Layer to remove.</param>
1574 /// <since_tizen> 3 </since_tizen>
1575 public void RemoveLayer(Layer layer)
1577 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1578 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1580 LayersChildren.Remove(layer);
1584 /// Please do not use! this will be deprecated
1586 /// <since_tizen> 3 </since_tizen>
1587 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1589 "Window.Instance.FocusChanged = OnFocusChanged; " +
1590 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1591 [EditorBrowsable(EditorBrowsableState.Never)]
1592 public class WindowFocusChangedEventArgs : EventArgs
1595 /// Please do not use! this will be deprecated
1597 /// <since_tizen> 3 </since_tizen>
1598 public bool FocusGained
1605 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1606 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1607 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1608 private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1611 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1613 /// <since_tizen> 3 </since_tizen>
1614 /// Please do not use! this will be deprecated!
1615 /// Instead please use FocusChanged.
1616 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
1618 "Window.Instance.FocusChanged = OnFocusChanged; " +
1619 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1620 [EditorBrowsable(EditorBrowsableState.Never)]
1621 public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1625 if (_windowFocusChangedEventHandler2 == null)
1627 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1628 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1631 _windowFocusChangedEventHandler2 += value;
1635 _windowFocusChangedEventHandler2 -= value;
1637 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1639 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1644 private void OnWindowFocusedChanged2(bool focusGained)
1646 WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1648 e.FocusGained = focusGained;
1650 if (_windowFocusChangedEventHandler2 != null)
1652 _windowFocusChangedEventHandler2(this, e);
1657 /// Gets or sets a size of the window.
1659 /// <since_tizen> 4 </since_tizen>
1660 public Size2D WindowSize
1664 return GetWindowSize();
1668 SetWindowSize(value);
1673 /// Gets or sets a position of the window.
1675 /// <since_tizen> 4 </since_tizen>
1676 public Position2D WindowPosition
1680 return GetPosition();
1689 /// Feed a key-event into the window.
1691 /// <param name="keyEvent">The key event to feed.</param>
1692 /// <since_tizen> 5 </since_tizen>
1693 [EditorBrowsable(EditorBrowsableState.Never)]
1694 public void FeedKey(Key keyEvent)
1696 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1697 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1701 /// Feed a key-event into the window.
1703 /// <param name="keyEvent">The key event to feed.</param>
1704 /// <since_tizen> 4 </since_tizen>
1705 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
1706 public static void FeedKeyEvent(Key keyEvent)
1708 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1709 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1713 /// Allows at least one more render, even when paused.
1714 /// The window should be shown, not minimised.
1716 /// <since_tizen> 4 </since_tizen>
1717 public void RenderOnce()
1719 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1720 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1724 /// Contains and encapsulates Native Window handle.
1726 /// <since_tizen> 4 </since_tizen>
1727 public class SafeNativeWindowHandle : SafeHandle
1730 /// Contructor, Native window handle is set to handle.
1732 /// <since_tizen> 4 </since_tizen>
1733 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1735 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1738 /// Null check if the handle is valid or not.
1740 /// <since_tizen> 4 </since_tizen>
1741 public override bool IsInvalid
1745 return this.handle == IntPtr.Zero;
1749 /// Release handle itself.
1751 /// <returns>true when released successfully.</returns>
1752 /// <since_tizen> 4 </since_tizen>
1753 protected override bool ReleaseHandle()