Combined Stage and Window class, and removed Stage class
[platform/core/uifw/dali-toolkit.git] / plugins / dali-sharp / sharp / internal / 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     public void SetAcceptFocus( bool accept )
76     {
77       NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
78       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79     }
80
81     public 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     public 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   public Window (Rectangle windowPosition, string name, string className, bool isTransparent) : this (NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true) {
170       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171
172   }
173   public Window (Rectangle windowPosition, string name, string className) : this (NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true) {
174       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175
176   }
177   public Window(Window handle) : this(NDalicPINVOKE.new_Window__SWIG_1(Window.getCPtr(handle)), true) {
178     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179   }
180
181   public Window Assign(Window rhs) {
182     Window ret = new Window(NDalicPINVOKE.Window_Assign(swigCPtr, Window.getCPtr(rhs)), false);
183     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184     return ret;
185   }
186
187   public void ShowIndicator(Window.IndicatorVisibleMode visibleMode) {
188     NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
189     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190   }
191
192   public void SetIndicatorBgOpacity(Window.IndicatorBgOpacity opacity) {
193     NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
194     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195   }
196
197   public void RotateIndicator(Window.WindowOrientation orientation) {
198     NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
199     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200   }
201
202   public void SetClass(string name, string klass) {
203     NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
204     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205   }
206
207   public void Raise() {
208     NDalicPINVOKE.Window_Raise(swigCPtr);
209     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210   }
211
212   public void Lower() {
213     NDalicPINVOKE.Window_Lower(swigCPtr);
214     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215   }
216
217   public void Activate() {
218     NDalicPINVOKE.Window_Activate(swigCPtr);
219     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
220   }
221
222   public void AddAvailableOrientation(Window.WindowOrientation orientation) {
223     NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
224     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225   }
226
227   public void RemoveAvailableOrientation(Window.WindowOrientation orientation) {
228     NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
229     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230   }
231
232   public void SetPreferredOrientation(Window.WindowOrientation orientation) {
233     NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
234     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235   }
236
237   public Window.WindowOrientation GetPreferredOrientation() {
238     Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
239     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
240     return ret;
241   }
242
243   public DragAndDropDetector GetDragAndDropDetector() {
244     DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
245     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246     return ret;
247   }
248
249   public Any GetNativeHandle() {
250     Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
251     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
252     return ret;
253   }
254
255   public WindowFocusSignalType FocusChangedSignal() {
256     WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
257     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258     return ret;
259   }
260
261   public Layer GetDefaultLayer()
262   {
263     return this.GetRootLayer();
264   }
265
266   public void Add(Layer layer)
267   {
268     NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
269     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270   }
271
272   public void Remove(Layer layer)
273   {
274     NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
275     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276   }
277
278   public void Add(View view) {
279     NDalicPINVOKE.Stage_Add(stageCPtr, View.getCPtr(view));
280     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
281   }
282
283   public void Remove(View view) {
284     NDalicPINVOKE.Stage_Remove(stageCPtr, View.getCPtr(view));
285     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286   }
287
288   public Vector2 GetSize() {
289     Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
290     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
291     return ret;
292   }
293
294   public RenderTaskList GetRenderTaskList() {
295     RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
296     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
297     return ret;
298   }
299
300   public uint GetLayerCount() {
301     uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr);
302     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303     return ret;
304   }
305
306   public Layer GetLayer(uint depth) {
307     Layer ret = new Layer(NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth), true);
308     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
309     return ret;
310   }
311
312   public Layer GetRootLayer() {
313     Layer ret = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
314     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315     return ret;
316   }
317
318   public void SetBackgroundColor(Vector4 color) {
319     NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
320     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321   }
322
323   public Vector4 GetBackgroundColor() {
324     Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
325     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326     return ret;
327   }
328
329   public Vector2 GetDpi() {
330     Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
331     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332     return ret;
333   }
334
335   public ObjectRegistry GetObjectRegistry() {
336     ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
337     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338     return ret;
339   }
340
341   public void KeepRendering(float durationSeconds) {
342     NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
343     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344   }
345
346   public KeyEventSignal KeyEventSignal() {
347     KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
348     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349     return ret;
350   }
351
352   public VoidSignal EventProcessingFinishedSignal() {
353     VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
354     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355     return ret;
356   }
357
358   public TouchSignal TouchSignal() {
359     TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
360     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361     return ret;
362   }
363
364   private StageWheelSignal WheelEventSignal() {
365     StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
366     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
367     return ret;
368   }
369
370   public VoidSignal ContextLostSignal() {
371     VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
372     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
373     return ret;
374   }
375
376   public VoidSignal ContextRegainedSignal() {
377     VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
378     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
379     return ret;
380   }
381
382   public VoidSignal SceneCreatedSignal() {
383     VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
384     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
385     return ret;
386   }
387
388   public static Vector4 DEFAULT_BACKGROUND_COLOR {
389     get {
390       global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
391       Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
392       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393       return ret;
394     }
395   }
396
397   public static Vector4 DEBUG_BACKGROUND_COLOR {
398     get {
399       global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
400       Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
401       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
402       return ret;
403     }
404   }
405
406   private static readonly Window instance = Application.Instance.GetWindow();
407   public static Window Instance
408   {
409     get
410     {
411       return instance;
412     }
413   }
414
415   public enum WindowOrientation {
416     PORTRAIT = 0,
417     LANDSCAPE = 90,
418     PORTRAIT_INVERSE = 180,
419     LANDSCAPE_INVERSE = 270
420   }
421
422   public enum IndicatorBgOpacity {
423     OPAQUE = 100,
424     TRANSLUCENT = 50,
425     TRANSPARENT = 0
426   }
427
428   public enum IndicatorVisibleMode {
429     INVISIBLE = 0,
430     VISIBLE = 1,
431     AUTO = 2
432   }
433
434
435
436   /**
437     * @brief Event arguments that passed via Touch signal
438     *
439     */
440   public class TouchEventArgs : EventArgs
441   {
442      private Touch _touch;
443
444      /**
445        * @brief Touch - contains the information of touch points
446        *
447        */
448      public Touch Touch
449      {
450         get
451         {
452            return _touch;
453         }
454         set
455         {
456            _touch = value;
457         }
458      }
459   }
460
461   private event EventHandler<TouchEventArgs> _stageTouchHandler;
462   private EventCallbackDelegateType1<IntPtr> _stageTouchCallbackDelegate;
463
464   /**
465     * @brief Event for TouchEvent signal which can be used to subscribe/unsubscribe the event handler
466     * TouchEvent signal is emitted when the screen is touched and when the touch ends
467     * (i.e. the down & up touch events only).
468     *
469     */
470   public event EventHandler<TouchEventArgs> Touch
471   {
472      add
473      {
474         lock(this)
475         {
476           _stageTouchHandler += value;
477           _stageTouchCallbackDelegate = OnStageTouch;
478           this.TouchSignal().Connect(_stageTouchCallbackDelegate);
479         }
480      }
481      remove
482      {
483         lock(this)
484         {
485            if (_stageTouchHandler != null)
486            {
487               this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
488            }
489            _stageTouchHandler -= value;
490         }
491      }
492   }
493
494   private void OnStageTouch(IntPtr data)
495   {
496     TouchEventArgs e = new TouchEventArgs();
497
498     if( data != null )
499     {
500       e.Touch = Dali.Touch.GetTouchFromPtr( data );
501     }
502
503     if (_stageTouchHandler != null)
504     {
505       _stageTouchHandler(this, e);
506     }
507   }
508
509   /**
510     * @brief Wheel arguments that passed via Wheel signal
511     *
512     */
513   public class WheelEventArgs : EventArgs
514   {
515      private Wheel _wheel;
516
517      /**
518        * @brief Wheel - store a wheel rolling type MOUSE_WHEEL or CUSTOM_WHEEL
519        *
520        */
521      public Wheel Wheel
522      {
523         get
524         {
525            return _wheel;
526         }
527         set
528         {
529            _wheel = value;
530         }
531      }
532   }
533
534   private event EventHandler<WheelEventArgs> _stageWheelHandler;
535   private EventCallbackDelegateType1<IntPtr> _stageWheelCallbackDelegate;
536
537   /**
538     * @brief Event for Wheel signal which can be used to subscribe/unsubscribe the event handler
539     * Wheel signal is emitted is emitted when wheel event is received.
540     *
541     */
542   public event EventHandler<WheelEventArgs> Wheel
543   {
544      add
545      {
546         lock(this)
547         {
548           _stageWheelHandler += value;
549           _stageWheelCallbackDelegate = OnStageWheel;
550           this.WheelEventSignal().Connect(_stageWheelCallbackDelegate);
551         }
552      }
553      remove
554      {
555         lock(this)
556         {
557            if (_stageWheelHandler != null)
558            {
559               this.WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
560            }
561            _stageWheelHandler -= value;
562         }
563      }
564   }
565
566   private void OnStageWheel(IntPtr data)
567   {
568     WheelEventArgs e = new WheelEventArgs();
569
570     if( data != null )
571     {
572       e.Wheel = Dali.Wheel.GetWheelFromPtr( data );
573     }
574
575     if (_stageWheelHandler != null)
576     {
577       _stageWheelHandler(this, e);
578     }
579   }
580
581   /**
582     * @brief Event arguments that passed via Key signal
583     *
584     */
585   public class KeyEventArgs : EventArgs
586   {
587      private Key _key;
588
589      /**
590        * @brief Key - is the keyevent sent to Stage.
591        *
592        */
593      public Key Key
594      {
595         get
596         {
597            return _key;
598         }
599         set
600         {
601            _key = value;
602         }
603      }
604   }
605
606   private event EventHandler<KeyEventArgs> _stageKeyHandler;
607   private EventCallbackDelegateType1<IntPtr> _stageKeyCallbackDelegate;
608
609   /**
610     * @brief Event for Key signal which can be used to subscribe/unsubscribe the event handler
611     * Key signal is emitted is emitted when key event is received.
612     *
613     */
614   public event EventHandler<KeyEventArgs> Key
615   {
616      add
617      {
618         lock(this)
619         {
620             _stageKeyHandler += value;
621             _stageKeyCallbackDelegate = OnStageKey;
622             this.KeyEventSignal().Connect(_stageKeyCallbackDelegate);
623         }
624      }
625      remove
626      {
627         lock(this)
628         {
629            if (_stageKeyHandler != null)
630            {
631               this.KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
632            }
633            _stageKeyHandler -= value;
634         }
635      }
636   }
637
638   // Callback for Stage KeyEventsignal
639   private void OnStageKey(IntPtr data)
640   {
641     KeyEventArgs e = new KeyEventArgs();
642
643     if( data != null )
644     {
645       e.Key = Dali.Key.GetKeyFromPtr( data );
646     }
647
648     if (_stageKeyHandler != null)
649     {
650       //here we send all data to user event handlers
651       _stageKeyHandler(this, e);
652     }
653   }
654
655
656   private event EventHandler _stageEventProcessingFinishedEventHandler;
657   private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
658
659   /**
660     * @brief Event for EventProcessingFinished signal which can be used to subscribe/unsubscribe the event handler
661     * provided by the user. EventProcessingFinished signal is emitted just after the event processing is finished.
662     *
663     */
664   public event EventHandler EventProcessingFinished
665   {
666      add
667      {
668         lock(this)
669         {
670           _stageEventProcessingFinishedEventHandler += value;
671           _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
672           this.EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
673         }
674      }
675      remove
676      {
677         lock(this)
678         {
679            if (_stageEventProcessingFinishedEventHandler != null)
680            {
681               this.EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
682            }
683            _stageEventProcessingFinishedEventHandler -= value;
684         }
685      }
686   }
687
688   // Callback for Stage EventProcessingFinishedSignal
689   private void OnEventProcessingFinished()
690   {
691      if (_stageEventProcessingFinishedEventHandler != null)
692      {
693         _stageEventProcessingFinishedEventHandler(this, null);
694      }
695   }
696
697
698   private EventHandler _stageContextLostEventHandler;
699   private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
700
701   /**
702     * @brief Event for ContextLost signal which can be used to subscribe/unsubscribe the event handler
703     * ContextLost signal is emitted when the GL context is lost (Platform specific behaviour).
704     *
705     */
706   public event EventHandler ContextLost
707   {
708      add
709      {
710         lock(this)
711         {
712             _stageContextLostEventHandler += value;
713             _stageContextLostEventCallbackDelegate = OnContextLost;
714             this.ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
715         }
716      }
717      remove
718      {
719         lock(this)
720         {
721            if (_stageContextLostEventHandler != null)
722            {
723               this.ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
724            }
725
726            _stageContextLostEventHandler -= value;
727         }
728      }
729   }
730
731   // Callback for Stage ContextLostSignal
732   private void OnContextLost()
733   {
734      if (_stageContextLostEventHandler != null)
735      {
736         _stageContextLostEventHandler(this, null);
737      }
738   }
739
740
741   private EventHandler _stageContextRegainedEventHandler;
742   private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
743
744   /**
745     * @brief Event for ContextRegained signal which can be used to subscribe/unsubscribe the event handler
746     * provided by the user. ContextRegained signal is emitted when the GL context is regained (Platform specific
747     * behaviour).
748     *
749     */
750   public event EventHandler ContextRegained
751   {
752      add
753      {
754         lock(this)
755         {
756             _stageContextRegainedEventHandler += value;
757             _stageContextRegainedEventCallbackDelegate = OnContextRegained;
758             this.ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
759         }
760      }
761      remove
762      {
763         lock(this)
764         {
765            if (_stageContextRegainedEventHandler != null)
766            {
767               this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
768            }
769
770            _stageContextRegainedEventHandler -= value;
771         }
772      }
773   }
774
775   // Callback for Stage ContextRegainedSignal
776   private void OnContextRegained()
777   {
778      if (_stageContextRegainedEventHandler != null)
779      {
780         _stageContextRegainedEventHandler(this, null);
781      }
782   }
783
784
785   private EventHandler _stageSceneCreatedEventHandler;
786   private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
787
788   /**
789     * @brief Event for SceneCreated signal which can be used to subscribe/unsubscribe the event handler
790     * SceneCreated signal is emitted after the initial scene is created.
791     *
792     */
793   public event EventHandler SceneCreated
794   {
795      add
796      {
797         lock(this)
798         {
799             _stageSceneCreatedEventHandler += value;
800             _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
801             this.SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
802         }
803      }
804      remove
805      {
806         lock(this)
807         {
808            if (_stageSceneCreatedEventHandler != null)
809            {
810               this.SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
811            }
812
813            _stageSceneCreatedEventHandler -= value;
814         }
815      }
816   }
817
818   // Callback for Stage SceneCreatedSignal
819   private void OnSceneCreated()
820   {
821      if (_stageSceneCreatedEventHandler != null)
822      {
823         _stageSceneCreatedEventHandler(this, null);
824      }
825   }
826
827
828   public Vector2 Size
829   {
830      get
831      {
832         Vector2 ret = GetSize();
833         return ret;
834      }
835   }
836
837   public Vector4 BackgroundColor
838   {
839      set
840      {
841         SetBackgroundColor(value);
842      }
843      get
844      {
845         Vector4 ret = GetBackgroundColor();
846         return ret;
847      }
848    }
849
850 }
851
852 }