Fis some document errors.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 namespace Tizen.NUI
19 {
20
21     using System;
22     using System.Runtime.InteropServices;
23     using Tizen.NUI.BaseComponents;
24     using System.ComponentModel;
25
26     /// <summary>
27     /// The window class is used internally for drawing.<br />
28     /// The window has an orientation and indicator properties.<br />
29     /// </summary>
30     public class Window : BaseHandle
31     {
32         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33         private global::System.Runtime.InteropServices.HandleRef stageCPtr;
34         private Layer _rootLayer;
35         private string _windowTitle;
36
37         internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
38         {
39             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
40             if (NDalicPINVOKE.Stage_IsInstalled())
41             {
42                 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
43             }
44         }
45
46         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
47         {
48             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
49         }
50
51         /// <summary>
52         /// To make the window instance be disposed.
53         /// </summary>
54         protected override void Dispose(DisposeTypes type)
55         {
56             if(disposed)
57             {
58                 return;
59             }
60
61             if(type == DisposeTypes.Explicit)
62             {
63                 //Called by User
64                 //Release your own managed resources here.
65                 //You should release all of your own disposable objects here.
66             }
67
68             //Release your own unmanaged resources here.
69             //You should not access any managed member here except static instance.
70             //because the execution order of Finalizes is non-deterministic.
71
72             if (_windowFocusChangedEventCallback != null)
73             {
74                 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
75             }
76
77             if (_stageTouchCallbackDelegate != null)
78             {
79                 TouchSignal().Disconnect(_stageTouchCallbackDelegate);
80             }
81
82             if (_stageWheelCallbackDelegate != null)
83             {
84                 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
85             }
86
87             if (_stageKeyCallbackDelegate != null)
88             {
89                 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
90             }
91
92             if (_stageEventProcessingFinishedEventCallbackDelegate != null)
93             {
94                 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
95             }
96
97             if (_stageContextLostEventCallbackDelegate != null)
98             {
99                 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
100             }
101
102             if (_stageContextRegainedEventCallbackDelegate != null)
103             {
104                 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
105             }
106
107             if (_stageSceneCreatedEventCallbackDelegate != null)
108             {
109                 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
110             }
111
112             if (_windowResizedEventCallback != null)
113             {
114                 ResizedSignal().Disconnect(_windowResizedEventCallback);
115             }
116
117             if (_windowFocusChangedEventCallback2 != null)
118             {
119                 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
120             }
121
122             if (swigCPtr.Handle != global::System.IntPtr.Zero)
123             {
124                 if (swigCMemOwn)
125                 {
126                     swigCMemOwn = false;
127                     NDalicPINVOKE.delete_Window(swigCPtr);
128                     NDalicPINVOKE.delete_Stage(stageCPtr);
129                 }
130                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
131             }
132
133             base.Dispose(type);
134         }
135
136         internal static Window GetCurrent()
137         {
138             Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
139             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140             return ret;
141         }
142
143        internal static bool IsInstalled()
144        {
145             bool ret = NDalicPINVOKE.Stage_IsInstalled();
146             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147             return ret;
148        }
149
150         /// <summary>
151         /// Sets whether the window accepts a focus or not.
152         /// </summary>
153         /// <param name="accept">If a focus is accepted or not. The default is true.</param>
154         /// <since_tizen> 3 </since_tizen>
155         public void SetAcceptFocus(bool accept)
156         {
157             NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
158             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159         }
160
161         /// <summary>
162         /// Returns whether the window accepts a focus or not.
163         /// </summary>
164         /// <returns>True if the window accepts a focus, false otherwise.</returns>
165         /// <since_tizen> 3 </since_tizen>
166         public bool IsFocusAcceptable()
167         {
168             bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
169             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170
171             return ret;
172         }
173
174         /// <summary>
175         /// Shows the window if it is hidden.
176         /// </summary>
177         /// <since_tizen> 3 </since_tizen>
178         public void Show()
179         {
180             NDalicPINVOKE.Show(swigCPtr);
181             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182         }
183
184         /// <summary>
185         /// Hides the window if it is showing.
186         /// </summary>
187         /// <since_tizen> 3 </since_tizen>
188         public void Hide()
189         {
190             NDalicPINVOKE.Hide(swigCPtr);
191             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192         }
193
194         /// <summary>
195         /// Retrieves whether the window is visible or not.
196         /// </summary>
197         /// <returns>True if the window is visible.</returns>
198         /// <since_tizen> 3 </since_tizen>
199         public bool IsVisible()
200         {
201             bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
202             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203             return temp;
204         }
205
206         /// <summary>
207         /// Gets the count of supported auxiliary hints of the window.
208         /// </summary>
209         /// <returns>The number of supported auxiliary hints.</returns>
210         /// <since_tizen> 3 </since_tizen>
211         public uint GetSupportedAuxiliaryHintCount() {
212             uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
213             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214             return ret;
215         }
216
217         /// <summary>
218         /// Gets the supported auxiliary hint string of the window.
219         /// </summary>
220         /// <param name="index">The index of the supported auxiliary hint lists.</param>
221         /// <returns>The auxiliary hint string of the index.</returns>
222         /// <since_tizen> 3 </since_tizen>
223         public string GetSupportedAuxiliaryHint(uint index) {
224             string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
225             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226             return ret;
227         }
228
229         /// <summary>
230         /// Creates an auxiliary hint of the window.
231         /// </summary>
232         /// <param name="hint">The auxiliary hint string.</param>
233         /// <param name="value">The value string.</param>
234         /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
235         /// <since_tizen> 3 </since_tizen>
236         public uint AddAuxiliaryHint(string hint, string value) {
237             uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
238             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239             return ret;
240         }
241
242         /// <summary>
243         /// Removes an auxiliary hint of the window.
244         /// </summary>
245         /// <param name="id">The ID of the auxiliary hint.</param>
246         /// <returns>True if no error occurred, false otherwise.</returns>
247         /// <since_tizen> 3 </since_tizen>
248         public bool RemoveAuxiliaryHint(uint id) {
249             bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
250             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251             return ret;
252         }
253
254         /// <summary>
255         /// Changes a value of the auxiliary hint.
256         /// </summary>
257         /// <param name="id">The auxiliary hint ID.</param>
258         /// <param name="value">The value string to be set.</param>
259         /// <returns>True if no error occurred, false otherwise.</returns>
260         /// <since_tizen> 3 </since_tizen>
261         public bool SetAuxiliaryHintValue(uint id, string value) {
262             bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
263             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
264             return ret;
265         }
266
267         /// <summary>
268         /// Gets a value of the auxiliary hint.
269         /// </summary>
270         /// <param name="id">The auxiliary hint ID.</param>
271         /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
272         /// <since_tizen> 3 </since_tizen>
273         public string GetAuxiliaryHintValue(uint id) {
274             string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
275             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276             return ret;
277         }
278
279         /// <summary>
280         /// Gets an ID of the auxiliary hint string.
281         /// </summary>
282         /// <param name="hint">The auxiliary hint string.</param>
283         /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
284         /// <since_tizen> 3 </since_tizen>
285         public uint GetAuxiliaryHintId(string hint) {
286             uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
287             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288             return ret;
289         }
290
291         /// <summary>
292         /// Sets a region to accept input events.
293         /// </summary>
294         /// <param name="inputRegion">The region to accept input events.</param>
295         /// <since_tizen> 3 </since_tizen>
296         public void SetInputRegion(Rectangle inputRegion) {
297             NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
298             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
299         }
300
301         /// <summary>
302         /// Gets or sets a window type.
303         /// </summary>
304         /// <since_tizen> 3 </since_tizen>
305         public WindowType Type
306         {
307             get
308             {
309                 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
310                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
311                 return ret;
312             }
313             set
314             {
315                 NDalicPINVOKE.SetType(swigCPtr, (int)value);
316                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317             }
318         }
319
320         /// <summary>
321         /// Sets a priority level for the specified notification window.
322         /// </summary>
323         /// <param name="level">The notification window level.</param>
324         /// <returns>True if no error occurred, false otherwise.</returns>
325         /// <since_tizen> 3 </since_tizen>
326         public bool SetNotificationLevel(NotificationLevel level) {
327             bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
328             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
329             return ret;
330         }
331
332         /// <summary>
333         /// Gets a priority level for the specified notification window.
334         /// </summary>
335         /// <returns>The notification window level.</returns>
336         /// <since_tizen> 3 </since_tizen>
337         public NotificationLevel GetNotificationLevel() {
338             NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
339             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340             return ret;
341         }
342
343         /// <summary>
344         /// Sets a transparent window's visual state to opaque.
345         /// </summary>
346         /// <param name="opaque">Whether the window's visual state is opaque.</param>
347         /// <since_tizen> 3 </since_tizen>
348         public void SetOpaqueState(bool opaque) {
349             NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
350             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
351         }
352
353         /// <summary>
354         /// Returns whether a transparent window's visual state is opaque or not.
355         /// </summary>
356         /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
357         /// <since_tizen> 3 </since_tizen>
358         public bool IsOpaqueState() {
359             bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
360             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361             return ret;
362         }
363
364         /// <summary>
365         /// Sets a window's screen mode.
366         /// </summary>
367         /// <param name="screenMode">The screen mode.</param>
368         /// <returns>True if no error occurred, false otherwise.</returns>
369         /// <since_tizen> 3 </since_tizen>
370         public bool SetScreenMode(ScreenMode screenMode) {
371             bool ret = NDalicPINVOKE.SetScreenMode(swigCPtr, (int)screenMode);
372             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
373             return ret;
374         }
375
376         /// <summary>
377         /// Gets the screen mode of the window.
378         /// </summary>
379         /// <returns>The screen mode.</returns>
380         /// <since_tizen> 3 </since_tizen>
381         public ScreenMode GetScreenMode() {
382             ScreenMode ret = (ScreenMode)NDalicPINVOKE.GetScreenMode(swigCPtr);
383             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
384             return ret;
385         }
386
387         /// <summary>
388         /// Sets preferred brightness of the window.
389         /// </summary>
390         /// <param name="brightness">The preferred brightness (0 to 100).</param>
391         /// <returns>True if no error occurred, false otherwise.</returns>
392         /// <since_tizen> 3 </since_tizen>
393         public bool SetBrightness(int brightness) {
394             bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
395             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
396             return ret;
397         }
398
399         /// <summary>
400         /// Gets the preferred brightness of the window.
401         /// </summary>
402         /// <returns>The preferred brightness.</returns>
403         /// <since_tizen> 3 </since_tizen>
404         public int GetBrightness() {
405             int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
406             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
407             return ret;
408         }
409
410         /// <summary>
411         /// The focus changed event argument.
412         /// </summary>
413         public class FocusChangedEventArgs : EventArgs
414         {
415             /// <summary>
416             /// FocusGained flag.
417             /// </summary>
418             /// <since_tizen> 3 </since_tizen>
419             public bool FocusGained
420             {
421                 get;
422                 set;
423             }
424         }
425
426         private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
427         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
428         private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
429         private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
430
431         /// <summary>
432         /// FocusChanged event.
433         /// </summary>
434         /// <since_tizen> 4 </since_tizen>
435         public event EventHandler<FocusChangedEventArgs> FocusChanged
436         {
437             add
438             {
439                 if (_windowFocusChangedEventHandler == null)
440                 {
441                     _windowFocusChangedEventCallback = OnWindowFocusedChanged;
442                     WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
443                 }
444
445                 _windowFocusChangedEventHandler += value;
446             }
447             remove
448             {
449                 _windowFocusChangedEventHandler -= value;
450
451                 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
452                 {
453                     WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
454                 }
455             }
456         }
457
458         private void OnWindowFocusedChanged(bool focusGained)
459         {
460             FocusChangedEventArgs e = new FocusChangedEventArgs();
461
462             e.FocusGained = focusGained;
463
464             if (_windowFocusChangedEventHandler != null)
465             {
466                 _windowFocusChangedEventHandler(this, e);
467             }
468         }
469
470         /// <summary>
471         /// Gets/Sets a window title.
472         /// </summary>
473         /// <since_tizen> 4 </since_tizen>
474         public string Title
475         {
476             get
477             {
478                 return _windowTitle;
479             }
480             set
481             {
482                 _windowTitle = value;
483                 SetClass( _windowTitle, "" );
484             }
485         }
486
487         internal WindowFocusSignalType WindowFocusChangedSignal()
488         {
489             WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
490             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
491             return ret;
492         }
493
494         internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
495         {
496             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
497         }
498
499         internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
500         {
501             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
502         }
503
504         internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
505         {
506             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
507         }
508
509         internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
510         {
511             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
512         }
513
514         internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
515         {
516             NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
517             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
518         }
519
520         internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
521         {
522             NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
523             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
524         }
525
526         internal void RotateIndicator(Window.WindowOrientation orientation)
527         {
528             NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
529             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530         }
531
532         /// <summary>
533         /// Sets the window name and the class string.
534         /// </summary>
535         /// <param name="name">The name of the window.</param>
536         /// <param name="klass">The class of the window.</param>
537         /// <since_tizen> 4 </since_tizen>
538         public void SetClass(string name, string klass)
539         {
540             NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
541             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542         }
543
544         /// <summary>
545         /// Raises the window to the top of the window stack.
546         /// </summary>
547         /// <since_tizen> 3 </since_tizen>
548         public void Raise()
549         {
550             NDalicPINVOKE.Window_Raise(swigCPtr);
551             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
552         }
553
554         /// <summary>
555         /// Lowers the window to the bottom of the window stack.
556         /// </summary>
557         /// <since_tizen> 3 </since_tizen>
558         public void Lower()
559         {
560             NDalicPINVOKE.Window_Lower(swigCPtr);
561             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
562         }
563
564         /// <summary>
565         /// Activates the window to the top of the window stack even it is iconified.
566         /// </summary>
567         /// <since_tizen> 3 </since_tizen>
568         public void Activate()
569         {
570             NDalicPINVOKE.Window_Activate(swigCPtr);
571             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572         }
573
574         internal void AddAvailableOrientation(Window.WindowOrientation orientation)
575         {
576             NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
577             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
578         }
579
580         internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
581         {
582             NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
583             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
584         }
585
586         internal void SetPreferredOrientation(Window.WindowOrientation orientation)
587         {
588             NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
589             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590         }
591
592         internal Window.WindowOrientation GetPreferredOrientation()
593         {
594             Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
595             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
596             return ret;
597         }
598
599         internal DragAndDropDetector GetDragAndDropDetector()
600         {
601             DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
602             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
603             return ret;
604         }
605
606         internal Any GetNativeHandle()
607         {
608             Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
609             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
610             return ret;
611         }
612
613         internal WindowFocusSignalType FocusChangedSignal()
614         {
615             WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
616             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
617             return ret;
618         }
619
620         /// <summary>
621         /// Gets the default ( root ) layer.
622         /// </summary>
623         /// <returns>The root layer.</returns>
624         /// <since_tizen> 3 </since_tizen>
625         public Layer GetDefaultLayer()
626         {
627             return this.GetRootLayer();
628         }
629
630         internal void Add(Layer layer)
631         {
632             NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
633             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
634         }
635
636         internal void Remove(Layer layer)
637         {
638             NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
639             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
640         }
641
642         /// <summary>
643         /// Add a child view to window.
644         /// </summary>
645         /// <param name="view">the child should be added to the window.</param>
646         /// <since_tizen> 3 </since_tizen>
647         public void Add(View view)
648         {
649             NDalicPINVOKE.Stage_Add(stageCPtr, View.getCPtr(view));
650             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
651         }
652
653         /// <summary>
654         /// Remove a child view from window.
655         /// </summary>
656         /// <param name="view">the child to be removed.</param>
657         /// <since_tizen> 3 </since_tizen>
658         public void Remove(View view)
659         {
660             NDalicPINVOKE.Stage_Remove(stageCPtr, View.getCPtr(view));
661             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
662         }
663
664         internal Vector2 GetSize()
665         {
666             Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
667             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
668             return ret;
669         }
670
671         internal RenderTaskList GetRenderTaskList()
672         {
673             RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
674             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
675             return ret;
676         }
677
678         /// <summary>
679         /// Queries the number of on-window layers.
680         /// </summary>
681         /// <returns>The number of layers.</returns>
682         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
683         internal uint GetLayerCount()
684         {
685             uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr);
686             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
687             return ret;
688         }
689
690         /// <summary>
691         /// Retrieves the layer at a specified depth.
692         /// </summary>
693         /// <param name="depth">The layer's depth index.</param>
694         /// <returns>The layer found at the given depth.</returns>
695         /// <since_tizen> 3 </since_tizen>
696         public Layer GetLayer(uint depth)
697         {
698             IntPtr cPtr = NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth);
699             Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer;
700
701             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
702             return ret;
703         }
704
705         internal Layer GetRootLayer()
706         {
707             if (_rootLayer == null)
708                 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
709
710
711             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
712             return _rootLayer;
713         }
714
715         internal void SetBackgroundColor(Vector4 color)
716         {
717             NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
718             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
719         }
720
721         internal Vector4 GetBackgroundColor()
722         {
723             Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
724             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725             return ret;
726         }
727
728         internal Vector2 GetDpi()
729         {
730             Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
731             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
732             return ret;
733         }
734
735         internal ObjectRegistry GetObjectRegistry()
736         {
737             ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
738             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
739             return ret;
740         }
741
742         /// <summary>
743         /// Keep rendering for at least the given amount of time.
744         /// </summary>
745         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
746         /// <since_tizen> 3 </since_tizen>
747         public void KeepRendering(float durationSeconds)
748         {
749             NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
750             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751         }
752
753         internal KeyEventSignal KeyEventSignal()
754         {
755             KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
756             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
757             return ret;
758         }
759
760         internal VoidSignal EventProcessingFinishedSignal()
761         {
762             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
763             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764             return ret;
765         }
766
767         internal TouchSignal TouchSignal()
768         {
769             TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
770             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
771             return ret;
772         }
773
774         private StageWheelSignal WheelEventSignal()
775         {
776             StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
777             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778             return ret;
779         }
780
781         internal VoidSignal ContextLostSignal()
782         {
783             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
784             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
785             return ret;
786         }
787
788         internal VoidSignal ContextRegainedSignal()
789         {
790             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
791             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
792             return ret;
793         }
794
795         internal VoidSignal SceneCreatedSignal()
796         {
797             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
798             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
799             return ret;
800         }
801
802         internal ResizedSignal ResizedSignal()
803         {
804             ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
805             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
806             return ret;
807         }
808
809         internal static Vector4 DEFAULT_BACKGROUND_COLOR
810         {
811             get
812             {
813                 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
814                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
815                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
816                 return ret;
817             }
818         }
819
820         internal static Vector4 DEBUG_BACKGROUND_COLOR
821         {
822             get
823             {
824                 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
825                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
826                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
827                 return ret;
828             }
829         }
830
831         private static readonly Window instance = Application.Instance.GetWindow();
832
833         /// <summary>
834         /// The stage instance property (read-only).<br />
835         /// Gets the current window.<br />
836         /// </summary>
837         /// <since_tizen> 3 </since_tizen>
838         public static Window Instance
839         {
840             get
841             {
842                 return instance;
843             }
844         }
845
846         /// <summary>
847         /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
848         /// This function can be used for following example scenarios: <br />
849         /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
850         /// </summary>
851         /// <param name="DaliKey">The key code to grab.</param>
852         /// <returns>True if the grab succeeds.</returns>
853         /// <since_tizen> 3 </since_tizen>
854         public bool GrabKeyTopmost(int DaliKey)
855         {
856             bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
857             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
858             return ret;
859         }
860
861         /// <summary>
862         /// Ungrabs the key specified by a key for the window.<br />
863         /// 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 />
864         /// </summary>
865         /// <param name="DaliKey">The key code to ungrab.</param>
866         /// <returns>True if the ungrab succeeds.</returns>
867         /// <since_tizen> 3 </since_tizen>
868         public bool UngrabKeyTopmost(int DaliKey)
869         {
870             bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
871             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
872             return ret;
873         }
874
875         /// <summary>
876         ///  Grabs the key specified by a key for a window in a GrabMode. <br />
877         ///  Details: This function can be used for following example scenarios: <br />
878         ///  - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
879         ///  - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
880         ///  - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
881         /// </summary>
882         /// <param name="DaliKey">The key code to grab.</param>
883         /// <param name="GrabMode">The grab mode for the key.</param>
884         /// <returns>True if the grab succeeds.</returns>
885         /// <since_tizen> 3 </since_tizen>
886         public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
887         {
888             bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
889             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
890             return ret;
891         }
892
893         /// <summary>
894         /// Ungrabs the key specified by a key for a window.<br />
895         /// 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 />
896         /// </summary>
897         /// <param name="DaliKey">The key code to ungrab.</param>
898         /// <returns>True if the ungrab succeeds.</returns>
899         /// <since_tizen> 3 </since_tizen>
900         public bool UngrabKey(int DaliKey)
901         {
902             bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
903             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
904             return ret;
905         }
906
907         internal System.IntPtr GetNativeWindowHandler()
908         {
909             System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
910             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
911             return ret;
912         }
913
914         /// <summary>
915         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
916         /// </summary>
917         /// <since_tizen> 3 </since_tizen>
918         public enum WindowOrientation
919         {
920             /// <summary>
921             /// Portrait orientation. The height of the display area is greater than the width.
922             /// </summary>
923             /// <since_tizen> 3 </since_tizen>
924             Portrait = 0,
925             /// <summary>
926             /// Landscape orientation. A wide view area is needed.
927             /// </summary>
928             /// <since_tizen> 3 </since_tizen>
929             Landscape = 90,
930             /// <summary>
931             /// Portrait inverse orientation.
932             /// </summary>
933             /// <since_tizen> 3 </since_tizen>
934             PortraitInverse = 180,
935             /// <summary>
936             /// Landscape inverse orientation.
937             /// </summary>
938             /// <since_tizen> 3 </since_tizen>
939             LandscapeInverse = 270
940         }
941
942         /// <summary>
943         /// Enumeration for the key grab mode for platform-level APIs.
944         /// </summary>
945         /// <since_tizen> 3 </since_tizen>
946         public enum KeyGrabMode
947         {
948             /// <summary>
949             /// Grabs a key only when on the top of the grabbing-window stack mode.
950             /// </summary>
951             Topmost = 0,
952             /// <summary>
953             /// Grabs a key together with the other client window(s) mode.
954             /// </summary>
955             Shared,
956             /// <summary>
957             /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack with the possibility of overriding the grab by the other client window mode.
958             /// </summary>
959             OverrideExclusive,
960             /// <summary>
961             /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
962             /// </summary>
963             Exclusive
964         };
965
966         /// <summary>
967         /// Enumeration for opacity of the indicator.
968         /// </summary>
969         internal enum IndicatorBackgroundOpacity
970         {
971             Opaque = 100,
972             Translucent = 50,
973             Transparent = 0
974         }
975
976         /// <summary>
977         /// Enumeration for visible mode of the indicator.
978         /// </summary>
979         internal enum IndicatorVisibleMode
980         {
981             Invisible = 0,
982             Visible = 1,
983             Auto = 2
984         }
985
986         /// <summary>
987         /// The touch event argument.
988         /// </summary>
989         public class TouchEventArgs : EventArgs
990         {
991             private Touch _touch;
992
993             /// <summary>
994             /// Touch.
995             /// </summary>
996             /// <since_tizen> 3 </since_tizen>
997             public Touch Touch
998             {
999                 get
1000                 {
1001                     return _touch;
1002                 }
1003                 set
1004                 {
1005                     _touch = value;
1006                 }
1007             }
1008         }
1009
1010         private event EventHandler<TouchEventArgs> _stageTouchHandler;
1011         private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
1012
1013         /// <summary>
1014         /// This event is emitted when the screen is touched and when the touch ends.<br />
1015         /// If there are multiple touch points, then this will be emitted when the first touch occurs and
1016         /// then when the last finger is lifted.<br />
1017         /// An interrupted event will also be emitted (if it occurs).<br />
1018         /// </summary>
1019         /// <since_tizen> 4 </since_tizen>
1020         public event EventHandler<TouchEventArgs> TouchEvent
1021         {
1022             add
1023             {
1024                 lock (this)
1025                 {
1026                     _stageTouchHandler += value;
1027                     _stageTouchCallbackDelegate = OnStageTouch;
1028                     this.TouchSignal().Connect(_stageTouchCallbackDelegate);
1029                 }
1030             }
1031             remove
1032             {
1033                 lock (this)
1034                 {
1035                     if (_stageTouchHandler != null)
1036                     {
1037                         this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
1038                     }
1039                     _stageTouchHandler -= value;
1040                 }
1041             }
1042         }
1043
1044         private void OnStageTouch(IntPtr data)
1045         {
1046             TouchEventArgs e = new TouchEventArgs();
1047
1048             if (data != null)
1049             {
1050                 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
1051             }
1052
1053             if (_stageTouchHandler != null)
1054             {
1055                 _stageTouchHandler(this, e);
1056             }
1057         }
1058
1059         /// <summary>
1060         /// Wheel event arguments.
1061         /// </summary>
1062         public class WheelEventArgs : EventArgs
1063         {
1064             private Wheel _wheel;
1065
1066             /// <summary>
1067             /// Wheel.
1068             /// </summary>
1069             /// <since_tizen> 3 </since_tizen>
1070             public Wheel Wheel
1071             {
1072                 get
1073                 {
1074                     return _wheel;
1075                 }
1076                 set
1077                 {
1078                     _wheel = value;
1079                 }
1080             }
1081         }
1082
1083         private event EventHandler<WheelEventArgs> _stageWheelHandler;
1084         private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
1085
1086         /// <summary>
1087         /// This event is emitted when the wheel event is received.
1088         /// </summary>
1089         /// <since_tizen> 4 </since_tizen>
1090         public event EventHandler<WheelEventArgs> WheelEvent
1091         {
1092             add
1093             {
1094                 if (_stageWheelHandler == null)
1095                 {
1096                     _stageWheelCallbackDelegate = OnStageWheel;
1097                     WheelEventSignal().Connect(_stageWheelCallbackDelegate);
1098                 }
1099                 _stageWheelHandler += value;
1100             }
1101             remove
1102             {
1103                 _stageWheelHandler -= value;
1104                 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
1105                 {
1106                     WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
1107                 }
1108             }
1109         }
1110
1111         private void OnStageWheel(IntPtr data)
1112         {
1113             WheelEventArgs e = new WheelEventArgs();
1114
1115             if (data != null)
1116             {
1117                 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
1118             }
1119
1120             if (_stageWheelHandler != null)
1121             {
1122                 _stageWheelHandler(this, e);
1123             }
1124         }
1125
1126         /// <summary>
1127         /// Key event arguments.
1128         /// </summary>
1129         public class KeyEventArgs : EventArgs
1130         {
1131             private Key _key;
1132
1133             /// <summary>
1134             /// Key.
1135             /// </summary>
1136             /// <since_tizen> 3 </since_tizen>
1137             public Key Key
1138             {
1139                 get
1140                 {
1141                     return _key;
1142                 }
1143                 set
1144                 {
1145                     _key = value;
1146                 }
1147             }
1148         }
1149
1150         private event EventHandler<KeyEventArgs> _stageKeyHandler;
1151         private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1152
1153         /// <summary>
1154         /// This event is emitted when the key event is received.
1155         /// </summary>
1156         /// <since_tizen> 4 </since_tizen>
1157         public event EventHandler<KeyEventArgs> KeyEvent
1158         {
1159             add
1160             {
1161                 if (_stageKeyHandler == null)
1162                 {
1163                     _stageKeyCallbackDelegate = OnStageKey;
1164                     KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1165                 }
1166                 _stageKeyHandler += value;
1167             }
1168             remove
1169             {
1170                 _stageKeyHandler -= value;
1171                 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1172                 {
1173                     KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1174                 }
1175             }
1176         }
1177
1178         // Callback for Stage KeyEventsignal
1179         private void OnStageKey(IntPtr data)
1180         {
1181             KeyEventArgs e = new KeyEventArgs();
1182
1183             if (data != null)
1184             {
1185                 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1186             }
1187
1188             if (_stageKeyHandler != null)
1189             {
1190                 //here we send all data to user event handlers
1191                 _stageKeyHandler(this, e);
1192             }
1193         }
1194
1195
1196         private event EventHandler _stageEventProcessingFinishedEventHandler;
1197         private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1198
1199         internal event EventHandler EventProcessingFinished
1200         {
1201             add
1202             {
1203                 if (_stageEventProcessingFinishedEventHandler == null)
1204                 {
1205                     _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1206                     EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1207                 }
1208                 _stageEventProcessingFinishedEventHandler += value;
1209
1210             }
1211             remove
1212             {
1213                 _stageEventProcessingFinishedEventHandler -= value;
1214                 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1215                 {
1216                     EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1217                 }
1218             }
1219         }
1220
1221         // Callback for Stage EventProcessingFinishedSignal
1222         private void OnEventProcessingFinished()
1223         {
1224             if (_stageEventProcessingFinishedEventHandler != null)
1225             {
1226                 _stageEventProcessingFinishedEventHandler(this, null);
1227             }
1228         }
1229
1230
1231         private EventHandler _stageContextLostEventHandler;
1232         private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1233
1234         internal event EventHandler ContextLost
1235         {
1236             add
1237             {
1238                 if (_stageContextLostEventHandler == null)
1239                 {
1240                     _stageContextLostEventCallbackDelegate = OnContextLost;
1241                     ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1242                 }
1243                 _stageContextLostEventHandler += value;
1244             }
1245             remove
1246             {
1247                 _stageContextLostEventHandler -= value;
1248                 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1249                 {
1250                     ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1251                 }
1252             }
1253         }
1254
1255         // Callback for Stage ContextLostSignal
1256         private void OnContextLost()
1257         {
1258             if (_stageContextLostEventHandler != null)
1259             {
1260                 _stageContextLostEventHandler(this, null);
1261             }
1262         }
1263
1264
1265         private EventHandler _stageContextRegainedEventHandler;
1266         private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1267
1268         internal event EventHandler ContextRegained
1269         {
1270             add
1271             {
1272                 if (_stageContextRegainedEventHandler == null)
1273                 {
1274                     _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1275                     ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1276                 }
1277                 _stageContextRegainedEventHandler += value;
1278             }
1279             remove
1280             {
1281                 _stageContextRegainedEventHandler -= value;
1282                 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1283                 {
1284                     this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1285                 }
1286             }
1287         }
1288
1289         // Callback for Stage ContextRegainedSignal
1290         private void OnContextRegained()
1291         {
1292             if (_stageContextRegainedEventHandler != null)
1293             {
1294                 _stageContextRegainedEventHandler(this, null);
1295             }
1296         }
1297
1298
1299         private EventHandler _stageSceneCreatedEventHandler;
1300         private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1301
1302         internal event EventHandler SceneCreated
1303         {
1304             add
1305             {
1306                 if (_stageSceneCreatedEventHandler == null)
1307                 {
1308                     _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1309                     SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1310                 }
1311                 _stageSceneCreatedEventHandler += value;
1312             }
1313             remove
1314             {
1315                 _stageSceneCreatedEventHandler -= value;
1316                 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1317                 {
1318                     SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1319                 }
1320             }
1321         }
1322
1323         // Callback for Stage SceneCreatedSignal
1324         private void OnSceneCreated()
1325         {
1326             if (_stageSceneCreatedEventHandler != null)
1327             {
1328                 _stageSceneCreatedEventHandler(this, null);
1329             }
1330         }
1331
1332         /// <summary>
1333         /// This resized event arguments.
1334         /// </summary>
1335         /// <since_tizen> 4 </since_tizen>
1336         public class ResizedEventArgs : EventArgs
1337         {
1338             Size2D _windowSize;
1339
1340             /// <summary>
1341             /// This window size.
1342             /// </summary>
1343             /// <since_tizen> 4 </since_tizen>
1344             public Size2D WindowSize
1345             {
1346                 get
1347                 {
1348                     return _windowSize;
1349                 }
1350                 set
1351                 {
1352                     _windowSize = value;
1353                 }
1354             }
1355         }
1356
1357         private WindowResizedEventCallbackType _windowResizedEventCallback;
1358         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1359         private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1360         private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1361
1362         /// <summary>
1363         /// This event is emitted when the window resized.
1364         /// </summary>
1365         /// <since_tizen> 4 </since_tizen>
1366         public event EventHandler<ResizedEventArgs> Resized
1367         {
1368             add
1369             {
1370                 if (_windowResizedEventHandler == null)
1371                 {
1372                     _windowResizedEventCallback = OnResized;
1373                     ResizedSignal().Connect(_windowResizedEventCallback);
1374                 }
1375
1376                 _windowResizedEventHandler += value;
1377             }
1378             remove
1379             {
1380                 _windowResizedEventHandler -= value;
1381
1382                 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1383                 {
1384                     ResizedSignal().Disconnect(_windowResizedEventCallback);
1385                 }
1386             }
1387         }
1388
1389         private void OnResized(IntPtr windowSize)
1390         {
1391             ResizedEventArgs e = new ResizedEventArgs();
1392             var val = new Uint16Pair(windowSize, false);
1393             e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1394             val.Dispose();
1395
1396             if (_windowResizedEventHandler != null)
1397             {
1398                 _windowResizedEventHandler(this, e);
1399             }
1400         }
1401
1402         internal void SetWindowSize(Size2D size)
1403         {
1404             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1405             NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1406
1407             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1408         }
1409
1410         internal Size2D GetWindowSize()
1411         {
1412             var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1413             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1414
1415             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1416             return ret;
1417         }
1418
1419         internal void SetPosition(Position2D position)
1420         {
1421             var val = new Uint16Pair( (uint)position.X, (uint)position.Y );
1422             NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1423
1424             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1425         }
1426
1427         internal Position2D GetPosition()
1428         {
1429             var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1430             Position2D ret = new Position2D(val.GetX(), val.GetY());
1431
1432             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1433             return ret;
1434         }
1435
1436         /// <summary>
1437         /// The window size property (read-only).
1438         /// </summary>
1439         /// <since_tizen> 3 </since_tizen>
1440         public Size2D Size
1441         {
1442             get
1443             {
1444                 Size2D ret = GetSize();
1445                 return ret;
1446             }
1447         }
1448
1449         /// <summary>
1450         /// The background color property.
1451         /// </summary>
1452         /// <since_tizen> 3 </since_tizen>
1453         public Color BackgroundColor
1454         {
1455             set
1456             {
1457                 SetBackgroundColor(value);
1458             }
1459             get
1460             {
1461                 Color ret = GetBackgroundColor();
1462                 return ret;
1463             }
1464         }
1465
1466         /// <summary>
1467         /// The DPI property (read-only).<br />
1468         /// Retrieves the DPI of the display device to which the Window is connected.<br />
1469         /// </summary>
1470         /// <since_tizen> 3 </since_tizen>
1471         public Vector2 Dpi
1472         {
1473             get
1474             {
1475                 return GetDpi();
1476             }
1477         }
1478
1479         /// <summary>
1480         /// The layer count property (read-only).<br />
1481         /// Queries the number of on-Window layers.<br />
1482         /// </summary>
1483         /// <since_tizen> 3 </since_tizen>
1484         public uint LayerCount
1485         {
1486             get
1487             {
1488                 return GetLayerCount();
1489             }
1490         }
1491
1492
1493         /// <summary>
1494         /// Adds a layer to the stage.
1495         /// </summary>
1496         /// <param name="layer">Layer to add.</param>
1497         /// <since_tizen> 3 </since_tizen>
1498         public void AddLayer(Layer layer)
1499         {
1500             NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1501             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1502         }
1503
1504         /// <summary>
1505         /// Removes a layer from the stage.
1506         /// </summary>
1507         /// <param name="layer">Layer to remove.</param>
1508         /// <since_tizen> 4 </since_tizen>
1509         public void RemoveLayer(Layer layer)
1510         {
1511             NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1512             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1513         }
1514
1515         /// <summary>
1516         /// Please do not use! this will be deprecated
1517         /// </summary>
1518         /// <since_tizen> 3 </since_tizen>
1519         [EditorBrowsable(EditorBrowsableState.Never)]
1520         public class WindowFocusChangedEventArgs : EventArgs
1521         {
1522             /// <summary>
1523             /// Please do not use! this will be deprecated
1524             /// </summary>
1525             /// <since_tizen> 3 </since_tizen>
1526             public bool FocusGained
1527             {
1528                 get;
1529                 set;
1530             }
1531         }
1532
1533         private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1534         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1535         private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1536         private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1537
1538         /// <summary>
1539         /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1540         /// </summary>
1541         /// <since_tizen> 3 </since_tizen>
1542         [Obsolete("Please do not use! this will be deprecated. Please use 'FocusChanged' event instead")]
1543         public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1544         {
1545             add
1546             {
1547                 if (_windowFocusChangedEventHandler2 == null)
1548                 {
1549                     _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1550                     WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1551                 }
1552
1553                 _windowFocusChangedEventHandler2 += value;
1554             }
1555             remove
1556             {
1557                 _windowFocusChangedEventHandler2 -= value;
1558
1559                 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1560                 {
1561                     WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1562                 }
1563             }
1564         }
1565
1566         private void OnWindowFocusedChanged2(bool focusGained)
1567         {
1568             WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1569
1570             e.FocusGained = focusGained;
1571
1572             if (_windowFocusChangedEventHandler2 != null)
1573             {
1574                 _windowFocusChangedEventHandler2(this, e);
1575             }
1576         }
1577
1578         /// <summary>
1579         /// Gets or sets a size of the window.
1580         /// </summary>
1581         /// <since_tizen> 4 </since_tizen>
1582         public Size2D WindowSize
1583         {
1584             get
1585             {
1586                 return GetWindowSize();
1587             }
1588             set
1589             {
1590                 SetWindowSize(value);
1591             }
1592         }
1593
1594         /// <summary>
1595         /// Gets or sets a position of the window.
1596         /// </summary>
1597         /// <since_tizen> 4 </since_tizen>
1598         public Position2D WindowPosition
1599         {
1600             get
1601             {
1602                 return GetPosition();
1603             }
1604             set
1605             {
1606                 SetPosition(value);
1607             }
1608         }
1609
1610         /// <summary>
1611         /// Feed a key-event into the window.
1612         /// </summary>
1613         /// <since_tizen> 4 </since_tizen>
1614         public static void FeedKeyEvent(Key keyEvent)
1615         {
1616             NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1617             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1618         }
1619
1620         /// <summary>
1621         /// Allows at least one more render, even when paused.
1622         /// The window should be shown, not minimised.
1623         /// </summary>
1624         /// <since_tizen> 4 </since_tizen>
1625         public void RenderOnce()
1626         {
1627             NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1628             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1629         }
1630
1631     }
1632 }