Merge "Line wrap mode property is added." into devel/master
[platform/core/uifw/dali-toolkit.git] / plugins / dali-sharp / sharp / public / Window.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.10
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Dali {
28
29     using System;
30     using System.Runtime.InteropServices;
31
32 public class Window : BaseHandle {
33   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
34   private global::System.Runtime.InteropServices.HandleRef stageCPtr;
35
36   internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn) {
37     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
38     stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
39   }
40
41   internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj) {
42     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
43   }
44
45   ~Window() {
46     DisposeQueue.Instance.Add(this);
47   }
48
49   public override void Dispose() {
50     if (!Window.IsInstalled()) {
51       DisposeQueue.Instance.Add(this);
52       return;
53     }
54
55     lock(this) {
56       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
57         if (swigCMemOwn) {
58           swigCMemOwn = false;
59           NDalicPINVOKE.delete_Window(swigCPtr);
60           NDalicPINVOKE.delete_Stage(stageCPtr);
61         }
62         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
63       }
64       global::System.GC.SuppressFinalize(this);
65       base.Dispose();
66     }
67   }
68
69
70   public static bool IsInstalled() {
71     bool ret = NDalicPINVOKE.Stage_IsInstalled();
72     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
73     return ret;
74   }
75     internal void SetAcceptFocus( bool accept )
76     {
77       NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
78       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79     }
80
81     internal bool IsFocusAcceptable()
82     {
83       return NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
84       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85     }
86
87     public void Show()
88     {
89       NDalicPINVOKE.Show(swigCPtr);
90       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91     }
92
93     public void Hide()
94     {
95       NDalicPINVOKE.Hide(swigCPtr);
96       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97     }
98
99     public void IsVisible()
100     {
101       NDalicPINVOKE.IsVisible(swigCPtr);
102       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103     }
104
105     public class WindowFocusChangedEventArgs : EventArgs
106     {
107         public bool FocusGained
108         {
109             get;
110             set;
111         }
112     }
113
114     private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
115     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
116     private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
117     private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler;
118
119     public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
120     {
121         add
122         {
123             if (_windowFocusChangedEventHandler == null)
124             {
125                 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
126                 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
127             }
128
129             _windowFocusChangedEventHandler += value;
130         }
131         remove
132         {
133             _windowFocusChangedEventHandler -= value;
134
135             if (_windowFocusChangedEventHandler == null && _windowFocusChangedEventCallback != null)
136             {
137                 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
138             }
139         }
140     }
141
142     private void OnWindowFocusedChanged(bool focusGained)
143     {
144         WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
145
146         e.FocusGained = focusGained;
147
148         if (_windowFocusChangedEventHandler != null)
149         {
150             _windowFocusChangedEventHandler(this, e);
151         }
152     }
153
154     internal WindowFocusSignalType WindowFocusChangedSignal() {
155       WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
156       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157       return ret;
158     }
159
160
161   public Window (Rectangle windowPosition, string name, bool isTransparent) : this (NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true) {
162       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163
164   }
165   public Window (Rectangle windowPosition, string name) : this (NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true) {
166       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167
168   }
169
170   public Window(Window handle) : this(NDalicPINVOKE.new_Window__SWIG_1(Window.getCPtr(handle)), true) {
171     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172   }
173
174   public Window Assign(Window rhs) {
175     Window ret = new Window(NDalicPINVOKE.Window_Assign(swigCPtr, Window.getCPtr(rhs)), false);
176     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177     return ret;
178   }
179
180   public void ShowIndicator(Window.IndicatorVisibleMode visibleMode) {
181     NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
182     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183   }
184
185   public void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity) {
186     NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
187     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188   }
189
190   public void RotateIndicator(Window.WindowOrientation orientation) {
191     NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
192     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193   }
194
195   public void SetClass(string name, string klass) {
196     NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
197     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198   }
199
200   public void Raise() {
201     NDalicPINVOKE.Window_Raise(swigCPtr);
202     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203   }
204
205   public void Lower() {
206     NDalicPINVOKE.Window_Lower(swigCPtr);
207     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208   }
209
210   public void Activate() {
211     NDalicPINVOKE.Window_Activate(swigCPtr);
212     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213   }
214
215   internal void AddAvailableOrientation(Window.WindowOrientation orientation) {
216     NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
217     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218   }
219
220   internal void RemoveAvailableOrientation(Window.WindowOrientation orientation) {
221     NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
222     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
223   }
224
225   internal void SetPreferredOrientation(Window.WindowOrientation orientation) {
226     NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
227     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228   }
229
230   internal Window.WindowOrientation GetPreferredOrientation() {
231     Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
232     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233     return ret;
234   }
235
236   internal DragAndDropDetector GetDragAndDropDetector() {
237     DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
238     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239     return ret;
240   }
241
242   internal Any GetNativeHandle() {
243     Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
244     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245     return ret;
246   }
247
248   internal WindowFocusSignalType FocusChangedSignal() {
249     WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
250     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
251     return ret;
252   }
253
254   public Layer GetDefaultLayer()
255   {
256     return this.GetRootLayer();
257   }
258
259   public void Add(Layer layer)
260   {
261     NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
262     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263   }
264
265   public void Remove(Layer layer)
266   {
267     NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
268     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269   }
270
271   public void Add(View view) {
272     NDalicPINVOKE.Stage_Add(stageCPtr, View.getCPtr(view));
273     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
274   }
275
276   public void Remove(View view) {
277     NDalicPINVOKE.Stage_Remove(stageCPtr, View.getCPtr(view));
278     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279   }
280
281   public Vector2 GetSize() {
282     Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
283     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284     return ret;
285   }
286
287   internal RenderTaskList GetRenderTaskList() {
288     RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
289     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290     return ret;
291   }
292
293   public uint GetLayerCount() {
294     uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr);
295     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296     return ret;
297   }
298
299   public Layer GetLayer(uint depth) {
300     Layer ret = new Layer(NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth), true);
301     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
302     return ret;
303   }
304
305   public Layer GetRootLayer() {
306     Layer ret = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
307     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
308     return ret;
309   }
310
311   public void SetBackgroundColor(Vector4 color) {
312     NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
313     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
314   }
315
316   public Vector4 GetBackgroundColor() {
317     Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
318     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
319     return ret;
320   }
321
322   public Vector2 GetDpi() {
323     Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
324     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325     return ret;
326   }
327
328   internal ObjectRegistry GetObjectRegistry() {
329     ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
330     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331     return ret;
332   }
333
334   public void KeepRendering(float durationSeconds) {
335     NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
336     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
337   }
338
339   internal KeyEventSignal KeyEventSignal() {
340     KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
341     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342     return ret;
343   }
344
345   internal VoidSignal EventProcessingFinishedSignal() {
346     VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
347     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
348     return ret;
349   }
350
351   internal TouchSignal TouchSignal() {
352     TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
353     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
354     return ret;
355   }
356
357   internal StageWheelSignal WheelEventSignal() {
358     StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
359     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
360     return ret;
361   }
362
363   internal VoidSignal ContextLostSignal() {
364     VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
365     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
366     return ret;
367   }
368
369   internal VoidSignal ContextRegainedSignal() {
370     VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
371     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
372     return ret;
373   }
374
375   internal VoidSignal SceneCreatedSignal() {
376     VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
377     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
378     return ret;
379   }
380
381   internal static Vector4 DEFAULT_BACKGROUND_COLOR {
382     get {
383       global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
384       Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
385       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
386       return ret;
387     }
388   }
389
390   internal static Vector4 DEBUG_BACKGROUND_COLOR {
391     get {
392       global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
393       Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
394       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
395       return ret;
396     }
397   }
398
399   private static readonly Window instance = Application.Instance.GetWindow();
400   public static Window Instance
401   {
402     get
403     {
404       return instance;
405     }
406   }
407
408   public enum WindowOrientation {
409     PORTRAIT = 0,
410     LANDSCAPE = 90,
411     PORTRAIT_INVERSE = 180,
412     LANDSCAPE_INVERSE = 270
413   }
414
415   public enum IndicatorBackgroundOpacity {
416     OPAQUE = 100,
417     TRANSLUCENT = 50,
418     TRANSPARENT = 0
419   }
420
421   public enum IndicatorVisibleMode {
422     INVISIBLE = 0,
423     VISIBLE = 1,
424     AUTO = 2
425   }
426
427
428
429   /**
430     * @brief Event arguments that passed via Touch signal
431     *
432     */
433   public class TouchEventArgs : EventArgs
434   {
435      private Touch _touch;
436
437      /**
438        * @brief Touch - contains the information of touch points
439        *
440        */
441      public Touch Touch
442      {
443         get
444         {
445            return _touch;
446         }
447         set
448         {
449            _touch = value;
450         }
451      }
452   }
453
454   private event EventHandler<TouchEventArgs> _stageTouchHandler;
455   private EventCallbackDelegateType1<IntPtr> _stageTouchCallbackDelegate;
456
457   /**
458     * @brief Event for TouchEvent signal which can be used to subscribe/unsubscribe the event handler
459     * TouchEvent signal is emitted when the screen is touched and when the touch ends
460     * (i.e. the down & up touch events only).
461     *
462     */
463   public event EventHandler<TouchEventArgs> Touched
464   {
465      add
466      {
467         lock(this)
468         {
469           _stageTouchHandler += value;
470           _stageTouchCallbackDelegate = OnStageTouch;
471           this.TouchSignal().Connect(_stageTouchCallbackDelegate);
472         }
473      }
474      remove
475      {
476         lock(this)
477         {
478            if (_stageTouchHandler != null)
479            {
480               this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
481            }
482            _stageTouchHandler -= value;
483         }
484      }
485   }
486
487   private void OnStageTouch(IntPtr data)
488   {
489     TouchEventArgs e = new TouchEventArgs();
490
491     if( data != null )
492     {
493       e.Touch = Dali.Touch.GetTouchFromPtr( data );
494     }
495
496     if (_stageTouchHandler != null)
497     {
498       _stageTouchHandler(this, e);
499     }
500   }
501
502   /**
503     * @brief Wheel arguments that passed via Wheel signal
504     *
505     */
506   public class WheelEventArgs : EventArgs
507   {
508      private Wheel _wheel;
509
510      /**
511        * @brief Wheel - store a wheel rolling type MOUSE_WHEEL or CUSTOM_WHEEL
512        *
513        */
514      public Wheel Wheel
515      {
516         get
517         {
518            return _wheel;
519         }
520         set
521         {
522            _wheel = value;
523         }
524      }
525   }
526
527   private event EventHandler<WheelEventArgs> _stageWheelHandler;
528   private EventCallbackDelegateType1<IntPtr> _stageWheelCallbackDelegate;
529
530   /**
531     * @brief Event for Wheel signal which can be used to subscribe/unsubscribe the event handler
532     * Wheel signal is emitted is emitted when wheel event is received.
533     *
534     */
535   public event EventHandler<WheelEventArgs> WheelRolled
536   {
537      add
538      {
539         lock(this)
540         {
541           _stageWheelHandler += value;
542           _stageWheelCallbackDelegate = OnStageWheel;
543           this.WheelEventSignal().Connect(_stageWheelCallbackDelegate);
544         }
545      }
546      remove
547      {
548         lock(this)
549         {
550            if (_stageWheelHandler != null)
551            {
552               this.WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
553            }
554            _stageWheelHandler -= value;
555         }
556      }
557   }
558
559   private void OnStageWheel(IntPtr data)
560   {
561     WheelEventArgs e = new WheelEventArgs();
562
563     if( data != null )
564     {
565       e.Wheel = Dali.Wheel.GetWheelFromPtr( data );
566     }
567
568     if (_stageWheelHandler != null)
569     {
570       _stageWheelHandler(this, e);
571     }
572   }
573
574   /**
575     * @brief Event arguments that passed via Key signal
576     *
577     */
578   public class KeyEventArgs : EventArgs
579   {
580      private Key _key;
581
582      /**
583        * @brief Key - is the keyevent sent to Stage.
584        *
585        */
586      public Key Key
587      {
588         get
589         {
590            return _key;
591         }
592         set
593         {
594            _key = value;
595         }
596      }
597   }
598
599   private event EventHandler<KeyEventArgs> _stageKeyHandler;
600   private EventCallbackDelegateType1<IntPtr> _stageKeyCallbackDelegate;
601
602   /**
603     * @brief Event for Key signal which can be used to subscribe/unsubscribe the event handler
604     * Key signal is emitted is emitted when key event is received.
605     *
606     */
607   public event EventHandler<KeyEventArgs> Key
608   {
609      add
610      {
611         lock(this)
612         {
613             _stageKeyHandler += value;
614             _stageKeyCallbackDelegate = OnStageKey;
615             this.KeyEventSignal().Connect(_stageKeyCallbackDelegate);
616         }
617      }
618      remove
619      {
620         lock(this)
621         {
622            if (_stageKeyHandler != null)
623            {
624               this.KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
625            }
626            _stageKeyHandler -= value;
627         }
628      }
629   }
630
631   // Callback for Stage KeyEventsignal
632   private void OnStageKey(IntPtr data)
633   {
634     KeyEventArgs e = new KeyEventArgs();
635
636     if( data != null )
637     {
638       e.Key = Dali.Key.GetKeyFromPtr( data );
639     }
640
641     if (_stageKeyHandler != null)
642     {
643       //here we send all data to user event handlers
644       _stageKeyHandler(this, e);
645     }
646   }
647
648
649   private event EventHandler _stageEventProcessingFinishedEventHandler;
650   private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
651
652   /**
653     * @brief Event for EventProcessingFinished signal which can be used to subscribe/unsubscribe the event handler
654     * provided by the user. EventProcessingFinished signal is emitted just after the event processing is finished.
655     *
656     */
657   internal event EventHandler EventProcessingFinished
658   {
659      add
660      {
661         lock(this)
662         {
663           _stageEventProcessingFinishedEventHandler += value;
664           _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
665           this.EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
666         }
667      }
668      remove
669      {
670         lock(this)
671         {
672            if (_stageEventProcessingFinishedEventHandler != null)
673            {
674               this.EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
675            }
676            _stageEventProcessingFinishedEventHandler -= value;
677         }
678      }
679   }
680
681   // Callback for Stage EventProcessingFinishedSignal
682   private void OnEventProcessingFinished()
683   {
684      if (_stageEventProcessingFinishedEventHandler != null)
685      {
686         _stageEventProcessingFinishedEventHandler(this, null);
687      }
688   }
689
690
691   private EventHandler _stageContextLostEventHandler;
692   private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
693
694   /**
695     * @brief Event for ContextLost signal which can be used to subscribe/unsubscribe the event handler
696     * ContextLost signal is emitted when the GL context is lost (Platform specific behaviour).
697     *
698     */
699   internal event EventHandler ContextLost
700   {
701      add
702      {
703         lock(this)
704         {
705             _stageContextLostEventHandler += value;
706             _stageContextLostEventCallbackDelegate = OnContextLost;
707             this.ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
708         }
709      }
710      remove
711      {
712         lock(this)
713         {
714            if (_stageContextLostEventHandler != null)
715            {
716               this.ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
717            }
718
719            _stageContextLostEventHandler -= value;
720         }
721      }
722   }
723
724   // Callback for Stage ContextLostSignal
725   private void OnContextLost()
726   {
727      if (_stageContextLostEventHandler != null)
728      {
729         _stageContextLostEventHandler(this, null);
730      }
731   }
732
733
734   private EventHandler _stageContextRegainedEventHandler;
735   private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
736
737   /**
738     * @brief Event for ContextRegained signal which can be used to subscribe/unsubscribe the event handler
739     * provided by the user. ContextRegained signal is emitted when the GL context is regained (Platform specific
740     * behaviour).
741     *
742     */
743   internal event EventHandler ContextRegained
744   {
745      add
746      {
747         lock(this)
748         {
749             _stageContextRegainedEventHandler += value;
750             _stageContextRegainedEventCallbackDelegate = OnContextRegained;
751             this.ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
752         }
753      }
754      remove
755      {
756         lock(this)
757         {
758            if (_stageContextRegainedEventHandler != null)
759            {
760               this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
761            }
762
763            _stageContextRegainedEventHandler -= value;
764         }
765      }
766   }
767
768   // Callback for Stage ContextRegainedSignal
769   private void OnContextRegained()
770   {
771      if (_stageContextRegainedEventHandler != null)
772      {
773         _stageContextRegainedEventHandler(this, null);
774      }
775   }
776
777
778   private EventHandler _stageSceneCreatedEventHandler;
779   private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
780
781   /**
782     * @brief Event for SceneCreated signal which can be used to subscribe/unsubscribe the event handler
783     * SceneCreated signal is emitted after the initial scene is created.
784     *
785     */
786   internal event EventHandler SceneCreated
787   {
788      add
789      {
790         lock(this)
791         {
792             _stageSceneCreatedEventHandler += value;
793             _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
794             this.SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
795         }
796      }
797      remove
798      {
799         lock(this)
800         {
801            if (_stageSceneCreatedEventHandler != null)
802            {
803               this.SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
804            }
805
806            _stageSceneCreatedEventHandler -= value;
807         }
808      }
809   }
810
811   // Callback for Stage SceneCreatedSignal
812   private void OnSceneCreated()
813   {
814      if (_stageSceneCreatedEventHandler != null)
815      {
816         _stageSceneCreatedEventHandler(this, null);
817      }
818   }
819
820
821   public Vector2 Size
822   {
823      get
824      {
825         Vector2 ret = GetSize();
826         return ret;
827      }
828   }
829
830   public Vector4 BackgroundColor
831   {
832      set
833      {
834         SetBackgroundColor(value);
835      }
836      get
837      {
838         Vector4 ret = GetBackgroundColor();
839         return ret;
840      }
841    }
842
843 }
844
845 }