fc154de18015b86df8edc36da2375af4f9dfa922
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Tizen.NUI
28 {
29
30     using System;
31     using System.Runtime.InteropServices;
32     using Tizen.NUI.BaseComponents;
33
34     /// <summary>
35     /// The window class is used internally for drawing.<br>
36     /// A Window has an orientation and indicator properties.<br>
37     /// </summary>
38     public class Window : BaseHandle
39     {
40         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
41         private global::System.Runtime.InteropServices.HandleRef stageCPtr;
42
43         internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
44         {
45             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
46             stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
47         }
48
49         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
50         {
51             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
52         }
53
54         /// <summary>
55         /// To make Window instance be disposed.
56         /// </summary>
57         public override void Dispose()
58         {
59             if (!Window.IsInstalled())
60             {
61                 DisposeQueue.Instance.Add(this);
62                 return;
63             }
64
65             lock (this)
66             {
67                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
68                 {
69                     if (swigCMemOwn)
70                     {
71                         swigCMemOwn = false;
72                         NDalicPINVOKE.delete_Window(swigCPtr);
73                         NDalicPINVOKE.delete_Stage(stageCPtr);
74                     }
75                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
76                 }
77                 global::System.GC.SuppressFinalize(this);
78                 base.Dispose();
79             }
80         }
81
82         internal static Window GetCurrent()
83         {
84             Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
85             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86             return ret;
87         }
88
89        internal static bool IsInstalled()
90        {
91             bool ret = NDalicPINVOKE.Stage_IsInstalled();
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93             return ret;
94        }
95
96         /// <summary>
97         /// Sets the focus acceptable flag of an window as true.
98         /// </summary>
99         public void SetAcceptFocus(bool accept)
100         {
101             NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
102             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103         }
104
105         /// <summary>
106         /// Retrieves whether the window is focus acceptable or not.
107         /// </summary>
108         public bool IsFocusAcceptable()
109         {
110             return NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
111             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112         }
113
114         /// <summary>
115         /// Shows the window if it is hidden.
116         /// </summary>
117         public void Show()
118         {
119             NDalicPINVOKE.Show(swigCPtr);
120             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121         }
122
123         /// <summary>
124         /// Hides the window if it is showing.
125         /// </summary>
126         public void Hide()
127         {
128             NDalicPINVOKE.Hide(swigCPtr);
129             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130         }
131
132         /// <summary>
133         /// Retrieves whether the window is visible or not.
134         /// </summary>
135         /// <returns>true, if the windoe is visible</returns>
136         public bool IsVisible()
137         {
138             bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
139             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140             return temp;
141         }
142
143         public class WindowFocusChangedEventArgs : EventArgs
144         {
145             public bool FocusGained
146             {
147                 get;
148                 set;
149             }
150         }
151
152         private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
153         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
154         private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
155         private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler;
156
157         public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
158         {
159             add
160             {
161                 if (_windowFocusChangedEventHandler == null)
162                 {
163                     _windowFocusChangedEventCallback = OnWindowFocusedChanged;
164                     WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
165                 }
166
167                 _windowFocusChangedEventHandler += value;
168             }
169             remove
170             {
171                 _windowFocusChangedEventHandler -= value;
172
173                 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
174                 {
175                     WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
176                 }
177             }
178         }
179
180         private void OnWindowFocusedChanged(bool focusGained)
181         {
182             WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
183
184             e.FocusGained = focusGained;
185
186             if (_windowFocusChangedEventHandler != null)
187             {
188                 _windowFocusChangedEventHandler(this, e);
189             }
190         }
191
192         internal WindowFocusSignalType WindowFocusChangedSignal()
193         {
194             WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
195             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196             return ret;
197         }
198
199
200
201         /// <summary>
202         /// Creates an initialized handle to a new Window.
203         /// </summary>
204         /// <param name="windowPosition">The position and size of the Window</param>
205         /// <param name="name">The Window title</param>
206         /// <param name="isTransparent">Whether Window is transparent</param>
207         public Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
208         {
209             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210
211         }
212
213         /// <summary>
214         /// Creates an initialized handle to a new Window.
215         /// </summary>
216         /// <param name="windowPosition">The position and size of the Window</param>
217         /// <param name="name">The Window title</param>
218         public Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
219         {
220             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221
222         }
223
224         /// <summary>
225         /// Creates an initialized handle to a new Window.
226         /// </summary>
227         /// <param name="windowPosition">The position and size of the Window</param>
228         /// <param name="name">The Window title</param>
229         /// <param name="className">The Window class name</param>
230         /// <param name="isTransparent">Whether Window is transparent</param>
231         public Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
232         {
233             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234
235         }
236
237         /// <summary>
238         /// Creates an initialized handle to a new Window.
239         /// </summary>
240         /// <param name="windowPosition">The position and size of the Window</param>
241         /// <param name="name">The Window title</param>
242         /// <param name="className">The Window class name</param>
243         public Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
244         {
245             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246
247         }
248         internal Window(Window handle) : this(NDalicPINVOKE.new_Window__SWIG_1(Window.getCPtr(handle)), true)
249         {
250             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251         }
252
253         internal Window Assign(Window rhs)
254         {
255             Window ret = new Window(NDalicPINVOKE.Window_Assign(swigCPtr, Window.getCPtr(rhs)), false);
256             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
257             return ret;
258         }
259
260         /// <summary>
261         /// This sets whether the indicator bar should be shown or not.
262         /// </summary>
263         /// <param name="visibleMode">Visible mode for indicator bar, Visible in default</param>
264         internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
265         {
266             NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
267             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268         }
269
270         /// <summary>
271         /// This sets the opacity mode of indicator bar.
272         /// </summary>
273         /// <param name="opacity">The opacity mode</param>
274         internal void SetIndicatorBgOpacity(Window.IndicatorBgOpacity opacity)
275         {
276             NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
277             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
278         }
279
280         /// <summary>
281         /// This sets the orientation of indicator bar.<br>
282         /// It does not implicitly show the indicator if it is currently hidden.<br>
283         /// </summary>
284         /// <param name="orientation">The orientation</param>
285         internal void RotateIndicator(Window.WindowOrientation orientation)
286         {
287             NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
288             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289         }
290
291         internal void SetClass(string name, string klass)
292         {
293             NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
294             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295         }
296
297         /// <summary>
298         /// Raises window to the top of Window stack.
299         /// </summary>
300         public void Raise()
301         {
302             NDalicPINVOKE.Window_Raise(swigCPtr);
303             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304         }
305
306         /// <summary>
307         /// Lowers window to the bottom of Window stack.
308         /// </summary>
309         public void Lower()
310         {
311             NDalicPINVOKE.Window_Lower(swigCPtr);
312             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313         }
314
315         /// <summary>
316         /// Activates window to the top of Window stack even it is iconified.
317         /// </summary>
318         public void Activate()
319         {
320             NDalicPINVOKE.Window_Activate(swigCPtr);
321             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322         }
323
324         internal void AddAvailableOrientation(Window.WindowOrientation orientation)
325         {
326             NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
327             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328         }
329
330         internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
331         {
332             NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
333             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334         }
335
336         internal void SetPreferredOrientation(Window.WindowOrientation orientation)
337         {
338             NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
339             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340         }
341
342         internal Window.WindowOrientation GetPreferredOrientation()
343         {
344             Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
345             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
346             return ret;
347         }
348
349         internal DragAndDropDetector GetDragAndDropDetector()
350         {
351             DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
352             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
353             return ret;
354         }
355
356         internal Any GetNativeHandle()
357         {
358             Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
359             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
360             return ret;
361         }
362
363         internal WindowFocusSignalType FocusChangedSignal()
364         {
365             WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
366             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
367             return ret;
368         }
369
370         /// <summary>
371         /// Get default ( root ) layer.
372         /// </summary>
373         /// <returns>The root layer</returns>
374         public Layer GetDefaultLayer()
375         {
376             return this.GetRootLayer();
377         }
378
379         /// <summary>
380         /// Add layer to the Stage.
381         /// </summary>
382         /// <param name="layer">Layer to add</param>
383         public void AddLayer(Layer layer)
384         {
385             NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
386             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387         }
388
389         /// <summary>
390         /// Remove layer from the Stage.
391         /// </summary>
392         /// <param name="layer">Layer to remove</param>
393         public void RemoveLayer(Layer layer)
394         {
395             NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
396             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
397         }
398
399         internal void Add(View view)
400         {
401             NDalicPINVOKE.Stage_Add(stageCPtr, View.getCPtr(view));
402             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
403         }
404
405         internal void Remove(View view)
406         {
407             NDalicPINVOKE.Stage_Remove(stageCPtr, View.getCPtr(view));
408             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409         }
410
411         internal Vector2 GetSize()
412         {
413             Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
414             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
415             return ret;
416         }
417
418         internal RenderTaskList GetRenderTaskList()
419         {
420             RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
421             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
422             return ret;
423         }
424
425         internal uint GetLayerCount()
426         {
427             uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr);
428             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
429             return ret;
430         }
431
432         public Layer GetLayer(uint depth)
433         {
434             Layer ret = new Layer(NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth), true);
435             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
436             return ret;
437         }
438
439         internal Layer GetRootLayer()
440         {
441             Layer ret = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
442             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
443             return ret;
444         }
445
446         internal void SetBackgroundColor(Vector4 color)
447         {
448             NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
449             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
450         }
451
452         internal Vector4 GetBackgroundColor()
453         {
454             Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
455             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
456             return ret;
457         }
458
459         internal Vector2 GetDpi()
460         {
461             Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
462             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
463             return ret;
464         }
465
466         internal ObjectRegistry GetObjectRegistry()
467         {
468             ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
469             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
470             return ret;
471         }
472
473         /// <summary>
474         /// Keep rendering for at least the given amount of time.
475         /// </summary>
476         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame</param>
477         public void KeepRendering(float durationSeconds)
478         {
479             NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
480             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
481         }
482
483         internal KeyEventSignal KeyEventSignal()
484         {
485             KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
486             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
487             return ret;
488         }
489
490         internal VoidSignal EventProcessingFinishedSignal()
491         {
492             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
493             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
494             return ret;
495         }
496
497         internal TouchSignal TouchSignal()
498         {
499             TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
500             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
501             return ret;
502         }
503
504         private StageWheelSignal WheelEventSignal()
505         {
506             StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
507             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
508             return ret;
509         }
510
511         internal VoidSignal ContextLostSignal()
512         {
513             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
514             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
515             return ret;
516         }
517
518         internal VoidSignal ContextRegainedSignal()
519         {
520             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
521             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
522             return ret;
523         }
524
525         internal VoidSignal SceneCreatedSignal()
526         {
527             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
528             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
529             return ret;
530         }
531
532         internal static Vector4 DEFAULT_BACKGROUND_COLOR
533         {
534             get
535             {
536                 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
537                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
538                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
539                 return ret;
540             }
541         }
542
543         internal static Vector4 DEBUG_BACKGROUND_COLOR
544         {
545             get
546             {
547                 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
548                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
549                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
550                 return ret;
551             }
552         }
553
554         private static readonly Window instance = Application.Instance.GetWindow();
555
556         /// <summary>
557         /// Stage instance property (read-only).<br>
558         /// Gets the current Window.<br>
559         /// </summary>
560         public static Window Instance
561         {
562             get
563             {
564                 return instance;
565             }
566         }
567
568         /// <summary>
569         /// Grabs the key specified by a key for a window only when a window is the topmost window. <br>
570         /// This function can be used for following example scenarios: <br>
571         /// - Mobile - Using volume up/down as zoom up/down in camera apps. <br>
572         /// </summary>
573         /// <param name="DaliKey">The key code to grab</param>
574         /// <returns>true if the grab succeeds</returns>
575         public bool GrabKeyTopmost(int DaliKey)
576         {
577             bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
578             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
579             return ret;
580         }
581
582         /// <summary>
583         /// Ungrabs the key specified by a key for a window. <br>
584         /// 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>
585         /// </summary>
586         /// <param name="DaliKey">The key code to ungrab</param>
587         /// <returns>true if the ungrab succeeds</returns>
588         public bool UngrabKeyTopmost(int DaliKey)
589         {
590             bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
591             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
592             return ret;
593         }
594         /// <summary>
595         ///  Grabs the key specified by a key for a window in a GrabMode. <br>
596         ///  Details: This function can be used for following example scenarios: <br>
597         ///  - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br>
598         ///  - Mobile - When a user presses Home key, the homescreen appears regardless of current foreground app. <br>
599         ///  - Mobile - Using volume up/down as zoom up/down in camera apps. <br>
600         /// </summary>
601         /// <param name="DaliKey">The key code to grab</param>
602         /// <param name="GrabMode">The grab mode for the key</param>
603         /// <returns>true if the grab succeeds</returns>
604         public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
605         {
606             bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
607             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
608             return ret;
609         }
610         /// <summary>
611         /// Ungrabs the key specified by a key for a window.  <br>
612         /// 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>
613         /// </summary>
614         /// <param name="DaliKey">The key code to ungrab</param>
615         /// <returns>true if the ungrab succeeds</returns>
616         public bool UngrabKey(int DaliKey)
617         {
618             bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
619             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620             return ret;
621         }
622         internal System.IntPtr GetNativeWindowHandler()
623         {
624             System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
625             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
626             return ret;
627         }
628
629
630
631         /// <summary>
632         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
633         /// </summary>
634         public enum WindowOrientation
635         {
636             Portrait = 0,
637             Landscape = 90,
638             PortraitInverse = 180,
639             LandscapeInverse = 270
640         }
641
642         /// <summary>
643         /// Enumeration for key grab mode for platform-level APIs.
644         /// </summary>
645         public enum KeyGrabMode
646         {
647             /// <summary>
648             /// Grab a key only when on the top of the grabbing-window stack mode.
649             /// </summary>
650             Topmost = 0,
651             /// <summary>
652             /// Grab a key together with the other client window(s) mode.
653             /// </summary>
654             Shared,
655             /// <summary>
656             /// Grab 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.
657             /// </summary>
658             OverrideExclusive,
659             /// <summary>
660             /// Grab a key exclusively regardless of the grabbing-window's position on the window stack mode.
661             /// </summary>
662             Exclusive
663         };
664
665         /// <summary>
666         /// Enumeration for opacity of the indicator.
667         /// </summary>
668         internal enum IndicatorBgOpacity
669         {
670             Opaque = 100,
671             Translucent = 50,
672             Transparent = 0
673         }
674
675         /// <summary>
676         /// Enumeration for visible mode of the indicator.
677         /// </summary>
678         internal enum IndicatorVisibleMode
679         {
680             Invisible = 0,
681             Visible = 1,
682             Auto = 2
683         }
684
685         /// <summary>
686         /// Touch event argument.
687         /// </summary>
688         public class TouchEventArgs : EventArgs
689         {
690             private Touch _touch;
691
692             /// <summary>
693             /// Touch.
694             /// </summary>
695             public Touch Touch
696             {
697                 get
698                 {
699                     return _touch;
700                 }
701                 set
702                 {
703                     _touch = value;
704                 }
705             }
706         }
707
708         private event EventHandler<TouchEventArgs> _stageTouchHandler;
709         private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
710
711         /// <summary>
712         /// This is emitted when the screen is touched and when the touch ends.<br>
713         /// If there are multiple touch points, then this will be emitted when the first touch occurs and
714         /// then when the last finger is lifted.<br>
715         /// An interrupted event will also be emitted (if it occurs).<br>
716         /// </summary>
717         public event EventHandler<TouchEventArgs> Touch
718         {
719             add
720             {
721                 lock (this)
722                 {
723                     _stageTouchHandler += value;
724                     _stageTouchCallbackDelegate = OnStageTouch;
725                     this.TouchSignal().Connect(_stageTouchCallbackDelegate);
726                 }
727             }
728             remove
729             {
730                 lock (this)
731                 {
732                     if (_stageTouchHandler != null)
733                     {
734                         this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
735                     }
736                     _stageTouchHandler -= value;
737                 }
738             }
739         }
740
741         private void OnStageTouch(IntPtr data)
742         {
743             TouchEventArgs e = new TouchEventArgs();
744
745             if (data != null)
746             {
747                 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
748             }
749
750             if (_stageTouchHandler != null)
751             {
752                 _stageTouchHandler(this, e);
753             }
754         }
755
756         /// <summary>
757         /// Wheel event arguments.
758         /// </summary>
759         public class WheelEventArgs : EventArgs
760         {
761             private Wheel _wheel;
762
763             /// <summary>
764             /// Wheel.
765             /// </summary>
766             public Wheel Wheel
767             {
768                 get
769                 {
770                     return _wheel;
771                 }
772                 set
773                 {
774                     _wheel = value;
775                 }
776             }
777         }
778
779         private event EventHandler<WheelEventArgs> _stageWheelHandler;
780         private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
781
782         /// <summary>
783         /// Event emitted when wheel event is received.
784         /// </summary>
785         public event EventHandler<WheelEventArgs> Wheel
786         {
787             add
788             {
789                 if (_stageWheelHandler == null)
790                 {
791                     _stageWheelCallbackDelegate = OnStageWheel;
792                     WheelEventSignal().Connect(_stageWheelCallbackDelegate);
793                 }
794                 _stageWheelHandler += value;
795             }
796             remove
797             {
798                 _stageWheelHandler -= value;
799                 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
800                 {
801                     WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
802                 }
803             }
804         }
805
806         private void OnStageWheel(IntPtr data)
807         {
808             WheelEventArgs e = new WheelEventArgs();
809
810             if (data != null)
811             {
812                 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
813             }
814
815             if (_stageWheelHandler != null)
816             {
817                 _stageWheelHandler(this, e);
818             }
819         }
820
821         /// <summary>
822         /// Key event arguments.
823         /// </summary>
824         public class KeyEventArgs : EventArgs
825         {
826             private Key _key;
827
828             /// <summary>
829             /// Key
830             /// </summary>
831             public Key Key
832             {
833                 get
834                 {
835                     return _key;
836                 }
837                 set
838                 {
839                     _key = value;
840                 }
841             }
842         }
843
844         private event EventHandler<KeyEventArgs> _stageKeyHandler;
845         private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
846
847         /// <summary>
848         /// Event emitted when key event is received.
849         /// </summary>
850         public event EventHandler<KeyEventArgs> Key
851         {
852             add
853             {
854                 if (_stageKeyHandler == null)
855                 {
856                     _stageKeyCallbackDelegate = OnStageKey;
857                     KeyEventSignal().Connect(_stageKeyCallbackDelegate);
858                 }
859                 _stageKeyHandler += value;
860             }
861             remove
862             {
863                 _stageKeyHandler -= value;
864                 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
865                 {
866                     KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
867                 }
868             }
869         }
870
871         // Callback for Stage KeyEventsignal
872         private void OnStageKey(IntPtr data)
873         {
874             KeyEventArgs e = new KeyEventArgs();
875
876             if (data != null)
877             {
878                 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
879             }
880
881             if (_stageKeyHandler != null)
882             {
883                 //here we send all data to user event handlers
884                 _stageKeyHandler(this, e);
885             }
886         }
887
888
889         private event EventHandler _stageEventProcessingFinishedEventHandler;
890         private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
891
892         internal event EventHandler EventProcessingFinished
893         {
894             add
895             {
896                 if (_stageEventProcessingFinishedEventHandler == null)
897                 {
898                     _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
899                     EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
900                 }
901                 _stageEventProcessingFinishedEventHandler += value;
902
903             }
904             remove
905             {
906                 _stageEventProcessingFinishedEventHandler -= value;
907                 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
908                 {
909                     EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
910                 }
911             }
912         }
913
914         // Callback for Stage EventProcessingFinishedSignal
915         private void OnEventProcessingFinished()
916         {
917             if (_stageEventProcessingFinishedEventHandler != null)
918             {
919                 _stageEventProcessingFinishedEventHandler(this, null);
920             }
921         }
922
923
924         private EventHandler _stageContextLostEventHandler;
925         private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
926
927         internal event EventHandler ContextLost
928         {
929             add
930             {
931                 if (_stageContextLostEventHandler == null)
932                 {
933                     _stageContextLostEventCallbackDelegate = OnContextLost;
934                     ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
935                 }
936                 _stageContextLostEventHandler += value;
937             }
938             remove
939             {
940                 _stageContextLostEventHandler -= value;
941                 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
942                 {
943                     ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
944                 }
945             }
946         }
947
948         // Callback for Stage ContextLostSignal
949         private void OnContextLost()
950         {
951             if (_stageContextLostEventHandler != null)
952             {
953                 _stageContextLostEventHandler(this, null);
954             }
955         }
956
957
958         private EventHandler _stageContextRegainedEventHandler;
959         private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
960
961         internal event EventHandler ContextRegained
962         {
963             add
964             {
965                 if (_stageContextRegainedEventHandler == null)
966                 {
967                     _stageContextRegainedEventCallbackDelegate = OnContextRegained;
968                     ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
969                 }
970                 _stageContextRegainedEventHandler += value;
971             }
972             remove
973             {
974                 _stageContextRegainedEventHandler -= value;
975                 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
976                 {
977                     this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
978                 }
979             }
980         }
981
982         // Callback for Stage ContextRegainedSignal
983         private void OnContextRegained()
984         {
985             if (_stageContextRegainedEventHandler != null)
986             {
987                 _stageContextRegainedEventHandler(this, null);
988             }
989         }
990
991
992         private EventHandler _stageSceneCreatedEventHandler;
993         private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
994
995         internal event EventHandler SceneCreated
996         {
997             add
998             {
999                 if (_stageSceneCreatedEventHandler == null)
1000                 {
1001                     _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1002                     SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1003                 }
1004                 _stageSceneCreatedEventHandler += value;
1005             }
1006             remove
1007             {
1008                 _stageSceneCreatedEventHandler -= value;
1009                 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1010                 {
1011                     SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1012                 }
1013             }
1014         }
1015
1016         // Callback for Stage SceneCreatedSignal
1017         private void OnSceneCreated()
1018         {
1019             if (_stageSceneCreatedEventHandler != null)
1020             {
1021                 _stageSceneCreatedEventHandler(this, null);
1022             }
1023         }
1024
1025         /// <summary>
1026         /// Window size property (read-only).
1027         /// </summary>
1028         public Vector2 Size
1029         {
1030             get
1031             {
1032                 Vector2 ret = GetSize();
1033                 return ret;
1034             }
1035         }
1036
1037         /// <summary>
1038         /// Background color property.
1039         /// </summary>
1040         public Vector4 BackgroundColor
1041         {
1042             set
1043             {
1044                 SetBackgroundColor(value);
1045             }
1046             get
1047             {
1048                 Vector4 ret = GetBackgroundColor();
1049                 return ret;
1050             }
1051         }
1052
1053         /// <summary>
1054         /// Dpi property (read-only).<br>
1055         /// Retrieves the DPI of the display device to which the Window is connected.<br>
1056         /// </summary>
1057         public Vector2 Dpi
1058         {
1059             get
1060             {
1061                 return GetDpi();
1062             }
1063         }
1064
1065         /// <summary>
1066         /// Layer count property (read-only).<br>
1067         /// Queries the number of on-Window layers.<br>
1068         /// </summary>
1069         public uint LayerCount
1070         {
1071             get
1072             {
1073                 return GetLayerCount();
1074             }
1075         }
1076     }
1077 }