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.
371 /// <param name="opaque">Whether the window's visual state is opaque.</param>
372 /// <since_tizen> 3 </since_tizen>
373 public void SetOpaqueState(bool opaque)
375 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
380 /// Returns whether a transparent window's visual state is opaque or not.
382 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
383 /// <since_tizen> 3 </since_tizen>
384 public bool IsOpaqueState()
386 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
387 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
392 /// Sets a window's screen off mode.
394 /// <param name="screenOffMode">The screen mode.</param>
395 /// <returns>True if no error occurred, false otherwise.</returns>
396 /// <since_tizen> 4 </since_tizen>
397 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
399 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 /// Gets the screen mode of the window.
407 /// <returns>The screen off mode.</returns>
408 /// <since_tizen> 4 </since_tizen>
409 public ScreenOffMode GetScreenOffMode()
411 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
417 /// Sets preferred brightness of the window.
419 /// <param name="brightness">The preferred brightness (0 to 100).</param>
420 /// <returns>True if no error occurred, false otherwise.</returns>
421 /// <since_tizen> 3 </since_tizen>
422 public bool SetBrightness(int brightness)
424 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
430 /// Gets the preferred brightness of the window.
432 /// <returns>The preferred brightness.</returns>
433 /// <since_tizen> 3 </since_tizen>
434 public int GetBrightness()
436 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
437 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
442 /// The focus changed event argument.
444 /// <since_tizen> 3 </since_tizen>
445 public class FocusChangedEventArgs : EventArgs
448 /// FocusGained flag.
450 /// <since_tizen> 3 </since_tizen>
451 public bool FocusGained
458 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
459 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
460 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
461 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
464 /// FocusChanged event.
466 /// <since_tizen> 3 </since_tizen>
467 public event EventHandler<FocusChangedEventArgs> FocusChanged
471 if (_windowFocusChangedEventHandler == null)
473 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
474 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
477 _windowFocusChangedEventHandler += value;
481 _windowFocusChangedEventHandler -= value;
483 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
485 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
490 private void OnWindowFocusedChanged(bool focusGained)
492 FocusChangedEventArgs e = new FocusChangedEventArgs();
494 e.FocusGained = focusGained;
496 if (_windowFocusChangedEventHandler != null)
498 _windowFocusChangedEventHandler(this, e);
503 /// Gets/Sets a window title.
505 /// <since_tizen> 4 </since_tizen>
514 _windowTitle = value;
515 SetClass(_windowTitle, "");
519 internal WindowFocusSignalType WindowFocusChangedSignal()
521 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
522 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
526 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
528 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
531 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
533 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
536 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
538 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
541 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
543 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
546 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
548 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
549 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
552 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
554 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
555 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
558 internal void RotateIndicator(Window.WindowOrientation orientation)
560 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
561 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
565 /// Sets the window name and the class string.
567 /// <param name="name">The name of the window.</param>
568 /// <param name="klass">The class of the window.</param>
569 /// <since_tizen> 4 </since_tizen>
570 public void SetClass(string name, string klass)
572 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
573 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
577 /// Raises the window to the top of the window stack.
579 /// <since_tizen> 3 </since_tizen>
582 NDalicPINVOKE.Window_Raise(swigCPtr);
583 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
587 /// Lowers the window to the bottom of the window stack.
589 /// <since_tizen> 3 </since_tizen>
592 NDalicPINVOKE.Window_Lower(swigCPtr);
593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
597 /// Activates the window to the top of the window stack even it is iconified.
599 /// <since_tizen> 3 </since_tizen>
600 public void Activate()
602 NDalicPINVOKE.Window_Activate(swigCPtr);
603 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
606 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
608 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
609 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
614 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
615 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
618 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
620 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
621 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
624 internal Window.WindowOrientation GetPreferredOrientation()
626 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
627 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
631 internal DragAndDropDetector GetDragAndDropDetector()
633 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
634 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
638 internal Any GetNativeHandle()
640 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
641 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
645 internal WindowFocusSignalType FocusChangedSignal()
647 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
648 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
653 /// Gets the default ( root ) layer.
655 /// <returns>The root layer.</returns>
656 /// <since_tizen> 3 </since_tizen>
657 public Layer GetDefaultLayer()
659 return this.GetRootLayer();
662 internal void Add(Layer layer)
664 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
665 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
667 LayersChildren.Add(layer);
670 internal void Remove(Layer layer)
672 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
673 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
675 LayersChildren.Remove(layer);
679 /// Add a child view to window.
681 /// <param name="view">the child should be added to the window.</param>
682 /// <since_tizen> 3 </since_tizen>
683 public void Add(View view)
685 GetRootLayer()?.Add(view);
689 /// Remove a child view from window.
691 /// <param name="view">the child to be removed.</param>
692 /// <since_tizen> 3 </since_tizen>
693 public void Remove(View view)
695 GetRootLayer()?.Remove(view);
698 internal Vector2 GetSize()
700 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
701 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
705 internal RenderTaskList GetRenderTaskList()
707 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
708 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
713 /// Queries the number of on-window layers.
715 /// <returns>The number of layers.</returns>
716 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
717 internal uint GetLayerCount()
719 if (LayersChildren == null || LayersChildren.Count < 0)
722 return (uint) LayersChildren.Count;
726 /// Retrieves the layer at a specified depth.
728 /// <param name="depth">The layer's depth index.</param>
729 /// <returns>The layer found at the given depth.</returns>
730 /// <since_tizen> 3 </since_tizen>
731 public Layer GetLayer(uint depth)
733 if (depth < LayersChildren.Count)
735 Layer ret = LayersChildren[Convert.ToInt32(depth)];
744 internal Layer GetRootLayer()
746 // Window.IsInstalled() is actually true only when called from event thread and
747 // Core has been initialized, not when Stage is ready.
748 if (_rootLayer == null && Window.IsInstalled())
750 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
751 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
752 LayersChildren.Add(_rootLayer);
757 internal void SetBackgroundColor(Vector4 color)
759 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
760 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763 internal Vector4 GetBackgroundColor()
765 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
766 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 internal Vector2 GetDpi()
772 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
773 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777 internal ObjectRegistry GetObjectRegistry()
779 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
780 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
785 /// Keep rendering for at least the given amount of time.
787 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
788 /// <since_tizen> 3 </since_tizen>
789 public void KeepRendering(float durationSeconds)
791 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
792 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
795 internal KeyEventSignal KeyEventSignal()
797 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
798 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
802 internal VoidSignal EventProcessingFinishedSignal()
804 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
805 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
809 internal TouchSignal TouchSignal()
811 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
812 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
816 private StageWheelSignal WheelEventSignal()
818 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
819 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823 internal VoidSignal ContextLostSignal()
825 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
826 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
830 internal VoidSignal ContextRegainedSignal()
832 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
833 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
837 internal VoidSignal SceneCreatedSignal()
839 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
840 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
844 internal ResizedSignal ResizedSignal()
846 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
847 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
851 internal static Vector4 DEFAULT_BACKGROUND_COLOR
855 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
856 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
857 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
862 internal static Vector4 DEBUG_BACKGROUND_COLOR
866 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
867 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
868 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
873 private static readonly Window instance = Application.Instance.GetWindow();
876 /// The stage instance property (read-only).<br />
877 /// Gets the current window.<br />
879 /// <since_tizen> 3 </since_tizen>
880 public static Window Instance
889 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
890 /// This function can be used for following example scenarios: <br />
891 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
893 /// <param name="DaliKey">The key code to grab.</param>
894 /// <returns>True if the grab succeeds.</returns>
895 /// <since_tizen> 3 </since_tizen>
896 public bool GrabKeyTopmost(int DaliKey)
898 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
899 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
904 /// Ungrabs the key specified by a key for the window.<br />
905 /// 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 />
907 /// <param name="DaliKey">The key code to ungrab.</param>
908 /// <returns>True if the ungrab succeeds.</returns>
909 /// <since_tizen> 3 </since_tizen>
910 public bool UngrabKeyTopmost(int DaliKey)
912 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
913 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
918 /// Grabs the key specified by a key for a window in a GrabMode. <br />
919 /// Details: This function can be used for following example scenarios: <br />
920 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
921 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
922 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
924 /// <param name="DaliKey">The key code to grab.</param>
925 /// <param name="GrabMode">The grab mode for the key.</param>
926 /// <returns>True if the grab succeeds.</returns>
927 /// <since_tizen> 3 </since_tizen>
928 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
930 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
931 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
936 /// Ungrabs the key specified by a key for a window.<br />
937 /// 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 />
939 /// <param name="DaliKey">The key code to ungrab.</param>
940 /// <returns>True if the ungrab succeeds.</returns>
941 /// <since_tizen> 3 </since_tizen>
942 public bool UngrabKey(int DaliKey)
944 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
945 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
949 internal System.IntPtr GetNativeWindowHandler()
951 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
952 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
957 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
959 /// <since_tizen> 3 </since_tizen>
960 public enum WindowOrientation
963 /// Portrait orientation. The height of the display area is greater than the width.
965 /// <since_tizen> 3 </since_tizen>
968 /// Landscape orientation. A wide view area is needed.
970 /// <since_tizen> 3 </since_tizen>
973 /// Portrait inverse orientation.
975 /// <since_tizen> 3 </since_tizen>
976 PortraitInverse = 180,
978 /// Landscape inverse orientation.
980 /// <since_tizen> 3 </since_tizen>
981 LandscapeInverse = 270
985 /// Enumeration for the key grab mode for platform-level APIs.
987 /// <since_tizen> 3 </since_tizen>
988 public enum KeyGrabMode
991 /// Grabs a key only when on the top of the grabbing-window stack mode.
995 /// Grabs a key together with the other client window(s) mode.
999 /// 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.
1003 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
1009 /// Enumeration for opacity of the indicator.
1011 internal enum IndicatorBackgroundOpacity
1019 /// Enumeration for visible mode of the indicator.
1021 internal enum IndicatorVisibleMode
1029 /// The touch event argument.
1031 /// <since_tizen> 3 </since_tizen>
1032 public class TouchEventArgs : EventArgs
1034 private Touch _touch;
1039 /// <since_tizen> 3 </since_tizen>
1053 private event EventHandler<TouchEventArgs> _stageTouchHandler;
1054 private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
1057 /// This event is emitted when the screen is touched and when the touch ends.<br />
1058 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
1059 /// then when the last finger is lifted.<br />
1060 /// An interrupted event will also be emitted (if it occurs).<br />
1062 /// <since_tizen> 3 </since_tizen>
1063 public event EventHandler<TouchEventArgs> TouchEvent
1069 _stageTouchHandler += value;
1070 _stageTouchCallbackDelegate = OnStageTouch;
1071 this.TouchSignal().Connect(_stageTouchCallbackDelegate);
1078 if (_stageTouchHandler != null)
1080 this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
1082 _stageTouchHandler -= value;
1087 private void OnStageTouch(IntPtr data)
1089 TouchEventArgs e = new TouchEventArgs();
1093 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
1096 if (_stageTouchHandler != null)
1098 _stageTouchHandler(this, e);
1103 /// Wheel event arguments.
1105 /// <since_tizen> 3 </since_tizen>
1106 public class WheelEventArgs : EventArgs
1108 private Wheel _wheel;
1113 /// <since_tizen> 3 </since_tizen>
1127 private event EventHandler<WheelEventArgs> _stageWheelHandler;
1128 private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
1131 /// This event is emitted when the wheel event is received.
1133 /// <since_tizen> 3 </since_tizen>
1134 public event EventHandler<WheelEventArgs> WheelEvent
1138 if (_stageWheelHandler == null)
1140 _stageWheelCallbackDelegate = OnStageWheel;
1141 WheelEventSignal().Connect(_stageWheelCallbackDelegate);
1143 _stageWheelHandler += value;
1147 _stageWheelHandler -= value;
1148 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
1150 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
1155 private void OnStageWheel(IntPtr data)
1157 WheelEventArgs e = new WheelEventArgs();
1161 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
1164 if (_stageWheelHandler != null)
1166 _stageWheelHandler(this, e);
1171 /// Key event arguments.
1173 /// <since_tizen> 3 </since_tizen>
1174 public class KeyEventArgs : EventArgs
1181 /// <since_tizen> 3 </since_tizen>
1195 private event EventHandler<KeyEventArgs> _stageKeyHandler;
1196 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1199 /// This event is emitted when the key event is received.
1201 /// <since_tizen> 3 </since_tizen>
1202 public event EventHandler<KeyEventArgs> KeyEvent
1206 if (_stageKeyHandler == null)
1208 _stageKeyCallbackDelegate = OnStageKey;
1209 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1211 _stageKeyHandler += value;
1215 _stageKeyHandler -= value;
1216 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1218 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1223 // Callback for Stage KeyEventsignal
1224 private void OnStageKey(IntPtr data)
1226 KeyEventArgs e = new KeyEventArgs();
1230 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1233 if (_stageKeyHandler != null)
1235 //here we send all data to user event handlers
1236 _stageKeyHandler(this, e);
1241 private event EventHandler _stageEventProcessingFinishedEventHandler;
1242 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1244 internal event EventHandler EventProcessingFinished
1248 if (_stageEventProcessingFinishedEventHandler == null)
1250 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1251 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1253 _stageEventProcessingFinishedEventHandler += value;
1258 _stageEventProcessingFinishedEventHandler -= value;
1259 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1261 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1266 // Callback for Stage EventProcessingFinishedSignal
1267 private void OnEventProcessingFinished()
1269 if (_stageEventProcessingFinishedEventHandler != null)
1271 _stageEventProcessingFinishedEventHandler(this, null);
1276 private EventHandler _stageContextLostEventHandler;
1277 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1279 internal event EventHandler ContextLost
1283 if (_stageContextLostEventHandler == null)
1285 _stageContextLostEventCallbackDelegate = OnContextLost;
1286 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1288 _stageContextLostEventHandler += value;
1292 _stageContextLostEventHandler -= value;
1293 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1295 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1300 // Callback for Stage ContextLostSignal
1301 private void OnContextLost()
1303 if (_stageContextLostEventHandler != null)
1305 _stageContextLostEventHandler(this, null);
1310 private EventHandler _stageContextRegainedEventHandler;
1311 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1313 internal event EventHandler ContextRegained
1317 if (_stageContextRegainedEventHandler == null)
1319 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1320 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1322 _stageContextRegainedEventHandler += value;
1326 _stageContextRegainedEventHandler -= value;
1327 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1329 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1334 // Callback for Stage ContextRegainedSignal
1335 private void OnContextRegained()
1337 if (_stageContextRegainedEventHandler != null)
1339 _stageContextRegainedEventHandler(this, null);
1344 private EventHandler _stageSceneCreatedEventHandler;
1345 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1347 internal event EventHandler SceneCreated
1351 if (_stageSceneCreatedEventHandler == null)
1353 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1354 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1356 _stageSceneCreatedEventHandler += value;
1360 _stageSceneCreatedEventHandler -= value;
1361 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1363 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1368 // Callback for Stage SceneCreatedSignal
1369 private void OnSceneCreated()
1371 if (_stageSceneCreatedEventHandler != null)
1373 _stageSceneCreatedEventHandler(this, null);
1378 /// This resized event arguments.
1380 /// <since_tizen> 3 </since_tizen>
1381 public class ResizedEventArgs : EventArgs
1386 /// This window size.
1388 /// <since_tizen> 4 </since_tizen>
1389 public Size2D WindowSize
1397 _windowSize = value;
1402 private WindowResizedEventCallbackType _windowResizedEventCallback;
1403 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1404 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1405 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1408 /// This event is emitted when the window resized.
1410 /// <since_tizen> 3 </since_tizen>
1411 public event EventHandler<ResizedEventArgs> Resized
1415 if (_windowResizedEventHandler == null)
1417 _windowResizedEventCallback = OnResized;
1418 ResizedSignal().Connect(_windowResizedEventCallback);
1421 _windowResizedEventHandler += value;
1425 _windowResizedEventHandler -= value;
1427 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1429 ResizedSignal().Disconnect(_windowResizedEventCallback);
1434 private void OnResized(IntPtr windowSize)
1436 ResizedEventArgs e = new ResizedEventArgs();
1437 var val = new Uint16Pair(windowSize, false);
1438 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1441 if (_windowResizedEventHandler != null)
1443 _windowResizedEventHandler(this, e);
1447 internal void SetWindowSize(Size2D size)
1449 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1450 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1452 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1455 internal Size2D GetWindowSize()
1457 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1458 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1460 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1464 internal void SetPosition(Position2D position)
1466 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1467 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1469 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1472 internal Position2D GetPosition()
1474 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1475 Position2D ret = new Position2D(val.GetX(), val.GetY());
1477 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1482 /// Sets whether the window is transparent or not.
1484 /// <param name="transparent">Whether the window is transparent.</param>
1485 /// <since_tizen> 5 </since_tizen>
1486 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1487 [EditorBrowsable(EditorBrowsableState.Never)]
1488 public void SetTransparency(bool transparent) {
1489 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1490 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1494 /// The window size property (read-only).
1496 /// <since_tizen> 3 </since_tizen>
1501 Size2D ret = GetSize();
1507 /// The background color property.
1509 /// <since_tizen> 3 </since_tizen>
1510 public Color BackgroundColor
1514 SetBackgroundColor(value);
1518 Color ret = GetBackgroundColor();
1524 /// The DPI property (read-only).<br />
1525 /// Retrieves the DPI of the display device to which the Window is connected.<br />
1527 /// <since_tizen> 3 </since_tizen>
1537 /// The layer count property (read-only).<br />
1538 /// Queries the number of on-Window layers.<br />
1540 /// <since_tizen> 3 </since_tizen>
1541 public uint LayerCount
1545 return GetLayerCount();
1551 /// Adds a layer to the stage.
1553 /// <param name="layer">Layer to add.</param>
1554 /// <since_tizen> 3 </since_tizen>
1555 public void AddLayer(Layer layer)
1557 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1558 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1560 LayersChildren.Add(layer);
1564 /// Removes a layer from the stage.
1566 /// <param name="layer">Layer to remove.</param>
1567 /// <since_tizen> 3 </since_tizen>
1568 public void RemoveLayer(Layer layer)
1570 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1571 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1573 LayersChildren.Remove(layer);
1577 /// Please do not use! this will be deprecated
1579 /// <since_tizen> 3 </since_tizen>
1580 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1582 "Window.Instance.FocusChanged = OnFocusChanged; " +
1583 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1584 [EditorBrowsable(EditorBrowsableState.Never)]
1585 public class WindowFocusChangedEventArgs : EventArgs
1588 /// Please do not use! this will be deprecated
1590 /// <since_tizen> 3 </since_tizen>
1591 public bool FocusGained
1598 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1599 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1600 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1601 private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1604 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1606 /// <since_tizen> 3 </since_tizen>
1607 /// Please do not use! this will be deprecated!
1608 /// Instead please use FocusChanged.
1609 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
1611 "Window.Instance.FocusChanged = OnFocusChanged; " +
1612 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1613 [EditorBrowsable(EditorBrowsableState.Never)]
1614 public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1618 if (_windowFocusChangedEventHandler2 == null)
1620 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1621 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1624 _windowFocusChangedEventHandler2 += value;
1628 _windowFocusChangedEventHandler2 -= value;
1630 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1632 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1637 private void OnWindowFocusedChanged2(bool focusGained)
1639 WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1641 e.FocusGained = focusGained;
1643 if (_windowFocusChangedEventHandler2 != null)
1645 _windowFocusChangedEventHandler2(this, e);
1650 /// Gets or sets a size of the window.
1652 /// <since_tizen> 4 </since_tizen>
1653 public Size2D WindowSize
1657 return GetWindowSize();
1661 SetWindowSize(value);
1666 /// Gets or sets a position of the window.
1668 /// <since_tizen> 4 </since_tizen>
1669 public Position2D WindowPosition
1673 return GetPosition();
1682 /// Feed a key-event into the window.
1684 /// <since_tizen> 4 </since_tizen>
1685 [Obsolete("Please do not use! This will be deprecated! Please use Window.Instance.FeedKeyEvent() instead!")]
1686 public void FeedKeyEvent(Key keyEvent)
1688 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1689 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1693 /// Allows at least one more render, even when paused.
1694 /// The window should be shown, not minimised.
1696 /// <since_tizen> 4 </since_tizen>
1697 public void RenderOnce()
1699 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1700 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1704 /// Contains and encapsulates Native Window handle.
1706 /// <since_tizen> 4 </since_tizen>
1707 public class SafeNativeWindowHandle : SafeHandle
1710 /// Contructor, Native window handle is set to handle.
1712 /// <since_tizen> 4 </since_tizen>
1713 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1715 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1718 /// Null check if the handle is valid or not.
1720 /// <since_tizen> 4 </since_tizen>
1721 public override bool IsInvalid
1725 return this.handle == IntPtr.Zero;
1729 /// Release handle itself.
1731 /// <returns>true when released successfully.</returns>
1732 /// <since_tizen> 4 </since_tizen>
1733 protected override bool ReleaseHandle()