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.
22 using System.Runtime.InteropServices;
23 using Tizen.NUI.BaseComponents;
24 using System.ComponentModel;
27 /// The window class is used internally for drawing.<br />
28 /// The window has an orientation and indicator properties.<br />
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 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
39 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
40 if (NDalicPINVOKE.Stage_IsInstalled())
42 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
46 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
48 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
52 /// To make the window instance be disposed.
54 protected override void Dispose(DisposeTypes type)
61 if (type == DisposeTypes.Explicit)
64 //Release your own managed resources here.
65 //You should release all of your own disposable objects here.
68 //Release your own unmanaged resources here.
69 //You should not access any managed member here except static instance.
70 //because the execution order of Finalizes is non-deterministic.
72 if (_windowFocusChangedEventCallback != null)
74 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
77 if (_stageTouchCallbackDelegate != null)
79 TouchSignal().Disconnect(_stageTouchCallbackDelegate);
82 if (_stageWheelCallbackDelegate != null)
84 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
87 if (_stageKeyCallbackDelegate != null)
89 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
92 if (_stageEventProcessingFinishedEventCallbackDelegate != null)
94 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
97 if (_stageContextLostEventCallbackDelegate != null)
99 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
102 if (_stageContextRegainedEventCallbackDelegate != null)
104 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
107 if (_stageSceneCreatedEventCallbackDelegate != null)
109 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
112 if (_windowResizedEventCallback != null)
114 ResizedSignal().Disconnect(_windowResizedEventCallback);
117 if (_windowFocusChangedEventCallback2 != null)
119 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
122 if (swigCPtr.Handle != global::System.IntPtr.Zero)
127 NDalicPINVOKE.delete_Window(swigCPtr);
128 NDalicPINVOKE.delete_Stage(stageCPtr);
130 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
136 internal static Window GetCurrent()
138 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
139 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143 internal static bool IsInstalled()
145 bool ret = NDalicPINVOKE.Stage_IsInstalled();
146 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151 /// Sets whether the window accepts a focus or not.
153 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
154 /// <since_tizen> 3 </since_tizen>
155 public void SetAcceptFocus(bool accept)
157 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162 /// Returns whether the window accepts a focus or not.
164 /// <returns>True if the window accepts a focus, false otherwise.</returns>
165 /// <since_tizen> 3 </since_tizen>
166 public bool IsFocusAcceptable()
168 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175 /// Shows the window if it is hidden.
177 /// <since_tizen> 3 </since_tizen>
180 NDalicPINVOKE.Show(swigCPtr);
181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185 /// Hides the window if it is showing.
187 /// <since_tizen> 3 </since_tizen>
190 NDalicPINVOKE.Hide(swigCPtr);
191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195 /// Retrieves whether the window is visible or not.
197 /// <returns>True if the window is visible.</returns>
198 /// <since_tizen> 3 </since_tizen>
199 public bool IsVisible()
201 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207 /// Gets the count of supported auxiliary hints of the window.
209 /// <returns>The number of supported auxiliary hints.</returns>
210 /// <since_tizen> 3 </since_tizen>
211 public uint GetSupportedAuxiliaryHintCount()
213 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 /// Gets the supported auxiliary hint string of the window.
221 /// <param name="index">The index of the supported auxiliary hint lists.</param>
222 /// <returns>The auxiliary hint string of the index.</returns>
223 /// <since_tizen> 3 </since_tizen>
224 public string GetSupportedAuxiliaryHint(uint index)
226 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232 /// Creates an auxiliary hint of the window.
234 /// <param name="hint">The auxiliary hint string.</param>
235 /// <param name="value">The value string.</param>
236 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
237 /// <since_tizen> 3 </since_tizen>
238 public uint AddAuxiliaryHint(string hint, string value)
240 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246 /// Removes an auxiliary hint of the window.
248 /// <param name="id">The ID of the auxiliary hint.</param>
249 /// <returns>True if no error occurred, false otherwise.</returns>
250 /// <since_tizen> 3 </since_tizen>
251 public bool RemoveAuxiliaryHint(uint id)
253 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
254 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259 /// Changes a value of the auxiliary hint.
261 /// <param name="id">The auxiliary hint ID.</param>
262 /// <param name="value">The value string to be set.</param>
263 /// <returns>True if no error occurred, false otherwise.</returns>
264 /// <since_tizen> 3 </since_tizen>
265 public bool SetAuxiliaryHintValue(uint id, string value)
267 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 /// Gets a value of the auxiliary hint.
275 /// <param name="id">The auxiliary hint ID.</param>
276 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
277 /// <since_tizen> 3 </since_tizen>
278 public string GetAuxiliaryHintValue(uint id)
280 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 /// Gets an ID of the auxiliary hint string.
288 /// <param name="hint">The auxiliary hint string.</param>
289 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
290 /// <since_tizen> 3 </since_tizen>
291 public uint GetAuxiliaryHintId(string hint)
293 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
299 /// Sets a region to accept input events.
301 /// <param name="inputRegion">The region to accept input events.</param>
302 /// <since_tizen> 3 </since_tizen>
303 public void SetInputRegion(Rectangle inputRegion)
305 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310 /// Gets or sets a window type.
312 /// <since_tizen> 3 </since_tizen>
313 public WindowType Type
317 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
323 NDalicPINVOKE.SetType(swigCPtr, (int)value);
324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
329 /// Sets a priority level for the specified notification window.
331 /// <param name="level">The notification window level.</param>
332 /// <returns>True if no error occurred, false otherwise.</returns>
333 /// <since_tizen> 3 </since_tizen>
334 public bool SetNotificationLevel(NotificationLevel level)
336 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
337 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342 /// Gets a priority level for the specified notification window.
344 /// <returns>The notification window level.</returns>
345 /// <since_tizen> 3 </since_tizen>
346 public NotificationLevel GetNotificationLevel()
348 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
349 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
354 /// Sets a transparent window's visual state to opaque.
356 /// <param name="opaque">Whether the window's visual state is opaque.</param>
357 /// <since_tizen> 3 </since_tizen>
358 public void SetOpaqueState(bool opaque)
360 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
361 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
365 /// Returns whether a transparent window's visual state is opaque or not.
367 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
368 /// <since_tizen> 3 </since_tizen>
369 public bool IsOpaqueState()
371 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
372 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377 /// Sets a window's screen off mode.
379 /// <param name="screenOffMode">The screen mode.</param>
380 /// <returns>True if no error occurred, false otherwise.</returns>
381 /// <since_tizen> 3 </since_tizen>
382 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
384 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
385 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
390 /// Gets the screen mode of the window.
392 /// <returns>The screen off mode.</returns>
393 /// <since_tizen> 3 </since_tizen>
394 public ScreenOffMode GetScreenOffMode()
396 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
397 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
402 /// Sets preferred brightness of the window.
404 /// <param name="brightness">The preferred brightness (0 to 100).</param>
405 /// <returns>True if no error occurred, false otherwise.</returns>
406 /// <since_tizen> 3 </since_tizen>
407 public bool SetBrightness(int brightness)
409 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
415 /// Gets the preferred brightness of the window.
417 /// <returns>The preferred brightness.</returns>
418 /// <since_tizen> 3 </since_tizen>
419 public int GetBrightness()
421 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
422 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427 /// The focus changed event argument.
429 public class FocusChangedEventArgs : EventArgs
432 /// FocusGained flag.
434 /// <since_tizen> 3 </since_tizen>
435 public bool FocusGained
442 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
443 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
444 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
445 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
448 /// FocusChanged event.
450 /// <since_tizen> 4 </since_tizen>
451 public event EventHandler<FocusChangedEventArgs> FocusChanged
455 if (_windowFocusChangedEventHandler == null)
457 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
458 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
461 _windowFocusChangedEventHandler += value;
465 _windowFocusChangedEventHandler -= value;
467 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
469 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
474 private void OnWindowFocusedChanged(bool focusGained)
476 FocusChangedEventArgs e = new FocusChangedEventArgs();
478 e.FocusGained = focusGained;
480 if (_windowFocusChangedEventHandler != null)
482 _windowFocusChangedEventHandler(this, e);
487 /// Gets/Sets a window title.
489 /// <since_tizen> 4 </since_tizen>
498 _windowTitle = value;
499 SetClass(_windowTitle, "");
503 internal WindowFocusSignalType WindowFocusChangedSignal()
505 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
506 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
510 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
512 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
515 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
517 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
520 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
522 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
525 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
527 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
532 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
533 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
536 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
538 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
539 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542 internal void RotateIndicator(Window.WindowOrientation orientation)
544 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
545 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
549 /// Sets the window name and the class string.
551 /// <param name="name">The name of the window.</param>
552 /// <param name="klass">The class of the window.</param>
553 /// <since_tizen> 4 </since_tizen>
554 public void SetClass(string name, string klass)
556 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
557 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
561 /// Raises the window to the top of the window stack.
563 /// <since_tizen> 3 </since_tizen>
566 NDalicPINVOKE.Window_Raise(swigCPtr);
567 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
571 /// Lowers the window to the bottom of the window stack.
573 /// <since_tizen> 3 </since_tizen>
576 NDalicPINVOKE.Window_Lower(swigCPtr);
577 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
581 /// Activates the window to the top of the window stack even it is iconified.
583 /// <since_tizen> 3 </since_tizen>
584 public void Activate()
586 NDalicPINVOKE.Window_Activate(swigCPtr);
587 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
592 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
596 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
598 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
599 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
602 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
604 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
605 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
608 internal Window.WindowOrientation GetPreferredOrientation()
610 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
611 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
615 internal DragAndDropDetector GetDragAndDropDetector()
617 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
618 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
622 internal Any GetNativeHandle()
624 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
625 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
629 internal WindowFocusSignalType FocusChangedSignal()
631 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
632 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637 /// Gets the default ( root ) layer.
639 /// <returns>The root layer.</returns>
640 /// <since_tizen> 3 </since_tizen>
641 public Layer GetDefaultLayer()
643 return this.GetRootLayer();
646 internal void Add(Layer layer)
648 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
649 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
652 internal void Remove(Layer layer)
654 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
655 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
659 /// Add a child view to window.
661 /// <param name="view">the child should be added to the window.</param>
662 /// <since_tizen> 3 </since_tizen>
663 public void Add(View view)
665 GetRootLayer()?.Add(view);
669 /// Remove a child view from window.
671 /// <param name="view">the child to be removed.</param>
672 /// <since_tizen> 3 </since_tizen>
673 public void Remove(View view)
675 GetRootLayer()?.Remove(view);
678 internal Vector2 GetSize()
680 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
681 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
685 internal RenderTaskList GetRenderTaskList()
687 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
688 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
693 /// Queries the number of on-window layers.
695 /// <returns>The number of layers.</returns>
696 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
697 internal uint GetLayerCount()
699 uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr);
700 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
705 /// Retrieves the layer at a specified depth.
707 /// <param name="depth">The layer's depth index.</param>
708 /// <returns>The layer found at the given depth.</returns>
709 /// <since_tizen> 3 </since_tizen>
710 public Layer GetLayer(uint depth)
712 IntPtr cPtr = NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth);
713 Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer;
715 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
719 internal Layer GetRootLayer()
721 // Window.IsInstalled() is actually true only when called from event thread and
722 // Core has been initialized, not when Stage is ready.
723 if (_rootLayer == null && Window.IsInstalled())
725 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
726 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
731 internal void SetBackgroundColor(Vector4 color)
733 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
734 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
737 internal Vector4 GetBackgroundColor()
739 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
740 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
744 internal Vector2 GetDpi()
746 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
747 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751 internal ObjectRegistry GetObjectRegistry()
753 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
759 /// Keep rendering for at least the given amount of time.
761 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
762 /// <since_tizen> 3 </since_tizen>
763 public void KeepRendering(float durationSeconds)
765 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
766 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769 internal KeyEventSignal KeyEventSignal()
771 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
772 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
776 internal VoidSignal EventProcessingFinishedSignal()
778 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
779 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
783 internal TouchSignal TouchSignal()
785 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
786 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
790 private StageWheelSignal WheelEventSignal()
792 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
793 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
797 internal VoidSignal ContextLostSignal()
799 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
800 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
804 internal VoidSignal ContextRegainedSignal()
806 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
807 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
811 internal VoidSignal SceneCreatedSignal()
813 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
814 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
818 internal ResizedSignal ResizedSignal()
820 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
821 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
825 internal static Vector4 DEFAULT_BACKGROUND_COLOR
829 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
830 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
831 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
836 internal static Vector4 DEBUG_BACKGROUND_COLOR
840 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
841 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
842 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
847 private static readonly Window instance = Application.Instance.GetWindow();
850 /// The stage instance property (read-only).<br />
851 /// Gets the current window.<br />
853 /// <since_tizen> 3 </since_tizen>
854 public static Window Instance
863 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
864 /// This function can be used for following example scenarios: <br />
865 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
867 /// <param name="DaliKey">The key code to grab.</param>
868 /// <returns>True if the grab succeeds.</returns>
869 /// <since_tizen> 3 </since_tizen>
870 public bool GrabKeyTopmost(int DaliKey)
872 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
873 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
878 /// Ungrabs the key specified by a key for the window.<br />
879 /// 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 />
881 /// <param name="DaliKey">The key code to ungrab.</param>
882 /// <returns>True if the ungrab succeeds.</returns>
883 /// <since_tizen> 3 </since_tizen>
884 public bool UngrabKeyTopmost(int DaliKey)
886 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
887 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
892 /// Grabs the key specified by a key for a window in a GrabMode. <br />
893 /// Details: This function can be used for following example scenarios: <br />
894 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
895 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
896 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
898 /// <param name="DaliKey">The key code to grab.</param>
899 /// <param name="GrabMode">The grab mode for the key.</param>
900 /// <returns>True if the grab succeeds.</returns>
901 /// <since_tizen> 3 </since_tizen>
902 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
904 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
905 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
910 /// Ungrabs the key specified by a key for a window.<br />
911 /// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event. <br />
913 /// <param name="DaliKey">The key code to ungrab.</param>
914 /// <returns>True if the ungrab succeeds.</returns>
915 /// <since_tizen> 3 </since_tizen>
916 public bool UngrabKey(int DaliKey)
918 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
919 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
923 internal System.IntPtr GetNativeWindowHandler()
925 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
926 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
931 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
933 /// <since_tizen> 3 </since_tizen>
934 public enum WindowOrientation
937 /// Portrait orientation. The height of the display area is greater than the width.
939 /// <since_tizen> 3 </since_tizen>
942 /// Landscape orientation. A wide view area is needed.
944 /// <since_tizen> 3 </since_tizen>
947 /// Portrait inverse orientation.
949 /// <since_tizen> 3 </since_tizen>
950 PortraitInverse = 180,
952 /// Landscape inverse orientation.
954 /// <since_tizen> 3 </since_tizen>
955 LandscapeInverse = 270
959 /// Enumeration for the key grab mode for platform-level APIs.
961 /// <since_tizen> 3 </since_tizen>
962 public enum KeyGrabMode
965 /// Grabs a key only when on the top of the grabbing-window stack mode.
969 /// Grabs a key together with the other client window(s) mode.
973 /// 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.
977 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
983 /// Enumeration for opacity of the indicator.
985 internal enum IndicatorBackgroundOpacity
993 /// Enumeration for visible mode of the indicator.
995 internal enum IndicatorVisibleMode
1003 /// The touch event argument.
1005 public class TouchEventArgs : EventArgs
1007 private Touch _touch;
1012 /// <since_tizen> 3 </since_tizen>
1026 private event EventHandler<TouchEventArgs> _stageTouchHandler;
1027 private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
1030 /// This event is emitted when the screen is touched and when the touch ends.<br />
1031 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
1032 /// then when the last finger is lifted.<br />
1033 /// An interrupted event will also be emitted (if it occurs).<br />
1035 /// <since_tizen> 4 </since_tizen>
1036 public event EventHandler<TouchEventArgs> TouchEvent
1042 _stageTouchHandler += value;
1043 _stageTouchCallbackDelegate = OnStageTouch;
1044 this.TouchSignal().Connect(_stageTouchCallbackDelegate);
1051 if (_stageTouchHandler != null)
1053 this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
1055 _stageTouchHandler -= value;
1060 private void OnStageTouch(IntPtr data)
1062 TouchEventArgs e = new TouchEventArgs();
1066 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
1069 if (_stageTouchHandler != null)
1071 _stageTouchHandler(this, e);
1076 /// Wheel event arguments.
1078 public class WheelEventArgs : EventArgs
1080 private Wheel _wheel;
1085 /// <since_tizen> 3 </since_tizen>
1099 private event EventHandler<WheelEventArgs> _stageWheelHandler;
1100 private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
1103 /// This event is emitted when the wheel event is received.
1105 /// <since_tizen> 4 </since_tizen>
1106 public event EventHandler<WheelEventArgs> WheelEvent
1110 if (_stageWheelHandler == null)
1112 _stageWheelCallbackDelegate = OnStageWheel;
1113 WheelEventSignal().Connect(_stageWheelCallbackDelegate);
1115 _stageWheelHandler += value;
1119 _stageWheelHandler -= value;
1120 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
1122 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
1127 private void OnStageWheel(IntPtr data)
1129 WheelEventArgs e = new WheelEventArgs();
1133 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
1136 if (_stageWheelHandler != null)
1138 _stageWheelHandler(this, e);
1143 /// Key event arguments.
1145 public class KeyEventArgs : EventArgs
1152 /// <since_tizen> 3 </since_tizen>
1166 private event EventHandler<KeyEventArgs> _stageKeyHandler;
1167 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1170 /// This event is emitted when the key event is received.
1172 /// <since_tizen> 4 </since_tizen>
1173 public event EventHandler<KeyEventArgs> KeyEvent
1177 if (_stageKeyHandler == null)
1179 _stageKeyCallbackDelegate = OnStageKey;
1180 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1182 _stageKeyHandler += value;
1186 _stageKeyHandler -= value;
1187 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1189 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1194 // Callback for Stage KeyEventsignal
1195 private void OnStageKey(IntPtr data)
1197 KeyEventArgs e = new KeyEventArgs();
1201 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1204 if (_stageKeyHandler != null)
1206 //here we send all data to user event handlers
1207 _stageKeyHandler(this, e);
1212 private event EventHandler _stageEventProcessingFinishedEventHandler;
1213 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1215 internal event EventHandler EventProcessingFinished
1219 if (_stageEventProcessingFinishedEventHandler == null)
1221 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1222 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1224 _stageEventProcessingFinishedEventHandler += value;
1229 _stageEventProcessingFinishedEventHandler -= value;
1230 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1232 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1237 // Callback for Stage EventProcessingFinishedSignal
1238 private void OnEventProcessingFinished()
1240 if (_stageEventProcessingFinishedEventHandler != null)
1242 _stageEventProcessingFinishedEventHandler(this, null);
1247 private EventHandler _stageContextLostEventHandler;
1248 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1250 internal event EventHandler ContextLost
1254 if (_stageContextLostEventHandler == null)
1256 _stageContextLostEventCallbackDelegate = OnContextLost;
1257 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1259 _stageContextLostEventHandler += value;
1263 _stageContextLostEventHandler -= value;
1264 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1266 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1271 // Callback for Stage ContextLostSignal
1272 private void OnContextLost()
1274 if (_stageContextLostEventHandler != null)
1276 _stageContextLostEventHandler(this, null);
1281 private EventHandler _stageContextRegainedEventHandler;
1282 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1284 internal event EventHandler ContextRegained
1288 if (_stageContextRegainedEventHandler == null)
1290 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1291 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1293 _stageContextRegainedEventHandler += value;
1297 _stageContextRegainedEventHandler -= value;
1298 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1300 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1305 // Callback for Stage ContextRegainedSignal
1306 private void OnContextRegained()
1308 if (_stageContextRegainedEventHandler != null)
1310 _stageContextRegainedEventHandler(this, null);
1315 private EventHandler _stageSceneCreatedEventHandler;
1316 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1318 internal event EventHandler SceneCreated
1322 if (_stageSceneCreatedEventHandler == null)
1324 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1325 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1327 _stageSceneCreatedEventHandler += value;
1331 _stageSceneCreatedEventHandler -= value;
1332 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1334 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1339 // Callback for Stage SceneCreatedSignal
1340 private void OnSceneCreated()
1342 if (_stageSceneCreatedEventHandler != null)
1344 _stageSceneCreatedEventHandler(this, null);
1349 /// This resized event arguments.
1351 /// <since_tizen> 4 </since_tizen>
1352 public class ResizedEventArgs : EventArgs
1357 /// This window size.
1359 /// <since_tizen> 4 </since_tizen>
1360 public Size2D WindowSize
1368 _windowSize = value;
1373 private WindowResizedEventCallbackType _windowResizedEventCallback;
1374 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1375 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1376 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1379 /// This event is emitted when the window resized.
1381 /// <since_tizen> 4 </since_tizen>
1382 public event EventHandler<ResizedEventArgs> Resized
1386 if (_windowResizedEventHandler == null)
1388 _windowResizedEventCallback = OnResized;
1389 ResizedSignal().Connect(_windowResizedEventCallback);
1392 _windowResizedEventHandler += value;
1396 _windowResizedEventHandler -= value;
1398 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1400 ResizedSignal().Disconnect(_windowResizedEventCallback);
1405 private void OnResized(IntPtr windowSize)
1407 ResizedEventArgs e = new ResizedEventArgs();
1408 var val = new Uint16Pair(windowSize, false);
1409 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1412 if (_windowResizedEventHandler != null)
1414 _windowResizedEventHandler(this, e);
1418 internal void SetWindowSize(Size2D size)
1420 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1421 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1423 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1426 internal Size2D GetWindowSize()
1428 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1429 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1431 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1435 internal void SetPosition(Position2D position)
1437 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1438 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1440 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1443 internal Position2D GetPosition()
1445 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1446 Position2D ret = new Position2D(val.GetX(), val.GetY());
1448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1453 /// The window size property (read-only).
1455 /// <since_tizen> 3 </since_tizen>
1460 Size2D ret = GetSize();
1466 /// The background color property.
1468 /// <since_tizen> 3 </since_tizen>
1469 public Color BackgroundColor
1473 SetBackgroundColor(value);
1477 Color ret = GetBackgroundColor();
1483 /// The DPI property (read-only).<br />
1484 /// Retrieves the DPI of the display device to which the Window is connected.<br />
1486 /// <since_tizen> 3 </since_tizen>
1496 /// The layer count property (read-only).<br />
1497 /// Queries the number of on-Window layers.<br />
1499 /// <since_tizen> 3 </since_tizen>
1500 public uint LayerCount
1504 return GetLayerCount();
1510 /// Adds a layer to the stage.
1512 /// <param name="layer">Layer to add.</param>
1513 /// <since_tizen> 3 </since_tizen>
1514 public void AddLayer(Layer layer)
1516 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1517 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1521 /// Removes a layer from the stage.
1523 /// <param name="layer">Layer to remove.</param>
1524 /// <since_tizen> 4 </since_tizen>
1525 public void RemoveLayer(Layer layer)
1527 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1528 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1532 /// Please do not use! this will be deprecated
1534 /// <since_tizen> 3 </since_tizen>
1535 [EditorBrowsable(EditorBrowsableState.Never)]
1536 public class WindowFocusChangedEventArgs : EventArgs
1539 /// Please do not use! this will be deprecated
1541 /// <since_tizen> 3 </since_tizen>
1542 public bool FocusGained
1549 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1550 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1551 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1552 private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1555 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1557 /// <since_tizen> 3 </since_tizen>
1558 [Obsolete("Please do not use! this will be deprecated. Please use 'FocusChanged' event instead")]
1559 public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1563 if (_windowFocusChangedEventHandler2 == null)
1565 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1566 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1569 _windowFocusChangedEventHandler2 += value;
1573 _windowFocusChangedEventHandler2 -= value;
1575 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1577 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1582 private void OnWindowFocusedChanged2(bool focusGained)
1584 WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1586 e.FocusGained = focusGained;
1588 if (_windowFocusChangedEventHandler2 != null)
1590 _windowFocusChangedEventHandler2(this, e);
1595 /// Gets or sets a size of the window.
1597 /// <since_tizen> 4 </since_tizen>
1598 public Size2D WindowSize
1602 return GetWindowSize();
1606 SetWindowSize(value);
1611 /// Gets or sets a position of the window.
1613 /// <since_tizen> 4 </since_tizen>
1614 public Position2D WindowPosition
1618 return GetPosition();
1627 /// Feed a key-event into the window.
1629 /// <since_tizen> 4 </since_tizen>
1630 public static void FeedKeyEvent(Key keyEvent)
1632 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1633 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1637 /// Allows at least one more render, even when paused.
1638 /// The window should be shown, not minimised.
1640 /// <since_tizen> 4 </since_tizen>
1641 public void RenderOnce()
1643 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1644 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1648 /// Contains and encapsulates Native Window handle.
1650 /// <since_tizen> 4 </since_tizen>
1651 public class SafeNativeWindowHandle : SafeHandle
1654 /// Contructor, Native window handle is set to handle.
1656 /// <since_tizen> 4 </since_tizen>
1657 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1659 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1662 /// Null check if the handle is valid or not.
1664 /// <since_tizen> 4 </since_tizen>
1665 public override bool IsInvalid
1669 return this.handle == IntPtr.Zero;
1673 /// Release handle itself.
1675 /// <returns>true when released successfully.</returns>
1676 /// <since_tizen> 4 </since_tizen>
1677 protected override bool ReleaseHandle()