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