[Tizen] some APIs are changed for preview#4
[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             if (NDalicPINVOKE.Stage_IsInstalled())
47             {
48                 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
49             }
50         }
51
52         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
53         {
54             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
55         }
56
57         /// <summary>
58         /// To make Window instance be disposed.
59         /// </summary>
60         protected override void Dispose(DisposeTypes type)
61         {
62             if(disposed)
63             {
64                 return;
65             }
66
67             if(type == DisposeTypes.Explicit)
68             {
69                 //Called by User
70                 //Release your own managed resources here.
71                 //You should release all of your own disposable objects here.
72             }
73
74             //Release your own unmanaged resources here.
75             //You should not access any managed member here except static instance.
76             //because the execution order of Finalizes is non-deterministic.
77
78             if (swigCPtr.Handle != global::System.IntPtr.Zero)
79             {
80                 if (swigCMemOwn)
81                 {
82                     swigCMemOwn = false;
83                     NDalicPINVOKE.delete_Window(swigCPtr);
84                     NDalicPINVOKE.delete_Stage(stageCPtr);
85                 }
86                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
87             }
88
89             base.Dispose(type);
90         }
91
92         internal static Window GetCurrent()
93         {
94             Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
95             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96             return ret;
97         }
98
99        internal static bool IsInstalled()
100        {
101             bool ret = NDalicPINVOKE.Stage_IsInstalled();
102             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103             return ret;
104        }
105
106         /*********************************************************************************/\r
107         /*** will be removed/deprecated                                                  ***/\r
108         /*********************************************************************************/\r
109         public void SetAcceptFocus(bool accept)
110         {
111             NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
112             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113         }
114
115         /*********************************************************************************/\r
116         /*** will be removed/deprecated                                                  ***/\r
117         /*********************************************************************************/\r
118         public bool IsFocusAcceptable()
119         {
120             return NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
121             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122         }
123
124         /// <summary>
125         /// Shows the window if it is hidden.
126         /// </summary>
127         public void Show()
128         {
129             NDalicPINVOKE.Show(swigCPtr);
130             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131         }
132
133         /// <summary>
134         /// Hides the window if it is showing.
135         /// </summary>
136         public void Hide()
137         {
138             NDalicPINVOKE.Hide(swigCPtr);
139             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140         }
141
142         /// <summary>
143         /// Retrieves whether the window is visible or not.
144         /// </summary>
145         /// <returns>true, if the windoe is visible</returns>
146         public bool IsVisible()
147         {
148             bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
149             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150             return temp;
151         }
152
153         /// <summary>
154         /// Gets the count of supported auxiliary hints of the window.
155         /// </summary>
156         /// <returns>The number of supported auxiliary hints.</returns>
157         public uint GetSupportedAuxiliaryHintCount() {
158             uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
159             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160             return ret;
161         }
162
163         /// <summary>
164         /// Gets the supported auxiliary hint string of the window.
165         /// </summary>
166         /// <param name="index">The index of the supported auxiliary hint lists.</param>
167         /// <returns>The auxiliary hint string of the index.</returns>
168         public string GetSupportedAuxiliaryHint(uint index) {
169             string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
170             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171             return ret;
172         }
173
174         /// <summary>
175         /// Creates an auxiliary hint of the window.
176         /// </summary>
177         /// <param name="hint">The auxiliary hint string.</param>
178         /// <param name="value">The value string.</param>
179         /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
180         public uint AddAuxiliaryHint(string hint, string value) {
181             uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
182             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183             return ret;
184         }
185
186         /// <summary>
187         /// Removes an auxiliary hint of the window.
188         /// </summary>
189         /// <param name="id">The ID of the auxiliary hint.</param>
190         /// <returns>True if no error occurred, false otherwise.</returns>
191         public bool RemoveAuxiliaryHint(uint id) {
192             bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
193             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194             return ret;
195         }
196
197         /// <summary>
198         /// Changes a value of the auxiliary hint.
199         /// </summary>
200         /// <param name="id">The auxiliary hint ID.</param>
201         /// <param name="value">The value string to be set.</param>
202         /// <returns>True if no error occurred, false otherwise.</returns>
203         public bool SetAuxiliaryHintValue(uint id, string value) {
204             bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
205             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206             return ret;
207         }
208
209         /// <summary>
210         /// Gets a value of the auxiliary hint.
211         /// </summary>
212         /// <param name="id">The auxiliary hint ID.</param>
213         /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
214         public string GetAuxiliaryHintValue(uint id) {
215             string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
216             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217             return ret;
218         }
219
220         /// <summary>
221         /// Gets an ID of the auxiliary hint string.
222         /// </summary>
223         /// <param name="hint">The auxiliary hint string.</param>
224         /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
225         public uint GetAuxiliaryHintId(string hint) {
226             uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
227             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228             return ret;
229         }
230
231         /// <summary>
232         /// Sets a region to accept input events.
233         /// </summary>
234         /// <param name="inputRegion">The region to accept input events.</param>
235         public void SetInputRegion(Rectangle inputRegion) {
236             NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
237             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
238         }
239
240         /// <summary>
241         /// Gets/Sets a window type.
242         /// </summary>
243         public WindowType Type
244         {
245             get
246             {
247                 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
248                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249                 return ret;
250             }
251             set
252             {
253                 NDalicPINVOKE.SetType(swigCPtr, (int)value);
254                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
255             }
256         }
257
258         /// <summary>
259         /// Sets a priority level for the specified notification window.
260         /// </summary>
261         /// <param name="level">The notification window level.</param>
262         /// <returns>True if no error occurred, false otherwise.</returns>
263         public bool SetNotificationLevel(NotificationLevel level) {
264             bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
265             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
266             return ret;
267         }
268
269         /// <summary>
270         /// Gets a priority level for the specified notification window.
271         /// </summary>
272         /// <returns>The notification window level.</returns>
273         public NotificationLevel GetNotificationLevel() {
274             NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
275             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276             return ret;
277         }
278
279         /// <summary>
280         /// Sets a transparent window's visual state to opaque.
281         /// </summary>
282         /// <param name="opaque">Whether the window's visual state is opaque.</param>
283         public void SetOpaqueState(bool opaque) {
284             NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
285             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286         }
287
288         /// <summary>
289         /// Returns whether a transparent window's visual state is opaque or not.
290         /// </summary>
291         /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
292         public bool IsOpaqueState() {
293             bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
294             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295             return ret;
296         }
297
298         /// <summary>
299         /// Sets a window's screen mode.
300         /// </summary>
301         /// <param name="screenMode">The screen mode.</param>
302         /// <returns>True if no error occurred, false otherwise.</returns>
303         public bool SetScreenMode(ScreenMode screenMode) {
304             bool ret = NDalicPINVOKE.SetScreenMode(swigCPtr, (int)screenMode);
305             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
306             return ret;
307         }
308
309         /// <summary>
310         /// Gets a screen mode of the window.
311         /// </summary>
312         /// <returns>The screen mode.</returns>
313         public ScreenMode GetScreenMode() {
314             ScreenMode ret = (ScreenMode)NDalicPINVOKE.GetScreenMode(swigCPtr);
315             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
316             return ret;
317         }
318
319         /// <summary>
320         /// Sets preferred brightness of the window.
321         /// </summary>
322         /// <param name="brightness">The preferred brightness (0 to 100).</param>
323         /// <returns>True if no error occurred, false otherwise.</returns>
324         public bool SetBrightness(int brightness) {
325             bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
326             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
327             return ret;
328         }
329
330         /// <summary>
331         /// Gets preffered brightness of the window.
332         /// </summary>
333         /// <returns>The preffered brightness.</returns>
334         public int GetBrightness() {
335             int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
336             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
337             return ret;
338         }
339
340         public class WindowFocusChangedEventArgs : EventArgs
341         {
342             public bool FocusGained
343             {
344                 get;
345                 set;
346             }
347         }
348
349         private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
350         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
351         private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
352         private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler;
353
354         public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
355         {
356             add
357             {
358                 if (_windowFocusChangedEventHandler == null)
359                 {
360                     _windowFocusChangedEventCallback = OnWindowFocusedChanged;
361                     WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
362                 }
363
364                 _windowFocusChangedEventHandler += value;
365             }
366             remove
367             {
368                 _windowFocusChangedEventHandler -= value;
369
370                 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
371                 {
372                     WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
373                 }
374             }
375         }
376
377         private void OnWindowFocusedChanged(bool focusGained)
378         {
379             WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
380
381             e.FocusGained = focusGained;
382
383             if (_windowFocusChangedEventHandler != null)
384             {
385                 _windowFocusChangedEventHandler(this, e);
386             }
387         }
388
389         internal WindowFocusSignalType WindowFocusChangedSignal()
390         {
391             WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
392             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393             return ret;
394         }
395
396         internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
397         {
398             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
399         }
400
401         internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
402         {
403             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404         }
405
406         internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
407         {
408             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409         }
410
411         internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
412         {
413             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
414         }
415
416         internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
417         {
418             NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
419             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
420         }
421
422         internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
423         {
424             NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
425             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
426         }
427
428         internal void RotateIndicator(Window.WindowOrientation orientation)
429         {
430             NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
431             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
432         }
433
434         internal void SetClass(string name, string klass)
435         {
436             NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
437             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
438         }
439
440         /// <summary>
441         /// Raises window to the top of Window stack.
442         /// </summary>
443         public void Raise()
444         {
445             NDalicPINVOKE.Window_Raise(swigCPtr);
446             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
447         }
448
449         /// <summary>
450         /// Lowers window to the bottom of Window stack.
451         /// </summary>
452         public void Lower()
453         {
454             NDalicPINVOKE.Window_Lower(swigCPtr);
455             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
456         }
457
458         /// <summary>
459         /// Activates window to the top of Window stack even it is iconified.
460         /// </summary>
461         public void Activate()
462         {
463             NDalicPINVOKE.Window_Activate(swigCPtr);
464             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
465         }
466
467         internal void AddAvailableOrientation(Window.WindowOrientation orientation)
468         {
469             NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
470             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
471         }
472
473         internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
474         {
475             NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
476             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
477         }
478
479         internal void SetPreferredOrientation(Window.WindowOrientation orientation)
480         {
481             NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
482             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
483         }
484
485         internal Window.WindowOrientation GetPreferredOrientation()
486         {
487             Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
488             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
489             return ret;
490         }
491
492         internal DragAndDropDetector GetDragAndDropDetector()
493         {
494             DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
495             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
496             return ret;
497         }
498
499         internal Any GetNativeHandle()
500         {
501             Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
502             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
503             return ret;
504         }
505
506         internal WindowFocusSignalType FocusChangedSignal()
507         {
508             WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
509             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
510             return ret;
511         }
512
513         /// <summary>
514         /// Get default ( root ) layer.
515         /// </summary>
516         /// <returns>The root layer</returns>
517         public Layer GetDefaultLayer()
518         {
519             return this.GetRootLayer();
520         }
521
522         /// <summary>
523         /// Add layer to the Stage.
524         /// </summary>
525         /// <param name="layer">Layer to add</param>
526         public void Add(Layer layer)
527         {
528             NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
529             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530         }
531
532         /// <summary>
533         /// Remove layer from the Stage.
534         /// </summary>
535         /// <param name="layer">Layer to remove</param>
536         public void Remove(Layer layer)
537         {
538             NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
539             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
540         }
541
542         public void Add(View view)
543         {
544             NDalicPINVOKE.Stage_Add(stageCPtr, View.getCPtr(view));
545             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
546         }
547
548         public void Remove(View view)
549         {
550             NDalicPINVOKE.Stage_Remove(stageCPtr, View.getCPtr(view));
551             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
552         }
553
554         internal Vector2 GetSize()
555         {
556             Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
557             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
558             return ret;
559         }
560
561         internal RenderTaskList GetRenderTaskList()
562         {
563             RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
564             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
565             return ret;
566         }
567
568         /// <summary>
569         /// Queries the number of on-window layers.
570         /// </summary>
571         /// <returns>The number of layers.</returns>
572         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
573         internal uint GetLayerCount()
574         {
575             uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr);
576             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
577             return ret;
578         }
579
580         public Layer GetLayer(uint depth)
581         {
582             Layer ret = new Layer(NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth), true);
583             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
584             return ret;
585         }
586
587         internal Layer GetRootLayer()
588         {
589             Layer ret = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
590             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
591             return ret;
592         }
593
594         internal void SetBackgroundColor(Vector4 color)
595         {
596             NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
597             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598         }
599
600         internal Vector4 GetBackgroundColor()
601         {
602             Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
603             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
604             return ret;
605         }
606
607         internal Vector2 GetDpi()
608         {
609             Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
610             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
611             return ret;
612         }
613
614         internal ObjectRegistry GetObjectRegistry()
615         {
616             ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
617             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
618             return ret;
619         }
620
621         /// <summary>
622         /// Keep rendering for at least the given amount of time.
623         /// </summary>
624         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame</param>
625         public void KeepRendering(float durationSeconds)
626         {
627             NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
628             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
629         }
630
631         internal KeyEventSignal KeyEventSignal()
632         {
633             KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
634             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
635             return ret;
636         }
637
638         internal VoidSignal EventProcessingFinishedSignal()
639         {
640             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
641             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
642             return ret;
643         }
644
645         internal TouchSignal TouchSignal()
646         {
647             TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
648             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
649             return ret;
650         }
651
652         private StageWheelSignal WheelEventSignal()
653         {
654             StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
655             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
656             return ret;
657         }
658
659         internal VoidSignal ContextLostSignal()
660         {
661             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
662             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
663             return ret;
664         }
665
666         internal VoidSignal ContextRegainedSignal()
667         {
668             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
669             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
670             return ret;
671         }
672
673         internal VoidSignal SceneCreatedSignal()
674         {
675             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
676             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
677             return ret;
678         }
679
680         internal static Vector4 DEFAULT_BACKGROUND_COLOR
681         {
682             get
683             {
684                 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
685                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
686                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
687                 return ret;
688             }
689         }
690
691         internal static Vector4 DEBUG_BACKGROUND_COLOR
692         {
693             get
694             {
695                 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
696                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
697                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
698                 return ret;
699             }
700         }
701
702         private static readonly Window instance = Application.Instance.GetWindow();
703
704         /// <summary>
705         /// Stage instance property (read-only).<br>
706         /// Gets the current Window.<br>
707         /// </summary>
708         public static Window Instance
709         {
710             get
711             {
712                 return instance;
713             }
714         }
715
716         /// <summary>
717         /// Grabs the key specified by a key for a window only when a window is the topmost window. <br>
718         /// This function can be used for following example scenarios: <br>
719         /// - Mobile - Using volume up/down as zoom up/down in camera apps. <br>
720         /// </summary>
721         /// <param name="DaliKey">The key code to grab</param>
722         /// <returns>true if the grab succeeds</returns>
723         public bool GrabKeyTopmost(int DaliKey)
724         {
725             bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
726             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
727             return ret;
728         }
729
730         /// <summary>
731         /// Ungrabs the key specified by a key for a window. <br>
732         /// 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>
733         /// </summary>
734         /// <param name="DaliKey">The key code to ungrab</param>
735         /// <returns>true if the ungrab succeeds</returns>
736         public bool UngrabKeyTopmost(int DaliKey)
737         {
738             bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
739             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740             return ret;
741         }
742
743         /// <summary>
744         ///  Grabs the key specified by a key for a window in a GrabMode. <br>
745         ///  Details: This function can be used for following example scenarios: <br>
746         ///  - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br>
747         ///  - Mobile - When a user presses Home key, the homescreen appears regardless of current foreground app. <br>
748         ///  - Mobile - Using volume up/down as zoom up/down in camera apps. <br>
749         /// </summary>
750         /// <param name="DaliKey">The key code to grab</param>
751         /// <param name="GrabMode">The grab mode for the key</param>
752         /// <returns>true if the grab succeeds</returns>
753         public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
754         {
755             bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
756             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
757             return ret;
758         }
759
760         /// <summary>
761         /// Ungrabs the key specified by a key for a window.  <br>
762         /// 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>
763         /// </summary>
764         /// <param name="DaliKey">The key code to ungrab</param>
765         /// <returns>true if the ungrab succeeds</returns>
766         public bool UngrabKey(int DaliKey)
767         {
768             bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
769             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770             return ret;
771         }
772
773         internal System.IntPtr GetNativeWindowHandler()
774         {
775             System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
776             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777             return ret;
778         }
779
780         /// <summary>
781         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
782         /// </summary>
783         public enum WindowOrientation
784         {
785             Portrait = 0,
786             Landscape = 90,
787             PortraitInverse = 180,
788             LandscapeInverse = 270
789         }
790
791         /// <summary>
792         /// Enumeration for key grab mode for platform-level APIs.
793         /// </summary>
794         public enum KeyGrabMode
795         {
796             /// <summary>
797             /// Grab a key only when on the top of the grabbing-window stack mode.
798             /// </summary>
799             Topmost = 0,
800             /// <summary>
801             /// Grab a key together with the other client window(s) mode.
802             /// </summary>
803             Shared,
804             /// <summary>
805             /// 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.
806             /// </summary>
807             OverrideExclusive,
808             /// <summary>
809             /// Grab a key exclusively regardless of the grabbing-window's position on the window stack mode.
810             /// </summary>
811             Exclusive
812         };
813
814         /// <summary>
815         /// Enumeration for opacity of the indicator.
816         /// </summary>
817         internal enum IndicatorBackgroundOpacity
818         {
819             Opaque = 100,
820             Translucent = 50,
821             Transparent = 0
822         }
823
824         /// <summary>
825         /// Enumeration for visible mode of the indicator.
826         /// </summary>
827         internal enum IndicatorVisibleMode
828         {
829             Invisible = 0,
830             Visible = 1,
831             Auto = 2
832         }
833
834         /// <summary>
835         /// Touch event argument.
836         /// </summary>
837         public class TouchEventArgs : EventArgs
838         {
839             private Touch _touch;
840
841             /// <summary>
842             /// Touch.
843             /// </summary>
844             public Touch Touch
845             {
846                 get
847                 {
848                     return _touch;
849                 }
850                 set
851                 {
852                     _touch = value;
853                 }
854             }
855         }
856
857         private event EventHandler<TouchEventArgs> _stageTouchHandler;
858         private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
859
860         /// <summary>
861         /// This is emitted when the screen is touched and when the touch ends.<br>
862         /// If there are multiple touch points, then this will be emitted when the first touch occurs and
863         /// then when the last finger is lifted.<br>
864         /// An interrupted event will also be emitted (if it occurs).<br>
865         /// </summary>
866         public event EventHandler<TouchEventArgs> Touch
867         {
868             add
869             {
870                 lock (this)
871                 {
872                     _stageTouchHandler += value;
873                     _stageTouchCallbackDelegate = OnStageTouch;
874                     this.TouchSignal().Connect(_stageTouchCallbackDelegate);
875                 }
876             }
877             remove
878             {
879                 lock (this)
880                 {
881                     if (_stageTouchHandler != null)
882                     {
883                         this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
884                     }
885                     _stageTouchHandler -= value;
886                 }
887             }
888         }
889
890         private void OnStageTouch(IntPtr data)
891         {
892             TouchEventArgs e = new TouchEventArgs();
893
894             if (data != null)
895             {
896                 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
897             }
898
899             if (_stageTouchHandler != null)
900             {
901                 _stageTouchHandler(this, e);
902             }
903         }
904
905         /// <summary>
906         /// Wheel event arguments.
907         /// </summary>
908         public class WheelEventArgs : EventArgs
909         {
910             private Wheel _wheel;
911
912             /// <summary>
913             /// Wheel.
914             /// </summary>
915             public Wheel Wheel
916             {
917                 get
918                 {
919                     return _wheel;
920                 }
921                 set
922                 {
923                     _wheel = value;
924                 }
925             }
926         }
927
928         private event EventHandler<WheelEventArgs> _stageWheelHandler;
929         private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
930
931         /// <summary>
932         /// Event emitted when wheel event is received.
933         /// </summary>
934         public event EventHandler<WheelEventArgs> WheelRoll
935         {
936             add
937             {
938                 if (_stageWheelHandler == null)
939                 {
940                     _stageWheelCallbackDelegate = OnStageWheel;
941                     WheelEventSignal().Connect(_stageWheelCallbackDelegate);
942                 }
943                 _stageWheelHandler += value;
944             }
945             remove
946             {
947                 _stageWheelHandler -= value;
948                 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
949                 {
950                     WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
951                 }
952             }
953         }
954
955         private void OnStageWheel(IntPtr data)
956         {
957             WheelEventArgs e = new WheelEventArgs();
958
959             if (data != null)
960             {
961                 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
962             }
963
964             if (_stageWheelHandler != null)
965             {
966                 _stageWheelHandler(this, e);
967             }
968         }
969
970         /// <summary>
971         /// Key event arguments.
972         /// </summary>
973         public class KeyEventArgs : EventArgs
974         {
975             private Key _key;
976
977             /// <summary>
978             /// Key
979             /// </summary>
980             public Key Key
981             {
982                 get
983                 {
984                     return _key;
985                 }
986                 set
987                 {
988                     _key = value;
989                 }
990             }
991         }
992
993         private event EventHandler<KeyEventArgs> _stageKeyHandler;
994         private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
995
996         /// <summary>
997         /// Event emitted when key event is received.
998         /// </summary>
999         public event EventHandler<KeyEventArgs> Key
1000         {
1001             add
1002             {
1003                 if (_stageKeyHandler == null)
1004                 {
1005                     _stageKeyCallbackDelegate = OnStageKey;
1006                     KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1007                 }
1008                 _stageKeyHandler += value;
1009             }
1010             remove
1011             {
1012                 _stageKeyHandler -= value;
1013                 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1014                 {
1015                     KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1016                 }
1017             }
1018         }
1019
1020         // Callback for Stage KeyEventsignal
1021         private void OnStageKey(IntPtr data)
1022         {
1023             KeyEventArgs e = new KeyEventArgs();
1024
1025             if (data != null)
1026             {
1027                 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1028             }
1029
1030             if (_stageKeyHandler != null)
1031             {
1032                 //here we send all data to user event handlers
1033                 _stageKeyHandler(this, e);
1034             }
1035         }
1036
1037
1038         private event EventHandler _stageEventProcessingFinishedEventHandler;
1039         private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1040
1041         internal event EventHandler EventProcessingFinished
1042         {
1043             add
1044             {
1045                 if (_stageEventProcessingFinishedEventHandler == null)
1046                 {
1047                     _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1048                     EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1049                 }
1050                 _stageEventProcessingFinishedEventHandler += value;
1051
1052             }
1053             remove
1054             {
1055                 _stageEventProcessingFinishedEventHandler -= value;
1056                 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1057                 {
1058                     EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1059                 }
1060             }
1061         }
1062
1063         // Callback for Stage EventProcessingFinishedSignal
1064         private void OnEventProcessingFinished()
1065         {
1066             if (_stageEventProcessingFinishedEventHandler != null)
1067             {
1068                 _stageEventProcessingFinishedEventHandler(this, null);
1069             }
1070         }
1071
1072
1073         private EventHandler _stageContextLostEventHandler;
1074         private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1075
1076         internal event EventHandler ContextLost
1077         {
1078             add
1079             {
1080                 if (_stageContextLostEventHandler == null)
1081                 {
1082                     _stageContextLostEventCallbackDelegate = OnContextLost;
1083                     ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1084                 }
1085                 _stageContextLostEventHandler += value;
1086             }
1087             remove
1088             {
1089                 _stageContextLostEventHandler -= value;
1090                 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1091                 {
1092                     ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1093                 }
1094             }
1095         }
1096
1097         // Callback for Stage ContextLostSignal
1098         private void OnContextLost()
1099         {
1100             if (_stageContextLostEventHandler != null)
1101             {
1102                 _stageContextLostEventHandler(this, null);
1103             }
1104         }
1105
1106
1107         private EventHandler _stageContextRegainedEventHandler;
1108         private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1109
1110         internal event EventHandler ContextRegained
1111         {
1112             add
1113             {
1114                 if (_stageContextRegainedEventHandler == null)
1115                 {
1116                     _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1117                     ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1118                 }
1119                 _stageContextRegainedEventHandler += value;
1120             }
1121             remove
1122             {
1123                 _stageContextRegainedEventHandler -= value;
1124                 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1125                 {
1126                     this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1127                 }
1128             }
1129         }
1130
1131         // Callback for Stage ContextRegainedSignal
1132         private void OnContextRegained()
1133         {
1134             if (_stageContextRegainedEventHandler != null)
1135             {
1136                 _stageContextRegainedEventHandler(this, null);
1137             }
1138         }
1139
1140
1141         private EventHandler _stageSceneCreatedEventHandler;
1142         private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1143
1144         internal event EventHandler SceneCreated
1145         {
1146             add
1147             {
1148                 if (_stageSceneCreatedEventHandler == null)
1149                 {
1150                     _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1151                     SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1152                 }
1153                 _stageSceneCreatedEventHandler += value;
1154             }
1155             remove
1156             {
1157                 _stageSceneCreatedEventHandler -= value;
1158                 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1159                 {
1160                     SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1161                 }
1162             }
1163         }
1164
1165         // Callback for Stage SceneCreatedSignal
1166         private void OnSceneCreated()
1167         {
1168             if (_stageSceneCreatedEventHandler != null)
1169             {
1170                 _stageSceneCreatedEventHandler(this, null);
1171             }
1172         }
1173
1174         /// <summary>
1175         /// Window size property (read-only).
1176         /// </summary>
1177         public Size2D Size
1178         {
1179             get
1180             {
1181                 Size2D ret = GetSize();
1182                 return ret;
1183             }
1184         }
1185
1186         /// <summary>
1187         /// Background color property.
1188         /// </summary>
1189         public Color BackgroundColor
1190         {
1191             set
1192             {
1193                 SetBackgroundColor(value);
1194             }
1195             get
1196             {
1197                 Color ret = GetBackgroundColor();
1198                 return ret;
1199             }
1200         }
1201
1202         /// <summary>
1203         /// Dpi property (read-only).<br>
1204         /// Retrieves the DPI of the display device to which the Window is connected.<br>
1205         /// </summary>
1206         public Vector2 Dpi
1207         {
1208             get
1209             {
1210                 return GetDpi();
1211             }
1212         }
1213
1214         /// <summary>
1215         /// Layer count property (read-only).<br>
1216         /// Queries the number of on-Window layers.<br>
1217         /// </summary>
1218         public uint LayerCount
1219         {
1220             get
1221             {
1222                 return GetLayerCount();
1223             }
1224         }
1225     }
1226 }