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 [EditorBrowsable(EditorBrowsableState.Never)]
68 protected override void Dispose(DisposeTypes type)
75 if (type == DisposeTypes.Explicit)
78 //Release your own managed resources here.
79 //You should release all of your own disposable objects here.
82 //Release your own unmanaged resources here.
83 //You should not access any managed member here except static instance.
84 //because the execution order of Finalizes is non-deterministic.
86 if (_windowFocusChangedEventCallback != null)
88 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
91 if (_stageTouchCallbackDelegate != null)
93 TouchSignal().Disconnect(_stageTouchCallbackDelegate);
96 if (_stageWheelCallbackDelegate != null)
98 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
101 if (_stageKeyCallbackDelegate != null)
103 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
106 if (_stageEventProcessingFinishedEventCallbackDelegate != null)
108 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
111 if (_stageContextLostEventCallbackDelegate != null)
113 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
116 if (_stageContextRegainedEventCallbackDelegate != null)
118 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
121 if (_stageSceneCreatedEventCallbackDelegate != null)
123 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
126 if (_windowResizedEventCallback != null)
128 ResizedSignal().Disconnect(_windowResizedEventCallback);
131 if (_windowFocusChangedEventCallback2 != null)
133 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
136 if (swigCPtr.Handle != global::System.IntPtr.Zero)
141 NDalicPINVOKE.delete_Window(swigCPtr);
142 NDalicPINVOKE.delete_Stage(stageCPtr);
144 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
150 internal static Window GetCurrent()
152 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 internal static bool IsInstalled()
159 bool ret = NDalicPINVOKE.Stage_IsInstalled();
160 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165 /// Sets whether the window accepts a focus or not.
167 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
168 /// <since_tizen> 3 </since_tizen>
169 public void SetAcceptFocus(bool accept)
171 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176 /// Returns whether the window accepts a focus or not.
178 /// <returns>True if the window accepts a focus, false otherwise.</returns>
179 /// <since_tizen> 3 </since_tizen>
180 public bool IsFocusAcceptable()
182 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
183 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189 /// Shows the window if it is hidden.
191 /// <since_tizen> 3 </since_tizen>
194 NDalicPINVOKE.Show(swigCPtr);
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199 /// Hides the window if it is showing.
201 /// <since_tizen> 3 </since_tizen>
204 NDalicPINVOKE.Hide(swigCPtr);
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209 /// Retrieves whether the window is visible or not.
211 /// <returns>True if the window is visible.</returns>
212 /// <since_tizen> 3 </since_tizen>
213 public bool IsVisible()
215 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
216 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 /// Gets the count of supported auxiliary hints of the window.
223 /// <returns>The number of supported auxiliary hints.</returns>
224 /// <since_tizen> 3 </since_tizen>
225 public uint GetSupportedAuxiliaryHintCount()
227 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233 /// Gets the supported auxiliary hint string of the window.
235 /// <param name="index">The index of the supported auxiliary hint lists.</param>
236 /// <returns>The auxiliary hint string of the index.</returns>
237 /// <since_tizen> 3 </since_tizen>
238 public string GetSupportedAuxiliaryHint(uint index)
240 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246 /// Creates an auxiliary hint of the window.
248 /// <param name="hint">The auxiliary hint string.</param>
249 /// <param name="value">The value string.</param>
250 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
251 /// <since_tizen> 3 </since_tizen>
252 public uint AddAuxiliaryHint(string hint, string value)
254 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
255 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260 /// Removes an auxiliary hint of the window.
262 /// <param name="id">The ID of the auxiliary hint.</param>
263 /// <returns>True if no error occurred, false otherwise.</returns>
264 /// <since_tizen> 3 </since_tizen>
265 public bool RemoveAuxiliaryHint(uint id)
267 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 /// Changes a value of the auxiliary hint.
275 /// <param name="id">The auxiliary hint ID.</param>
276 /// <param name="value">The value string to be set.</param>
277 /// <returns>True if no error occurred, false otherwise.</returns>
278 /// <since_tizen> 3 </since_tizen>
279 public bool SetAuxiliaryHintValue(uint id, string value)
281 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287 /// Gets a value of the auxiliary hint.
289 /// <param name="id">The auxiliary hint ID.</param>
290 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
291 /// <since_tizen> 3 </since_tizen>
292 public string GetAuxiliaryHintValue(uint id)
294 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
295 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300 /// Gets an ID of the auxiliary hint string.
302 /// <param name="hint">The auxiliary hint string.</param>
303 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
304 /// <since_tizen> 3 </since_tizen>
305 public uint GetAuxiliaryHintId(string hint)
307 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313 /// Sets a region to accept input events.
315 /// <param name="inputRegion">The region to accept input events.</param>
316 /// <since_tizen> 3 </since_tizen>
317 public void SetInputRegion(Rectangle inputRegion)
319 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
320 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
324 /// Gets or sets a window type.
326 /// <since_tizen> 3 </since_tizen>
327 public WindowType Type
331 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
332 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
337 NDalicPINVOKE.SetType(swigCPtr, (int)value);
338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343 /// Sets a priority level for the specified notification window.
345 /// <param name="level">The notification window level.</param>
346 /// <returns>True if no error occurred, false otherwise.</returns>
347 /// <since_tizen> 3 </since_tizen>
348 public bool SetNotificationLevel(NotificationLevel level)
350 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
351 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356 /// Gets a priority level for the specified notification window.
358 /// <returns>The notification window level.</returns>
359 /// <since_tizen> 3 </since_tizen>
360 public NotificationLevel GetNotificationLevel()
362 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
363 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368 /// Sets a transparent window's visual state to opaque.
370 /// <param name="opaque">Whether the window's visual state is opaque.</param>
371 /// <since_tizen> 3 </since_tizen>
372 public void SetOpaqueState(bool opaque)
374 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
379 /// Returns whether a transparent window's visual state is opaque or not.
381 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
382 /// <since_tizen> 3 </since_tizen>
383 public bool IsOpaqueState()
385 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
386 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
391 /// Sets a window's screen off mode.
393 /// <param name="screenOffMode">The screen mode.</param>
394 /// <returns>True if no error occurred, false otherwise.</returns>
395 /// <since_tizen> 4 </since_tizen>
396 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
398 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
399 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404 /// Gets the screen mode of the window.
406 /// <returns>The screen off mode.</returns>
407 /// <since_tizen> 4 </since_tizen>
408 public ScreenOffMode GetScreenOffMode()
410 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
411 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
416 /// Sets preferred brightness of the window.
418 /// <param name="brightness">The preferred brightness (0 to 100).</param>
419 /// <returns>True if no error occurred, false otherwise.</returns>
420 /// <since_tizen> 3 </since_tizen>
421 public bool SetBrightness(int brightness)
423 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
424 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
429 /// Gets the preferred brightness of the window.
431 /// <returns>The preferred brightness.</returns>
432 /// <since_tizen> 3 </since_tizen>
433 public int GetBrightness()
435 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
436 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
441 /// The focus changed event argument.
443 /// <since_tizen> 3 </since_tizen>
444 public class FocusChangedEventArgs : EventArgs
447 /// FocusGained flag.
449 /// <since_tizen> 3 </since_tizen>
450 public bool FocusGained
457 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
458 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
459 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
460 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
463 /// FocusChanged event.
465 /// <since_tizen> 3 </since_tizen>
466 public event EventHandler<FocusChangedEventArgs> FocusChanged
470 if (_windowFocusChangedEventHandler == null)
472 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
473 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
476 _windowFocusChangedEventHandler += value;
480 _windowFocusChangedEventHandler -= value;
482 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
484 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
489 private void OnWindowFocusedChanged(bool focusGained)
491 FocusChangedEventArgs e = new FocusChangedEventArgs();
493 e.FocusGained = focusGained;
495 if (_windowFocusChangedEventHandler != null)
497 _windowFocusChangedEventHandler(this, e);
502 /// Gets/Sets a window title.
504 /// <since_tizen> 4 </since_tizen>
513 _windowTitle = value;
514 SetClass(_windowTitle, "");
518 internal WindowFocusSignalType WindowFocusChangedSignal()
520 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
521 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
525 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
527 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
532 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
535 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
537 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
540 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
542 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
545 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
547 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
548 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
551 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
553 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
554 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
557 internal void RotateIndicator(Window.WindowOrientation orientation)
559 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
560 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
564 /// Sets the window name and the class string.
566 /// <param name="name">The name of the window.</param>
567 /// <param name="klass">The class of the window.</param>
568 /// <since_tizen> 4 </since_tizen>
569 public void SetClass(string name, string klass)
571 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
572 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
576 /// Raises the window to the top of the window stack.
578 /// <since_tizen> 3 </since_tizen>
581 NDalicPINVOKE.Window_Raise(swigCPtr);
582 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
586 /// Lowers the window to the bottom of the window stack.
588 /// <since_tizen> 3 </since_tizen>
591 NDalicPINVOKE.Window_Lower(swigCPtr);
592 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
596 /// Activates the window to the top of the window stack even it is iconified.
598 /// <since_tizen> 3 </since_tizen>
599 public void Activate()
601 NDalicPINVOKE.Window_Activate(swigCPtr);
602 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
605 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
607 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
608 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
611 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
613 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
614 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
617 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
619 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
620 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
623 internal Window.WindowOrientation GetPreferredOrientation()
625 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
626 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
630 internal DragAndDropDetector GetDragAndDropDetector()
632 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
633 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637 internal Any GetNativeHandle()
639 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
640 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
644 internal WindowFocusSignalType FocusChangedSignal()
646 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
647 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
652 /// Gets the default ( root ) layer.
654 /// <returns>The root layer.</returns>
655 /// <since_tizen> 3 </since_tizen>
656 public Layer GetDefaultLayer()
658 return this.GetRootLayer();
661 internal void Add(Layer layer)
663 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
664 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
666 LayersChildren.Add(layer);
669 internal void Remove(Layer layer)
671 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
672 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
674 LayersChildren.Remove(layer);
678 /// Add a child view to window.
680 /// <param name="view">the child should be added to the window.</param>
681 /// <since_tizen> 3 </since_tizen>
682 public void Add(View view)
684 GetRootLayer()?.Add(view);
688 /// Remove a child view from window.
690 /// <param name="view">the child to be removed.</param>
691 /// <since_tizen> 3 </since_tizen>
692 public void Remove(View view)
694 GetRootLayer()?.Remove(view);
697 internal Vector2 GetSize()
699 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
700 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
704 internal RenderTaskList GetRenderTaskList()
706 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
707 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
712 /// Queries the number of on-window layers.
714 /// <returns>The number of layers.</returns>
715 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
716 internal uint GetLayerCount()
718 if (LayersChildren == null || LayersChildren.Count < 0)
721 return (uint) LayersChildren.Count;
725 /// Retrieves the layer at a specified depth.
727 /// <param name="depth">The layer's depth index.</param>
728 /// <returns>The layer found at the given depth.</returns>
729 /// <since_tizen> 3 </since_tizen>
730 public Layer GetLayer(uint depth)
732 if (depth < LayersChildren.Count)
734 Layer ret = LayersChildren[Convert.ToInt32(depth)];
743 internal Layer GetRootLayer()
745 // Window.IsInstalled() is actually true only when called from event thread and
746 // Core has been initialized, not when Stage is ready.
747 if (_rootLayer == null && Window.IsInstalled())
749 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
750 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751 LayersChildren.Add(_rootLayer);
756 internal void SetBackgroundColor(Vector4 color)
758 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
759 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
762 internal Vector4 GetBackgroundColor()
764 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
765 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769 internal Vector2 GetDpi()
771 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
772 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
776 internal ObjectRegistry GetObjectRegistry()
778 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
779 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
784 /// Keep rendering for at least the given amount of time.
786 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
787 /// <since_tizen> 3 </since_tizen>
788 public void KeepRendering(float durationSeconds)
790 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
791 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
794 internal KeyEventSignal KeyEventSignal()
796 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
797 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
801 internal VoidSignal EventProcessingFinishedSignal()
803 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
804 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
808 internal TouchSignal TouchSignal()
810 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
811 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815 private StageWheelSignal WheelEventSignal()
817 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
818 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 internal VoidSignal ContextLostSignal()
824 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
825 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
829 internal VoidSignal ContextRegainedSignal()
831 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
832 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
836 internal VoidSignal SceneCreatedSignal()
838 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
839 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
843 internal ResizedSignal ResizedSignal()
845 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
846 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
850 internal static Vector4 DEFAULT_BACKGROUND_COLOR
854 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
855 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
856 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
861 internal static Vector4 DEBUG_BACKGROUND_COLOR
865 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
866 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
867 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
872 private static readonly Window instance = Application.Instance.GetWindow();
875 /// The stage instance property (read-only).<br />
876 /// Gets the current window.<br />
878 /// <since_tizen> 3 </since_tizen>
879 public static Window Instance
888 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
889 /// This function can be used for following example scenarios: <br />
890 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
892 /// <param name="DaliKey">The key code to grab.</param>
893 /// <returns>True if the grab succeeds.</returns>
894 /// <since_tizen> 3 </since_tizen>
895 public bool GrabKeyTopmost(int DaliKey)
897 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
898 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
903 /// Ungrabs the key specified by a key for the window.<br />
904 /// 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 />
906 /// <param name="DaliKey">The key code to ungrab.</param>
907 /// <returns>True if the ungrab succeeds.</returns>
908 /// <since_tizen> 3 </since_tizen>
909 public bool UngrabKeyTopmost(int DaliKey)
911 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
912 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
917 /// Grabs the key specified by a key for a window in a GrabMode. <br />
918 /// Details: This function can be used for following example scenarios: <br />
919 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
920 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
921 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
923 /// <param name="DaliKey">The key code to grab.</param>
924 /// <param name="GrabMode">The grab mode for the key.</param>
925 /// <returns>True if the grab succeeds.</returns>
926 /// <since_tizen> 3 </since_tizen>
927 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
929 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
930 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
935 /// Ungrabs the key specified by a key for a window.<br />
936 /// 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 />
938 /// <param name="DaliKey">The key code to ungrab.</param>
939 /// <returns>True if the ungrab succeeds.</returns>
940 /// <since_tizen> 3 </since_tizen>
941 public bool UngrabKey(int DaliKey)
943 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
944 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
948 internal System.IntPtr GetNativeWindowHandler()
950 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
951 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
956 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
958 /// <since_tizen> 3 </since_tizen>
959 public enum WindowOrientation
962 /// Portrait orientation. The height of the display area is greater than the width.
964 /// <since_tizen> 3 </since_tizen>
967 /// Landscape orientation. A wide view area is needed.
969 /// <since_tizen> 3 </since_tizen>
972 /// Portrait inverse orientation.
974 /// <since_tizen> 3 </since_tizen>
975 PortraitInverse = 180,
977 /// Landscape inverse orientation.
979 /// <since_tizen> 3 </since_tizen>
980 LandscapeInverse = 270
984 /// Enumeration for the key grab mode for platform-level APIs.
986 /// <since_tizen> 3 </since_tizen>
987 public enum KeyGrabMode
990 /// Grabs a key only when on the top of the grabbing-window stack mode.
994 /// Grabs a key together with the other client window(s) mode.
998 /// 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.
1002 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
1008 /// Enumeration for opacity of the indicator.
1010 internal enum IndicatorBackgroundOpacity
1018 /// Enumeration for visible mode of the indicator.
1020 internal enum IndicatorVisibleMode
1028 /// The touch event argument.
1030 /// <since_tizen> 3 </since_tizen>
1031 public class TouchEventArgs : EventArgs
1033 private Touch _touch;
1038 /// <since_tizen> 3 </since_tizen>
1052 private event EventHandler<TouchEventArgs> _stageTouchHandler;
1053 private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
1056 /// This event is emitted when the screen is touched and when the touch ends.<br />
1057 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
1058 /// then when the last finger is lifted.<br />
1059 /// An interrupted event will also be emitted (if it occurs).<br />
1061 /// <since_tizen> 3 </since_tizen>
1062 public event EventHandler<TouchEventArgs> TouchEvent
1068 _stageTouchHandler += value;
1069 _stageTouchCallbackDelegate = OnStageTouch;
1070 this.TouchSignal().Connect(_stageTouchCallbackDelegate);
1077 if (_stageTouchHandler != null)
1079 this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
1081 _stageTouchHandler -= value;
1086 private void OnStageTouch(IntPtr data)
1088 TouchEventArgs e = new TouchEventArgs();
1092 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
1095 if (_stageTouchHandler != null)
1097 _stageTouchHandler(this, e);
1102 /// Wheel event arguments.
1104 /// <since_tizen> 3 </since_tizen>
1105 public class WheelEventArgs : EventArgs
1107 private Wheel _wheel;
1112 /// <since_tizen> 3 </since_tizen>
1126 private event EventHandler<WheelEventArgs> _stageWheelHandler;
1127 private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
1130 /// This event is emitted when the wheel event is received.
1132 /// <since_tizen> 3 </since_tizen>
1133 public event EventHandler<WheelEventArgs> WheelEvent
1137 if (_stageWheelHandler == null)
1139 _stageWheelCallbackDelegate = OnStageWheel;
1140 WheelEventSignal().Connect(_stageWheelCallbackDelegate);
1142 _stageWheelHandler += value;
1146 _stageWheelHandler -= value;
1147 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
1149 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
1154 private void OnStageWheel(IntPtr data)
1156 WheelEventArgs e = new WheelEventArgs();
1160 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
1163 if (_stageWheelHandler != null)
1165 _stageWheelHandler(this, e);
1170 /// Key event arguments.
1172 /// <since_tizen> 3 </since_tizen>
1173 public class KeyEventArgs : EventArgs
1180 /// <since_tizen> 3 </since_tizen>
1194 private event EventHandler<KeyEventArgs> _stageKeyHandler;
1195 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1198 /// This event is emitted when the key event is received.
1200 /// <since_tizen> 3 </since_tizen>
1201 public event EventHandler<KeyEventArgs> KeyEvent
1205 if (_stageKeyHandler == null)
1207 _stageKeyCallbackDelegate = OnStageKey;
1208 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1210 _stageKeyHandler += value;
1214 _stageKeyHandler -= value;
1215 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1217 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1222 // Callback for Stage KeyEventsignal
1223 private void OnStageKey(IntPtr data)
1225 KeyEventArgs e = new KeyEventArgs();
1229 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1232 if (_stageKeyHandler != null)
1234 //here we send all data to user event handlers
1235 _stageKeyHandler(this, e);
1240 private event EventHandler _stageEventProcessingFinishedEventHandler;
1241 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1243 internal event EventHandler EventProcessingFinished
1247 if (_stageEventProcessingFinishedEventHandler == null)
1249 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1250 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1252 _stageEventProcessingFinishedEventHandler += value;
1257 _stageEventProcessingFinishedEventHandler -= value;
1258 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1260 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1265 // Callback for Stage EventProcessingFinishedSignal
1266 private void OnEventProcessingFinished()
1268 if (_stageEventProcessingFinishedEventHandler != null)
1270 _stageEventProcessingFinishedEventHandler(this, null);
1275 private EventHandler _stageContextLostEventHandler;
1276 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1278 internal event EventHandler ContextLost
1282 if (_stageContextLostEventHandler == null)
1284 _stageContextLostEventCallbackDelegate = OnContextLost;
1285 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1287 _stageContextLostEventHandler += value;
1291 _stageContextLostEventHandler -= value;
1292 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1294 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1299 // Callback for Stage ContextLostSignal
1300 private void OnContextLost()
1302 if (_stageContextLostEventHandler != null)
1304 _stageContextLostEventHandler(this, null);
1309 private EventHandler _stageContextRegainedEventHandler;
1310 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1312 internal event EventHandler ContextRegained
1316 if (_stageContextRegainedEventHandler == null)
1318 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1319 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1321 _stageContextRegainedEventHandler += value;
1325 _stageContextRegainedEventHandler -= value;
1326 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1328 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1333 // Callback for Stage ContextRegainedSignal
1334 private void OnContextRegained()
1336 if (_stageContextRegainedEventHandler != null)
1338 _stageContextRegainedEventHandler(this, null);
1343 private EventHandler _stageSceneCreatedEventHandler;
1344 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1346 internal event EventHandler SceneCreated
1350 if (_stageSceneCreatedEventHandler == null)
1352 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1353 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1355 _stageSceneCreatedEventHandler += value;
1359 _stageSceneCreatedEventHandler -= value;
1360 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1362 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1367 // Callback for Stage SceneCreatedSignal
1368 private void OnSceneCreated()
1370 if (_stageSceneCreatedEventHandler != null)
1372 _stageSceneCreatedEventHandler(this, null);
1377 /// This resized event arguments.
1379 /// <since_tizen> 3 </since_tizen>
1380 public class ResizedEventArgs : EventArgs
1385 /// This window size.
1387 /// <since_tizen> 4 </since_tizen>
1388 public Size2D WindowSize
1396 _windowSize = value;
1401 private WindowResizedEventCallbackType _windowResizedEventCallback;
1402 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1403 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1404 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1407 /// This event is emitted when the window resized.
1409 /// <since_tizen> 3 </since_tizen>
1410 public event EventHandler<ResizedEventArgs> Resized
1414 if (_windowResizedEventHandler == null)
1416 _windowResizedEventCallback = OnResized;
1417 ResizedSignal().Connect(_windowResizedEventCallback);
1420 _windowResizedEventHandler += value;
1424 _windowResizedEventHandler -= value;
1426 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1428 ResizedSignal().Disconnect(_windowResizedEventCallback);
1433 private void OnResized(IntPtr windowSize)
1435 ResizedEventArgs e = new ResizedEventArgs();
1436 var val = new Uint16Pair(windowSize, false);
1437 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1440 if (_windowResizedEventHandler != null)
1442 _windowResizedEventHandler(this, e);
1446 internal void SetWindowSize(Size2D size)
1448 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1449 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1451 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1454 internal Size2D GetWindowSize()
1456 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1457 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1459 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1463 internal void SetPosition(Position2D position)
1465 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1466 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1468 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1471 internal Position2D GetPosition()
1473 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1474 Position2D ret = new Position2D(val.GetX(), val.GetY());
1476 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1481 /// Sets whether the window is transparent or not.
1483 /// <param name="transparent">Whether the window is transparent.</param>
1484 /// <since_tizen> 5 </since_tizen>
1485 public void SetTransparency(bool transparent) {
1486 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1487 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1491 /// The window size property (read-only).
1493 /// <since_tizen> 3 </since_tizen>
1498 Size2D ret = GetSize();
1504 /// The background color property.
1506 /// <since_tizen> 3 </since_tizen>
1507 public Color BackgroundColor
1511 SetBackgroundColor(value);
1515 Color ret = GetBackgroundColor();
1521 /// The DPI property (read-only).<br />
1522 /// Retrieves the DPI of the display device to which the Window is connected.<br />
1524 /// <since_tizen> 3 </since_tizen>
1534 /// The layer count property (read-only).<br />
1535 /// Queries the number of on-Window layers.<br />
1537 /// <since_tizen> 3 </since_tizen>
1538 public uint LayerCount
1542 return GetLayerCount();
1548 /// Adds a layer to the stage.
1550 /// <param name="layer">Layer to add.</param>
1551 /// <since_tizen> 3 </since_tizen>
1552 public void AddLayer(Layer layer)
1554 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1555 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1557 LayersChildren.Add(layer);
1561 /// Removes a layer from the stage.
1563 /// <param name="layer">Layer to remove.</param>
1564 /// <since_tizen> 3 </since_tizen>
1565 public void RemoveLayer(Layer layer)
1567 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1568 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1570 LayersChildren.Remove(layer);
1574 /// Please do not use! this will be deprecated
1576 /// <since_tizen> 3 </since_tizen>
1577 [EditorBrowsable(EditorBrowsableState.Never)]
1578 public class WindowFocusChangedEventArgs : EventArgs
1581 /// Please do not use! this will be deprecated
1583 /// <since_tizen> 3 </since_tizen>
1584 public bool FocusGained
1591 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1592 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1593 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1594 private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1597 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1599 /// <since_tizen> 3 </since_tizen>
1600 /// Please do not use! this will be deprecated!
1601 /// Instead please use FocusChanged.
1602 [Obsolete("Please do not use! this will be deprecated, instead please use FocusChanged")]
1603 [EditorBrowsable(EditorBrowsableState.Never)]
1604 public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1608 if (_windowFocusChangedEventHandler2 == null)
1610 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1611 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1614 _windowFocusChangedEventHandler2 += value;
1618 _windowFocusChangedEventHandler2 -= value;
1620 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1622 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1627 private void OnWindowFocusedChanged2(bool focusGained)
1629 WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1631 e.FocusGained = focusGained;
1633 if (_windowFocusChangedEventHandler2 != null)
1635 _windowFocusChangedEventHandler2(this, e);
1640 /// Gets or sets a size of the window.
1642 /// <since_tizen> 4 </since_tizen>
1643 public Size2D WindowSize
1647 return GetWindowSize();
1651 SetWindowSize(value);
1656 /// Gets or sets a position of the window.
1658 /// <since_tizen> 4 </since_tizen>
1659 public Position2D WindowPosition
1663 return GetPosition();
1672 /// Feed a key-event into the window.
1674 /// <since_tizen> 4 </since_tizen>
1675 public void FeedKeyEvent(Key keyEvent)
1677 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1678 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1682 /// Allows at least one more render, even when paused.
1683 /// The window should be shown, not minimised.
1685 /// <since_tizen> 4 </since_tizen>
1686 public void RenderOnce()
1688 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1689 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1693 /// Contains and encapsulates Native Window handle.
1695 /// <since_tizen> 4 </since_tizen>
1696 public class SafeNativeWindowHandle : SafeHandle
1699 /// Contructor, Native window handle is set to handle.
1701 /// <since_tizen> 4 </since_tizen>
1702 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1704 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1707 /// Null check if the handle is valid or not.
1709 /// <since_tizen> 4 </since_tizen>
1710 public override bool IsInvalid
1714 return this.handle == IntPtr.Zero;
1718 /// Release handle itself.
1720 /// <returns>true when released successfully.</returns>
1721 /// <since_tizen> 4 </since_tizen>
1722 protected override bool ReleaseHandle()