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;
25 /// The window class is used internally for drawing.<br />
26 /// The window has an orientation and indicator properties.<br />
28 public class Window : BaseHandle
30 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
31 private global::System.Runtime.InteropServices.HandleRef stageCPtr;
32 private Layer _rootLayer;
33 private string _windowTitle;
35 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
37 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
38 if (NDalicPINVOKE.Stage_IsInstalled())
40 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
44 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
46 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
50 /// To make the window instance be disposed.
52 /// Please DO NOT use! This will be deprecated!
53 /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, IMFManager, TtsPlayer, Window) is not required.
54 /// Because it is Sigletone, so it is alive for one thread until the NUI is terminated, so it never be disposed.
55 [Obsolete("Please DO NOT use! This will be Deprecated!")]
56 [EditorBrowsable(EditorBrowsableState.Never)]
57 protected override void Dispose(DisposeTypes type)
64 if (type == DisposeTypes.Explicit)
67 //Release your own managed resources here.
68 //You should release all of your own disposable objects here.
71 //Release your own unmanaged resources here.
72 //You should not access any managed member here except static instance.
73 //because the execution order of Finalizes is non-deterministic.
75 if (_windowFocusChangedEventCallback != null)
77 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
80 if (_stageTouchCallbackDelegate != null)
82 TouchSignal().Disconnect(_stageTouchCallbackDelegate);
85 if (_stageWheelCallbackDelegate != null)
87 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
90 if (_stageKeyCallbackDelegate != null)
92 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
95 if (_stageEventProcessingFinishedEventCallbackDelegate != null)
97 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
100 if (_stageContextLostEventCallbackDelegate != null)
102 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
105 if (_stageContextRegainedEventCallbackDelegate != null)
107 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
110 if (_stageSceneCreatedEventCallbackDelegate != null)
112 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
115 if (_windowResizedEventCallback != null)
117 ResizedSignal().Disconnect(_windowResizedEventCallback);
120 if (_windowFocusChangedEventCallback2 != null)
122 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
125 if (swigCPtr.Handle != global::System.IntPtr.Zero)
130 NDalicPINVOKE.delete_Window(swigCPtr);
131 NDalicPINVOKE.delete_Stage(stageCPtr);
133 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
139 internal static Window GetCurrent()
141 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
142 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146 internal static bool IsInstalled()
148 bool ret = NDalicPINVOKE.Stage_IsInstalled();
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 /// Sets whether the window accepts a focus or not.
156 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
157 /// <since_tizen> 3 </since_tizen>
158 public void SetAcceptFocus(bool accept)
160 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165 /// Returns whether the window accepts a focus or not.
167 /// <returns>True if the window accepts a focus, false otherwise.</returns>
168 /// <since_tizen> 3 </since_tizen>
169 public bool IsFocusAcceptable()
171 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178 /// Shows the window if it is hidden.
180 /// <since_tizen> 3 </since_tizen>
183 NDalicPINVOKE.Show(swigCPtr);
184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188 /// Hides the window if it is showing.
190 /// <since_tizen> 3 </since_tizen>
193 NDalicPINVOKE.Hide(swigCPtr);
194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198 /// Retrieves whether the window is visible or not.
200 /// <returns>True if the window is visible.</returns>
201 /// <since_tizen> 3 </since_tizen>
202 public bool IsVisible()
204 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210 /// Gets the count of supported auxiliary hints of the window.
212 /// <returns>The number of supported auxiliary hints.</returns>
213 /// <since_tizen> 3 </since_tizen>
214 public uint GetSupportedAuxiliaryHintCount()
216 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222 /// Gets the supported auxiliary hint string of the window.
224 /// <param name="index">The index of the supported auxiliary hint lists.</param>
225 /// <returns>The auxiliary hint string of the index.</returns>
226 /// <since_tizen> 3 </since_tizen>
227 public string GetSupportedAuxiliaryHint(uint index)
229 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 /// Creates an auxiliary hint of the window.
237 /// <param name="hint">The auxiliary hint string.</param>
238 /// <param name="value">The value string.</param>
239 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
240 /// <since_tizen> 3 </since_tizen>
241 public uint AddAuxiliaryHint(string hint, string value)
243 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249 /// Removes an auxiliary hint of the window.
251 /// <param name="id">The ID of the auxiliary hint.</param>
252 /// <returns>True if no error occurred, false otherwise.</returns>
253 /// <since_tizen> 3 </since_tizen>
254 public bool RemoveAuxiliaryHint(uint id)
256 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262 /// Changes a value of the auxiliary hint.
264 /// <param name="id">The auxiliary hint ID.</param>
265 /// <param name="value">The value string to be set.</param>
266 /// <returns>True if no error occurred, false otherwise.</returns>
267 /// <since_tizen> 3 </since_tizen>
268 public bool SetAuxiliaryHintValue(uint id, string value)
270 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276 /// Gets a value of the auxiliary hint.
278 /// <param name="id">The auxiliary hint ID.</param>
279 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
280 /// <since_tizen> 3 </since_tizen>
281 public string GetAuxiliaryHintValue(uint id)
283 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289 /// Gets an ID of the auxiliary hint string.
291 /// <param name="hint">The auxiliary hint string.</param>
292 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
293 /// <since_tizen> 3 </since_tizen>
294 public uint GetAuxiliaryHintId(string hint)
296 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
297 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
302 /// Sets a region to accept input events.
304 /// <param name="inputRegion">The region to accept input events.</param>
305 /// <since_tizen> 3 </since_tizen>
306 public void SetInputRegion(Rectangle inputRegion)
308 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313 /// Gets or sets a window type.
315 /// <since_tizen> 3 </since_tizen>
316 public WindowType Type
320 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
321 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326 NDalicPINVOKE.SetType(swigCPtr, (int)value);
327 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332 /// Sets a priority level for the specified notification window.
334 /// <param name="level">The notification window level.</param>
335 /// <returns>True if no error occurred, false otherwise.</returns>
336 /// <since_tizen> 3 </since_tizen>
337 public bool SetNotificationLevel(NotificationLevel level)
339 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
340 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
345 /// Gets a priority level for the specified notification window.
347 /// <returns>The notification window level.</returns>
348 /// <since_tizen> 3 </since_tizen>
349 public NotificationLevel GetNotificationLevel()
351 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
357 /// Sets a transparent window's visual state to opaque.
359 /// <param name="opaque">Whether the window's visual state is opaque.</param>
360 /// <since_tizen> 3 </since_tizen>
361 public void SetOpaqueState(bool opaque)
363 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
364 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368 /// Returns whether a transparent window's visual state is opaque or not.
370 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
371 /// <since_tizen> 3 </since_tizen>
372 public bool IsOpaqueState()
374 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
380 /// Sets a window's screen off mode.
382 /// <param name="screenOffMode">The screen mode.</param>
383 /// <returns>True if no error occurred, false otherwise.</returns>
384 /// <since_tizen> 3 </since_tizen>
385 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
387 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393 /// Gets the screen mode of the window.
395 /// <returns>The screen off mode.</returns>
396 /// <since_tizen> 3 </since_tizen>
397 public ScreenOffMode GetScreenOffMode()
399 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 /// Sets preferred brightness of the window.
407 /// <param name="brightness">The preferred brightness (0 to 100).</param>
408 /// <returns>True if no error occurred, false otherwise.</returns>
409 /// <since_tizen> 3 </since_tizen>
410 public bool SetBrightness(int brightness)
412 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
413 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
418 /// Gets the preferred brightness of the window.
420 /// <returns>The preferred brightness.</returns>
421 /// <since_tizen> 3 </since_tizen>
422 public int GetBrightness()
424 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
430 /// The focus changed event argument.
432 public class FocusChangedEventArgs : EventArgs
435 /// FocusGained flag.
437 /// <since_tizen> 3 </since_tizen>
438 public bool FocusGained
445 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
446 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
447 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
448 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
451 /// FocusChanged event.
453 /// <since_tizen> 4 </since_tizen>
454 public event EventHandler<FocusChangedEventArgs> FocusChanged
458 if (_windowFocusChangedEventHandler == null)
460 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
461 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
464 _windowFocusChangedEventHandler += value;
468 _windowFocusChangedEventHandler -= value;
470 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
472 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
477 private void OnWindowFocusedChanged(bool focusGained)
479 FocusChangedEventArgs e = new FocusChangedEventArgs();
481 e.FocusGained = focusGained;
483 if (_windowFocusChangedEventHandler != null)
485 _windowFocusChangedEventHandler(this, e);
490 /// Gets/Sets a window title.
492 /// <since_tizen> 4 </since_tizen>
501 _windowTitle = value;
502 SetClass(_windowTitle, "");
506 internal WindowFocusSignalType WindowFocusChangedSignal()
508 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
509 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
513 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
515 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
518 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
520 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
523 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
525 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
528 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
530 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
535 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
536 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
539 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
541 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
542 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
545 internal void RotateIndicator(Window.WindowOrientation orientation)
547 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
548 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
552 /// Sets the window name and the class string.
554 /// <param name="name">The name of the window.</param>
555 /// <param name="klass">The class of the window.</param>
556 /// <since_tizen> 4 </since_tizen>
557 public void SetClass(string name, string klass)
559 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
560 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
564 /// Raises the window to the top of the window stack.
566 /// <since_tizen> 3 </since_tizen>
569 NDalicPINVOKE.Window_Raise(swigCPtr);
570 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
574 /// Lowers the window to the bottom of the window stack.
576 /// <since_tizen> 3 </since_tizen>
579 NDalicPINVOKE.Window_Lower(swigCPtr);
580 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
584 /// Activates the window to the top of the window stack even it is iconified.
586 /// <since_tizen> 3 </since_tizen>
587 public void Activate()
589 NDalicPINVOKE.Window_Activate(swigCPtr);
590 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
593 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
595 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
596 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
599 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
601 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
602 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
605 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
607 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
608 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
611 internal Window.WindowOrientation GetPreferredOrientation()
613 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
614 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
618 internal DragAndDropDetector GetDragAndDropDetector()
620 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
621 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
625 internal Any GetNativeHandle()
627 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
628 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
632 internal WindowFocusSignalType FocusChangedSignal()
634 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
635 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
640 /// Gets the default ( root ) layer.
642 /// <returns>The root layer.</returns>
643 /// <since_tizen> 3 </since_tizen>
644 public Layer GetDefaultLayer()
646 return this.GetRootLayer();
649 internal void Add(Layer layer)
651 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
652 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
655 internal void Remove(Layer layer)
657 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
658 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
662 /// Add a child view to window.
664 /// <param name="view">the child should be added to the window.</param>
665 /// <since_tizen> 3 </since_tizen>
666 public void Add(View view)
668 GetRootLayer()?.Add(view);
672 /// Remove a child view from window.
674 /// <param name="view">the child to be removed.</param>
675 /// <since_tizen> 3 </since_tizen>
676 public void Remove(View view)
678 GetRootLayer()?.Remove(view);
681 internal Vector2 GetSize()
683 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
684 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688 internal RenderTaskList GetRenderTaskList()
690 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
691 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
696 /// Queries the number of on-window layers.
698 /// <returns>The number of layers.</returns>
699 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
700 internal uint GetLayerCount()
702 uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr);
703 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
708 /// Retrieves the layer at a specified depth.
710 /// <param name="depth">The layer's depth index.</param>
711 /// <returns>The layer found at the given depth.</returns>
712 /// <since_tizen> 3 </since_tizen>
713 public Layer GetLayer(uint depth)
715 IntPtr cPtr = NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth);
716 Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer;
718 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
722 internal Layer GetRootLayer()
724 // Window.IsInstalled() is actually true only when called from event thread and
725 // Core has been initialized, not when Stage is ready.
726 if (_rootLayer == null && Window.IsInstalled())
728 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
729 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
734 internal void SetBackgroundColor(Vector4 color)
736 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
737 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740 internal Vector4 GetBackgroundColor()
742 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
743 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747 internal Vector2 GetDpi()
749 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
750 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
754 internal ObjectRegistry GetObjectRegistry()
756 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
757 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
762 /// Keep rendering for at least the given amount of time.
764 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
765 /// <since_tizen> 3 </since_tizen>
766 public void KeepRendering(float durationSeconds)
768 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
769 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
772 internal KeyEventSignal KeyEventSignal()
774 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
779 internal VoidSignal EventProcessingFinishedSignal()
781 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
782 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
786 internal TouchSignal TouchSignal()
788 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
789 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
793 private StageWheelSignal WheelEventSignal()
795 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
796 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
800 internal VoidSignal ContextLostSignal()
802 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
803 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
807 internal VoidSignal ContextRegainedSignal()
809 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
810 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
814 internal VoidSignal SceneCreatedSignal()
816 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
817 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
821 internal ResizedSignal ResizedSignal()
823 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
824 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
828 internal static Vector4 DEFAULT_BACKGROUND_COLOR
832 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
833 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
834 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
839 internal static Vector4 DEBUG_BACKGROUND_COLOR
843 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
844 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
845 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
850 private static readonly Window instance = Application.Instance.GetWindow();
853 /// The stage instance property (read-only).<br />
854 /// Gets the current window.<br />
856 /// <since_tizen> 3 </since_tizen>
857 public static Window Instance
866 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
867 /// This function can be used for following example scenarios: <br />
868 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
870 /// <param name="DaliKey">The key code to grab.</param>
871 /// <returns>True if the grab succeeds.</returns>
872 /// <since_tizen> 3 </since_tizen>
873 public bool GrabKeyTopmost(int DaliKey)
875 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
876 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
881 /// Ungrabs the key specified by a key for the window.<br />
882 /// 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 />
884 /// <param name="DaliKey">The key code to ungrab.</param>
885 /// <returns>True if the ungrab succeeds.</returns>
886 /// <since_tizen> 3 </since_tizen>
887 public bool UngrabKeyTopmost(int DaliKey)
889 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
890 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
895 /// Grabs the key specified by a key for a window in a GrabMode. <br />
896 /// Details: This function can be used for following example scenarios: <br />
897 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
898 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
899 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
901 /// <param name="DaliKey">The key code to grab.</param>
902 /// <param name="GrabMode">The grab mode for the key.</param>
903 /// <returns>True if the grab succeeds.</returns>
904 /// <since_tizen> 3 </since_tizen>
905 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
907 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
908 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
913 /// Ungrabs the key specified by a key for a window.<br />
914 /// 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 />
916 /// <param name="DaliKey">The key code to ungrab.</param>
917 /// <returns>True if the ungrab succeeds.</returns>
918 /// <since_tizen> 3 </since_tizen>
919 public bool UngrabKey(int DaliKey)
921 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
922 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
926 internal System.IntPtr GetNativeWindowHandler()
928 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
929 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
934 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
936 /// <since_tizen> 3 </since_tizen>
937 public enum WindowOrientation
940 /// Portrait orientation. The height of the display area is greater than the width.
942 /// <since_tizen> 3 </since_tizen>
945 /// Landscape orientation. A wide view area is needed.
947 /// <since_tizen> 3 </since_tizen>
950 /// Portrait inverse orientation.
952 /// <since_tizen> 3 </since_tizen>
953 PortraitInverse = 180,
955 /// Landscape inverse orientation.
957 /// <since_tizen> 3 </since_tizen>
958 LandscapeInverse = 270
962 /// Enumeration for the key grab mode for platform-level APIs.
964 /// <since_tizen> 3 </since_tizen>
965 public enum KeyGrabMode
968 /// Grabs a key only when on the top of the grabbing-window stack mode.
972 /// Grabs a key together with the other client window(s) mode.
976 /// 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.
980 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
986 /// Enumeration for opacity of the indicator.
988 internal enum IndicatorBackgroundOpacity
996 /// Enumeration for visible mode of the indicator.
998 internal enum IndicatorVisibleMode
1006 /// The touch event argument.
1008 public class TouchEventArgs : EventArgs
1010 private Touch _touch;
1015 /// <since_tizen> 3 </since_tizen>
1029 private event EventHandler<TouchEventArgs> _stageTouchHandler;
1030 private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
1033 /// This event is emitted when the screen is touched and when the touch ends.<br />
1034 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
1035 /// then when the last finger is lifted.<br />
1036 /// An interrupted event will also be emitted (if it occurs).<br />
1038 /// <since_tizen> 4 </since_tizen>
1039 public event EventHandler<TouchEventArgs> TouchEvent
1045 _stageTouchHandler += value;
1046 _stageTouchCallbackDelegate = OnStageTouch;
1047 this.TouchSignal().Connect(_stageTouchCallbackDelegate);
1054 if (_stageTouchHandler != null)
1056 this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
1058 _stageTouchHandler -= value;
1063 private void OnStageTouch(IntPtr data)
1065 TouchEventArgs e = new TouchEventArgs();
1069 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
1072 if (_stageTouchHandler != null)
1074 _stageTouchHandler(this, e);
1079 /// Wheel event arguments.
1081 public class WheelEventArgs : EventArgs
1083 private Wheel _wheel;
1088 /// <since_tizen> 3 </since_tizen>
1102 private event EventHandler<WheelEventArgs> _stageWheelHandler;
1103 private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
1106 /// This event is emitted when the wheel event is received.
1108 /// <since_tizen> 4 </since_tizen>
1109 public event EventHandler<WheelEventArgs> WheelEvent
1113 if (_stageWheelHandler == null)
1115 _stageWheelCallbackDelegate = OnStageWheel;
1116 WheelEventSignal().Connect(_stageWheelCallbackDelegate);
1118 _stageWheelHandler += value;
1122 _stageWheelHandler -= value;
1123 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
1125 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
1130 private void OnStageWheel(IntPtr data)
1132 WheelEventArgs e = new WheelEventArgs();
1136 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
1139 if (_stageWheelHandler != null)
1141 _stageWheelHandler(this, e);
1146 /// Key event arguments.
1148 public class KeyEventArgs : EventArgs
1155 /// <since_tizen> 3 </since_tizen>
1169 private event EventHandler<KeyEventArgs> _stageKeyHandler;
1170 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1173 /// This event is emitted when the key event is received.
1175 /// <since_tizen> 4 </since_tizen>
1176 public event EventHandler<KeyEventArgs> KeyEvent
1180 if (_stageKeyHandler == null)
1182 _stageKeyCallbackDelegate = OnStageKey;
1183 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1185 _stageKeyHandler += value;
1189 _stageKeyHandler -= value;
1190 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1192 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1197 // Callback for Stage KeyEventsignal
1198 private void OnStageKey(IntPtr data)
1200 KeyEventArgs e = new KeyEventArgs();
1204 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1207 if (_stageKeyHandler != null)
1209 //here we send all data to user event handlers
1210 _stageKeyHandler(this, e);
1215 private event EventHandler _stageEventProcessingFinishedEventHandler;
1216 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1218 internal event EventHandler EventProcessingFinished
1222 if (_stageEventProcessingFinishedEventHandler == null)
1224 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1225 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1227 _stageEventProcessingFinishedEventHandler += value;
1232 _stageEventProcessingFinishedEventHandler -= value;
1233 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1235 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1240 // Callback for Stage EventProcessingFinishedSignal
1241 private void OnEventProcessingFinished()
1243 if (_stageEventProcessingFinishedEventHandler != null)
1245 _stageEventProcessingFinishedEventHandler(this, null);
1250 private EventHandler _stageContextLostEventHandler;
1251 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1253 internal event EventHandler ContextLost
1257 if (_stageContextLostEventHandler == null)
1259 _stageContextLostEventCallbackDelegate = OnContextLost;
1260 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1262 _stageContextLostEventHandler += value;
1266 _stageContextLostEventHandler -= value;
1267 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1269 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1274 // Callback for Stage ContextLostSignal
1275 private void OnContextLost()
1277 if (_stageContextLostEventHandler != null)
1279 _stageContextLostEventHandler(this, null);
1284 private EventHandler _stageContextRegainedEventHandler;
1285 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1287 internal event EventHandler ContextRegained
1291 if (_stageContextRegainedEventHandler == null)
1293 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1294 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1296 _stageContextRegainedEventHandler += value;
1300 _stageContextRegainedEventHandler -= value;
1301 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1303 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1308 // Callback for Stage ContextRegainedSignal
1309 private void OnContextRegained()
1311 if (_stageContextRegainedEventHandler != null)
1313 _stageContextRegainedEventHandler(this, null);
1318 private EventHandler _stageSceneCreatedEventHandler;
1319 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1321 internal event EventHandler SceneCreated
1325 if (_stageSceneCreatedEventHandler == null)
1327 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1328 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1330 _stageSceneCreatedEventHandler += value;
1334 _stageSceneCreatedEventHandler -= value;
1335 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1337 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1342 // Callback for Stage SceneCreatedSignal
1343 private void OnSceneCreated()
1345 if (_stageSceneCreatedEventHandler != null)
1347 _stageSceneCreatedEventHandler(this, null);
1352 /// This resized event arguments.
1354 /// <since_tizen> 4 </since_tizen>
1355 public class ResizedEventArgs : EventArgs
1360 /// This window size.
1362 /// <since_tizen> 4 </since_tizen>
1363 public Size2D WindowSize
1371 _windowSize = value;
1376 private WindowResizedEventCallbackType _windowResizedEventCallback;
1377 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1378 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1379 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1382 /// This event is emitted when the window resized.
1384 /// <since_tizen> 4 </since_tizen>
1385 public event EventHandler<ResizedEventArgs> Resized
1389 if (_windowResizedEventHandler == null)
1391 _windowResizedEventCallback = OnResized;
1392 ResizedSignal().Connect(_windowResizedEventCallback);
1395 _windowResizedEventHandler += value;
1399 _windowResizedEventHandler -= value;
1401 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1403 ResizedSignal().Disconnect(_windowResizedEventCallback);
1408 private void OnResized(IntPtr windowSize)
1410 ResizedEventArgs e = new ResizedEventArgs();
1411 var val = new Uint16Pair(windowSize, false);
1412 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1415 if (_windowResizedEventHandler != null)
1417 _windowResizedEventHandler(this, e);
1421 internal void SetWindowSize(Size2D size)
1423 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1424 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1426 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1429 internal Size2D GetWindowSize()
1431 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1432 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1434 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1438 internal void SetPosition(Position2D position)
1440 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1441 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1443 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1446 internal Position2D GetPosition()
1448 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1449 Position2D ret = new Position2D(val.GetX(), val.GetY());
1451 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1456 /// The window size property (read-only).
1458 /// <since_tizen> 3 </since_tizen>
1463 Size2D ret = GetSize();
1469 /// The background color property.
1471 /// <since_tizen> 3 </since_tizen>
1472 public Color BackgroundColor
1476 SetBackgroundColor(value);
1480 Color ret = GetBackgroundColor();
1486 /// The DPI property (read-only).<br />
1487 /// Retrieves the DPI of the display device to which the Window is connected.<br />
1489 /// <since_tizen> 3 </since_tizen>
1499 /// The layer count property (read-only).<br />
1500 /// Queries the number of on-Window layers.<br />
1502 /// <since_tizen> 3 </since_tizen>
1503 public uint LayerCount
1507 return GetLayerCount();
1513 /// Adds a layer to the stage.
1515 /// <param name="layer">Layer to add.</param>
1516 /// <since_tizen> 3 </since_tizen>
1517 public void AddLayer(Layer layer)
1519 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1520 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1524 /// Removes a layer from the stage.
1526 /// <param name="layer">Layer to remove.</param>
1527 /// <since_tizen> 4 </since_tizen>
1528 public void RemoveLayer(Layer layer)
1530 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1531 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1535 /// Please do not use! this will be deprecated
1537 /// <since_tizen> 3 </since_tizen>
1538 [EditorBrowsable(EditorBrowsableState.Never)]
1539 public class WindowFocusChangedEventArgs : EventArgs
1542 /// Please do not use! this will be deprecated
1544 /// <since_tizen> 3 </since_tizen>
1545 public bool FocusGained
1552 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1553 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1554 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1555 private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1558 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1560 /// <since_tizen> 3 </since_tizen>
1561 /// Please do not use! this will be deprecated!
1562 /// Instead please use FocusChanged.
1563 [Obsolete("Please do not use! this will be deprecated, instead please use FocusChanged")]
1564 [EditorBrowsable(EditorBrowsableState.Never)]
1565 public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1569 if (_windowFocusChangedEventHandler2 == null)
1571 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1572 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1575 _windowFocusChangedEventHandler2 += value;
1579 _windowFocusChangedEventHandler2 -= value;
1581 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1583 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1588 private void OnWindowFocusedChanged2(bool focusGained)
1590 WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1592 e.FocusGained = focusGained;
1594 if (_windowFocusChangedEventHandler2 != null)
1596 _windowFocusChangedEventHandler2(this, e);
1601 /// Gets or sets a size of the window.
1603 /// <since_tizen> 4 </since_tizen>
1604 public Size2D WindowSize
1608 return GetWindowSize();
1612 SetWindowSize(value);
1617 /// Gets or sets a position of the window.
1619 /// <since_tizen> 4 </since_tizen>
1620 public Position2D WindowPosition
1624 return GetPosition();
1633 /// Feed a key-event into the window.
1635 /// <since_tizen> 4 </since_tizen>
1636 public static void FeedKeyEvent(Key keyEvent)
1638 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1639 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1643 /// Allows at least one more render, even when paused.
1644 /// The window should be shown, not minimised.
1646 /// <since_tizen> 4 </since_tizen>
1647 public void RenderOnce()
1649 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1650 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1654 /// Contains and encapsulates Native Window handle.
1656 /// <since_tizen> 4 </since_tizen>
1657 public class SafeNativeWindowHandle : SafeHandle
1660 /// Contructor, Native window handle is set to handle.
1662 /// <since_tizen> 4 </since_tizen>
1663 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1665 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1668 /// Null check if the handle is valid or not.
1670 /// <since_tizen> 4 </since_tizen>
1671 public override bool IsInvalid
1675 return this.handle == IntPtr.Zero;
1679 /// Release handle itself.
1681 /// <returns>true when released successfully.</returns>
1682 /// <since_tizen> 4 </since_tizen>
1683 protected override bool ReleaseHandle()