8589e701a4ea3807c561ca30fb37b3fb9a0f8a11
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / manual / csharp / View.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 Dali {
18
19     using System;
20     using System.Runtime.InteropServices;
21
22
23 public class View : CustomActor {
24   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
25
26   internal View(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.View_SWIGUpcast(cPtr), cMemoryOwn) {
27     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
28
29     // Register this instance of view in the view registry.
30     ViewRegistry.RegisterView(this);
31   }
32
33   internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj) {
34     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
35   }
36
37   ~View() {
38     DisposeQueue.Instance.Add(this);
39   }
40
41   public override void Dispose() {
42     if (!Stage.IsInstalled()) {
43       DisposeQueue.Instance.Add(this);
44       return;
45     }
46
47     lock(this) {
48       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
49         if (swigCMemOwn) {
50           swigCMemOwn = false;
51           NDalicPINVOKE.delete_View(swigCPtr);
52         }
53         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
54       }
55       global::System.GC.SuppressFinalize(this);
56       base.Dispose();
57     }
58   }
59
60   /**
61    * @brief Event arguments that passed via KeyInputFocusGained signal
62    *
63    */
64   public class KeyInputFocusGainedEventArgs : EventArgs
65   {
66     private View _view;
67
68     /**
69      * @brief View - is the view that gets Key Input Focus
70      *
71      */
72     public View View
73     {
74       get
75       {
76         return _view;
77       }
78       set
79       {
80         _view = value;
81       }
82     }
83   }
84
85   /**
86    * @brief Event arguments that passed via KeyInputFocusLost signal
87    *
88    */
89   public class KeyInputFocusLostEventArgs : EventArgs
90   {
91     private View _view;
92
93     /**
94      * @brief View - is the view that loses Key Input Focus
95      *
96      */
97     public View View
98     {
99       get
100       {
101         return _view;
102       }
103       set
104       {
105         _view = value;
106       }
107     }
108   }
109
110   /**
111    * @brief Event arguments that passed via Key signal
112    *
113    */
114   public class KeyEventArgs : EventArgs
115   {
116     private View _view;
117     private Key _key;
118
119     /**
120      * @brief View - is the view that recieves the key.
121      *
122      */
123     public View View
124     {
125       get
126       {
127         return _view;
128       }
129       set
130       {
131         _view = value;
132       }
133     }
134
135     /**
136      * @brief Key - is the key sent to the View.
137      *
138      */
139     public Key Key
140     {
141       get
142       {
143         return _key;
144       }
145       set
146       {
147         _key = value;
148       }
149     }
150   }
151
152   /**
153    * @brief Event arguments that passed via OnRelayout signal
154    *
155    */
156   public class OnRelayoutEventArgs : EventArgs
157   {
158     private View _view;
159
160     /**
161      * @brief View - is the view that is being resized upon relayout
162      *
163      */
164     public View View
165     {
166       get
167       {
168         return _view;
169       }
170       set
171       {
172         _view = value;
173       }
174     }
175   }
176
177
178   /**
179    * @brief Event arguments that passed via Touch signal
180    *
181    */
182   public class TouchEventArgs : EventArgs
183   {
184      private View _view;
185      private Touch _touch;
186
187     /**
188      * @brief View - is the view that is being touched
189      *
190      */
191     public View View
192     {
193       get
194       {
195         return _view;
196       }
197       set
198       {
199         _view = value;
200       }
201     }
202
203     /**
204      * @brief Touch - contains the information of touch points
205      *
206      */
207     public Touch Touch
208     {
209       get
210       {
211         return _touch;
212       }
213       set
214       {
215         _touch = value;
216       }
217     }
218   }
219
220   /**
221    * @brief Event arguments that passed via Hover signal
222    *
223    */
224   public class HoverEventArgs : EventArgs
225   {
226      private View _view;
227      private Hover _hover;
228
229     /**
230      * @brief View - is the view that is being hovered
231      *
232      */
233     public View View
234     {
235       get
236       {
237         return _view;
238       }
239       set
240       {
241         _view = value;
242       }
243     }
244
245     /**
246      * @brief Hover - contains touch points that represent the points
247      * that are currently being hovered or the points where a hover has stopped
248      *
249      */
250     public Hover Hover
251     {
252       get
253       {
254         return _hover;
255       }
256       set
257       {
258         _hover = value;
259       }
260     }
261   }
262
263   /**
264    * @brief Event arguments that passed via Wheel signal
265    *
266    */
267   public class WheelEventArgs : EventArgs
268   {
269     private View _view;
270     private Wheel _wheel;
271
272     /**
273      * @brief View - is the view that is being wheeled
274      *
275      */
276     public View View
277     {
278       get
279       {
280         return _view;
281       }
282       set
283       {
284         _view = value;
285       }
286     }
287
288     /**
289      * @brief Wheel - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL
290      *
291      */
292     public Wheel Wheel
293     {
294       get
295       {
296         return _wheel;
297       }
298       set
299       {
300         _wheel = value;
301       }
302     }
303   }
304
305   /**
306    * @brief Event arguments that passed via OnStage signal
307    *
308    */
309   public class OnStageEventArgs : EventArgs
310   {
311   private View _view;
312
313     /**
314      * @brief View - is the view that is being connected to the stage
315      *
316      */
317     public View View
318     {
319       get
320       {
321         return _view;
322       }
323       set
324       {
325         _view = value;
326       }
327     }
328   }
329
330   /**
331    * @brief Event arguments that passed via OffStage signal
332    *
333    */
334   public class OffStageEventArgs : EventArgs
335   {
336   private View _view;
337
338     /**
339      * @brief View - is the view that is being disconnected from the stage
340      *
341      */
342     public View View
343     {
344       get
345       {
346         return _view;
347       }
348       set
349       {
350         _view = value;
351       }
352     }
353   }
354
355   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
356   private delegate void KeyInputFocusGainedCallbackDelegate(IntPtr control);
357   private DaliEventHandler<object,KeyInputFocusGainedEventArgs> _KeyInputFocusGainedEventHandler;
358   private KeyInputFocusGainedCallbackDelegate _KeyInputFocusGainedCallbackDelegate;
359
360   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
361   private delegate void KeyInputFocusLostCallbackDelegate(IntPtr control);
362   private DaliEventHandler<object,KeyInputFocusLostEventArgs> _KeyInputFocusLostEventHandler;
363   private KeyInputFocusLostCallbackDelegate _KeyInputFocusLostCallbackDelegate;
364
365   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
366   private delegate bool KeyCallbackDelegate(IntPtr control, IntPtr key);
367   private DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> _KeyHandler;
368   private KeyCallbackDelegate _KeyCallbackDelegate;
369
370   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
371   private delegate void OnRelayoutEventCallbackDelegate(IntPtr control);
372   private DaliEventHandler<object,OnRelayoutEventArgs> _viewOnRelayoutEventHandler;
373   private OnRelayoutEventCallbackDelegate _viewOnRelayoutEventCallbackDelegate;
374
375   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
376   private delegate bool TouchCallbackDelegate(IntPtr view, IntPtr touch);
377   private DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> _viewTouchHandler;
378   private TouchCallbackDelegate _viewTouchCallbackDelegate;
379
380   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
381   private delegate bool HoverCallbackDelegate(IntPtr view, IntPtr hover);
382   private DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> _viewHoverHandler;
383   private HoverCallbackDelegate _viewHoverCallbackDelegate;
384
385   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
386   private delegate bool WheelCallbackDelegate(IntPtr view, IntPtr wheel);
387   private DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> _viewWheelHandler;
388   private WheelCallbackDelegate _viewWheelCallbackDelegate;
389
390   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
391   private delegate void OnStageEventCallbackDelegate(IntPtr control);
392   private DaliEventHandler<object,OnStageEventArgs> _viewOnStageEventHandler;
393   private OnStageEventCallbackDelegate _viewOnStageEventCallbackDelegate;
394
395   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
396   private delegate void OffStageEventCallbackDelegate(IntPtr control);
397   private DaliEventHandler<object,OffStageEventArgs> _viewOffStageEventHandler;
398   private OffStageEventCallbackDelegate _viewOffStageEventCallbackDelegate;
399
400   /**
401    * @brief Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler
402    * (in the type of KeyInputFocusGainedEventHandler-DaliEventHandler<object,KeyInputFocusGainedEventArgs>)
403    * provided by the user. KeyInputFocusGained signal is emitted when the control gets Key Input Focus.
404    */
405   public event DaliEventHandler<object,KeyInputFocusGainedEventArgs> KeyInputFocusGained
406   {
407     add
408     {
409       lock(this)
410       {
411         // Restricted to only one listener
412         if (_KeyInputFocusGainedEventHandler == null)
413         {
414           _KeyInputFocusGainedEventHandler += value;
415           Console.WriteLine("View Key EVENT Locked....");
416           _KeyInputFocusGainedCallbackDelegate = new KeyInputFocusGainedCallbackDelegate(OnKeyInputFocusGained);
417           this.KeyInputFocusGainedSignal().Connect(_KeyInputFocusGainedCallbackDelegate);
418         }
419       }
420     }
421
422     remove
423     {
424       lock(this)
425       {
426         if (_KeyInputFocusGainedEventHandler != null)
427         {
428           this.KeyInputFocusGainedSignal().Disconnect(_KeyInputFocusGainedCallbackDelegate);
429         }
430
431         _KeyInputFocusGainedEventHandler -= value;
432       }
433     }
434   }
435
436   private void OnKeyInputFocusGained(IntPtr view)
437   {
438     KeyInputFocusGainedEventArgs e = new KeyInputFocusGainedEventArgs();
439     Console.WriteLine("View Key ....");
440     // Populate all members of "e" (KeyInputFocusGainedEventArgs) with real data
441     e.View = Dali.View.GetViewFromPtr(view);
442
443     if (_KeyInputFocusGainedEventHandler != null)
444     {
445       //here we send all data to user event handlers
446       _KeyInputFocusGainedEventHandler(this, e);
447     }
448
449   }
450
451   /**
452    * @brief Event for KeyInputFocusLost signal which can be used to subscribe/unsubscribe the event handler
453    * (in the type of KeyInputFocusLostEventHandler-DaliEventHandler<object,KeyInputFocusLostEventArgs>)
454    * provided by the user. KeyInputFocusLost signal is emitted when the control loses Key Input Focus.
455    */
456   public event DaliEventHandler<object,KeyInputFocusLostEventArgs> KeyInputFocusLost
457   {
458     add
459     {
460       lock(this)
461       {
462         // Restricted to only one listener
463         if (_KeyInputFocusLostEventHandler == null)
464         {
465           _KeyInputFocusLostEventHandler += value;
466
467           _KeyInputFocusLostCallbackDelegate = new KeyInputFocusLostCallbackDelegate(OnKeyInputFocusLost);
468           this.KeyInputFocusLostSignal().Connect(_KeyInputFocusLostCallbackDelegate);
469         }
470       }
471     }
472
473     remove
474     {
475       lock(this)
476       {
477         if (_KeyInputFocusLostEventHandler != null)
478         {
479           this.KeyInputFocusLostSignal().Disconnect(_KeyInputFocusLostCallbackDelegate);
480         }
481
482         _KeyInputFocusLostEventHandler -= value;
483       }
484     }
485   }
486
487   private void OnKeyInputFocusLost(IntPtr view)
488   {
489     KeyInputFocusLostEventArgs e = new KeyInputFocusLostEventArgs();
490
491     // Populate all members of "e" (KeyInputFocusLostEventArgs) with real data
492     e.View = Dali.View.GetViewFromPtr(view);
493
494     if (_KeyInputFocusLostEventHandler != null)
495     {
496       //here we send all data to user event handlers
497       _KeyInputFocusLostEventHandler(this, e);
498     }
499   }
500
501   /**
502    * @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler
503    * (in the type of KeyHandler-DaliEventHandlerWithReturnType<object,KeyEventArgs,bool>)
504    * provided by the user. KeyPressed signal is emitted when key event is received.
505    */
506   public event DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> KeyPressed
507   {
508     add
509     {
510       lock(this)
511       {
512         // Restricted to only one listener
513         if (_KeyHandler == null)
514         {
515           _KeyHandler += value;
516
517           _KeyCallbackDelegate = new KeyCallbackDelegate(OnKey);
518           this.KeyEventSignal().Connect(_KeyCallbackDelegate);
519         }
520       }
521     }
522
523     remove
524     {
525       lock(this)
526       {
527         if (_KeyHandler != null)
528         {
529           this.KeyEventSignal().Disconnect(_KeyCallbackDelegate);
530         }
531
532         _KeyHandler -= value;
533       }
534     }
535   }
536
537   private bool OnKey(IntPtr view, IntPtr key)
538   {
539     KeyEventArgs e = new KeyEventArgs();
540
541     // Populate all members of "e" (KeyEventArgs) with real data
542     e.View = Dali.View.GetViewFromPtr(view);
543     e.Key = Dali.Key.GetKeyFromPtr(key);
544
545     if (_KeyHandler != null)
546     {
547       //here we send all data to user event handlers
548       return _KeyHandler(this, e);
549     }
550     return false;
551
552   }
553
554   /**
555    * @brief Event for OnRelayout signal which can be used to subscribe/unsubscribe the event handler
556    * (in the type of OnRelayoutEventHandler) provided by the user.
557    * OnRelayout signal is emitted after the size has been set on the view during relayout.
558    */
559   public event DaliEventHandler<object,OnRelayoutEventArgs> OnRelayoutEvent
560   {
561     add
562     {
563       lock(this)
564       {
565         // Restricted to only one listener
566         if (_viewOnRelayoutEventHandler == null)
567         {
568           _viewOnRelayoutEventHandler += value;
569           Console.WriteLine("View OnRelayoutEventArgs Locked....");
570           _viewOnRelayoutEventCallbackDelegate = new OnRelayoutEventCallbackDelegate(OnRelayout);
571           this.OnRelayoutSignal().Connect(_viewOnRelayoutEventCallbackDelegate);
572         }
573       }
574     }
575
576     remove
577     {
578       lock(this)
579       {
580         if (_viewOnRelayoutEventHandler != null)
581         {
582           this.OnRelayoutSignal().Disconnect(_viewOnRelayoutEventCallbackDelegate);
583         }
584
585         _viewOnRelayoutEventHandler -= value;
586       }
587     }
588   }
589
590   // Callback for View OnRelayout signal
591   private void OnRelayout(IntPtr data)
592   {
593     OnRelayoutEventArgs e = new OnRelayoutEventArgs();
594     Console.WriteLine("View OnRelayoutEventArgs....");
595     // Populate all members of "e" (OnRelayoutEventArgs) with real data
596     e.View = View.GetViewFromPtr(data);
597
598     if (_viewOnRelayoutEventHandler != null)
599     {
600       //here we send all data to user event handlers
601       _viewOnRelayoutEventHandler(this, e);
602     }
603   }
604
605   /**
606    * @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler
607    * (in the type of TouchHandler-DaliEventHandlerWithReturnType<object,TouchEventArgs,bool>)
608    * provided by the user. Touched signal is emitted when touch input is received.
609    */
610   public event DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> Touched
611   {
612     add
613     {
614       lock(this)
615       {
616         // Restricted to only one listener
617         if (_viewTouchHandler == null)
618         {
619           _viewTouchHandler += value;
620           Console.WriteLine("View Touch EVENT LOCKED....");
621           _viewTouchCallbackDelegate = new TouchCallbackDelegate(OnTouch);
622           this.TouchSignal().Connect(_viewTouchCallbackDelegate);
623         }
624       }
625     }
626
627     remove
628     {
629       lock(this)
630       {
631         if (_viewTouchHandler != null)
632         {
633           this.TouchSignal().Disconnect(_viewTouchCallbackDelegate);
634         }
635
636         _viewTouchHandler -= value;
637       }
638     }
639   }
640
641   // Callback for View TouchSignal
642   private bool OnTouch(IntPtr view, IntPtr touch)
643   {
644     TouchEventArgs e = new TouchEventArgs();
645     Console.WriteLine("View Touch EVENT....");
646     // Populate all members of "e" (TouchEventArgs) with real data
647     e.View = View.GetViewFromPtr(view);
648     e.Touch = Dali.Touch.GetTouchFromPtr(touch);
649
650     if (_viewTouchHandler != null)
651     {
652       //here we send all data to user event handlers
653       return _viewTouchHandler(this, e);
654     }
655
656     return false;
657   }
658
659   /**
660    * @brief Event for Hovered signal which can be used to subscribe/unsubscribe the event handler
661    * (in the type of HoverHandler-DaliEventHandlerWithReturnType<object,HoverEventArgs,bool>)
662    * provided by the user. Hovered signal is emitted when hover input is received.
663    */
664   public event DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> Hovered
665   {
666     add
667     {
668       lock(this)
669       {
670         // Restricted to only one listener
671         if (_viewHoverHandler == null)
672         {
673           _viewHoverHandler += value;
674
675           _viewHoverCallbackDelegate = new HoverCallbackDelegate(OnHover);
676           this.HoveredSignal().Connect(_viewHoverCallbackDelegate);
677         }
678       }
679     }
680
681     remove
682     {
683       lock(this)
684       {
685         if (_viewHoverHandler != null)
686         {
687           this.HoveredSignal().Disconnect(_viewHoverCallbackDelegate);
688         }
689
690         _viewHoverHandler -= value;
691       }
692     }
693   }
694
695   // Callback for View Hover signal
696   private bool OnHover(IntPtr view, IntPtr hover)
697   {
698     HoverEventArgs e = new HoverEventArgs();
699
700     // Populate all members of "e" (HoverEventArgs) with real data
701     e.View = View.GetViewFromPtr(view);
702     e.Hover = Dali.Hover.GetHoverFromPtr(hover);
703
704     if (_viewHoverHandler != null)
705     {
706       //here we send all data to user event handlers
707       return _viewHoverHandler(this, e);
708     }
709
710     return false;
711   }
712
713   /**
714    * @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler
715    * (in the type of WheelHandler-DaliEventHandlerWithReturnType<object,WheelEventArgs,bool>)
716    * provided by the user. WheelMoved signal is emitted when wheel event is received.
717    */
718   public event DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> WheelMoved
719   {
720     add
721     {
722       lock(this)
723       {
724         // Restricted to only one listener
725         if (_viewWheelHandler == null)
726         {
727           _viewWheelHandler += value;
728           Console.WriteLine("View Wheel EVENT LOCKED....");
729           _viewWheelCallbackDelegate = new WheelCallbackDelegate(OnWheel);
730           this.WheelEventSignal().Connect(_viewWheelCallbackDelegate);
731         }
732       }
733     }
734
735     remove
736     {
737       lock(this)
738       {
739         if (_viewWheelHandler != null)
740         {
741           this.WheelEventSignal().Disconnect(_viewWheelCallbackDelegate);
742         }
743
744         _viewWheelHandler -= value;
745       }
746     }
747   }
748
749   // Callback for View Wheel signal
750   private bool OnWheel(IntPtr view, IntPtr wheel)
751   {
752     WheelEventArgs e = new WheelEventArgs();
753     Console.WriteLine("View Wheel EVENT ....");
754     // Populate all members of "e" (WheelEventArgs) with real data
755     e.View = View.GetViewFromPtr(view);
756     e.Wheel = Dali.Wheel.GetWheelFromPtr(wheel);
757
758     if (_viewWheelHandler != null)
759     {
760       //here we send all data to user event handlers
761       return _viewWheelHandler(this, e);
762     }
763
764     return false;
765   }
766
767   /**
768    * @brief Event for OnStage signal which can be used to subscribe/unsubscribe the event handler
769    * (in the type of OnStageEventHandler) provided by the user.
770    * OnStage signal is emitted after the view has been connected to the stage.
771    */
772   public event DaliEventHandler<object,OnStageEventArgs> OnStageEvent
773   {
774     add
775     {
776       lock(this)
777       {
778         // Restricted to only one listener
779         if (_viewOnStageEventHandler == null)
780         {
781           _viewOnStageEventHandler += value;
782
783           _viewOnStageEventCallbackDelegate = new OnStageEventCallbackDelegate(OnStage);
784           this.OnStageSignal().Connect(_viewOnStageEventCallbackDelegate);
785         }
786       }
787     }
788
789     remove
790     {
791       lock(this)
792       {
793         if (_viewOnStageEventHandler != null)
794         {
795           this.OnStageSignal().Disconnect(_viewOnStageEventCallbackDelegate);
796         }
797
798         _viewOnStageEventHandler -= value;
799       }
800     }
801   }
802
803   // Callback for View OnStage signal
804   private void OnStage(IntPtr data)
805   {
806     OnStageEventArgs e = new OnStageEventArgs();
807
808     // Populate all members of "e" (OnStageEventArgs) with real data
809     e.View = View.GetViewFromPtr(data);
810
811     //Console.WriteLine("############# OnStage()! e.View.Name=" + e.View.Name);
812
813     if (_viewOnStageEventHandler != null)
814     {
815       //here we send all data to user event handlers
816       _viewOnStageEventHandler(this, e);
817     }
818   }
819
820   /**
821    * @brief Event for OffStage signal which can be used to subscribe/unsubscribe the event handler
822    * (in the type of OffStageEventHandler) provided by the user.
823    * OffStage signal is emitted after the view has been disconnected from the stage.
824    */
825   public event DaliEventHandler<object,OffStageEventArgs> OffStageEvent
826   {
827     add
828     {
829       lock(this)
830       {
831         // Restricted to only one listener
832         if (_viewOffStageEventHandler == null)
833         {
834           _viewOffStageEventHandler += value;
835
836           _viewOffStageEventCallbackDelegate = new OffStageEventCallbackDelegate(OffStage);
837           this.OnStageSignal().Connect(_viewOffStageEventCallbackDelegate);
838         }
839       }
840     }
841
842     remove
843     {
844       lock(this)
845       {
846         if (_viewOffStageEventHandler != null)
847         {
848           this.OnStageSignal().Disconnect(_viewOffStageEventCallbackDelegate);
849         }
850
851         _viewOffStageEventHandler -= value;
852       }
853     }
854   }
855
856   // Callback for View OffStage signal
857   private void OffStage(IntPtr data)
858   {
859     OffStageEventArgs e = new OffStageEventArgs();
860
861     // Populate all members of "e" (OffStageEventArgs) with real data
862     e.View = View.GetViewFromPtr(data);
863
864     if (_viewOffStageEventHandler != null)
865     {
866       //here we send all data to user event handlers
867       _viewOffStageEventHandler(this, e);
868     }
869   }
870
871   public static View GetViewFromPtr(global::System.IntPtr cPtr) {
872     View ret = new View(cPtr, false);
873     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
874     return ret;
875   }
876
877   public class Property : global::System.IDisposable {
878     private global::System.Runtime.InteropServices.HandleRef swigCPtr;
879     protected bool swigCMemOwn;
880
881     internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) {
882       swigCMemOwn = cMemoryOwn;
883       swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
884     }
885
886     internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) {
887       return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
888     }
889
890     ~Property() {
891       Dispose();
892     }
893
894     public virtual void Dispose() {
895       lock(this) {
896         if (swigCPtr.Handle != global::System.IntPtr.Zero) {
897           if (swigCMemOwn) {
898             swigCMemOwn = false;
899             NDalicPINVOKE.delete_View_Property(swigCPtr);
900           }
901           swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
902         }
903         global::System.GC.SuppressFinalize(this);
904       }
905     }
906
907     public static readonly int TOOLTIP = NDalicManualPINVOKE.View_Property_TOOLTIP_get();
908     public static readonly int STATE = NDalicManualPINVOKE.View_Property_STATE_get();
909     public static readonly int SUB_STATE = NDalicManualPINVOKE.View_Property_SUB_STATE_get();
910
911     public Property() : this(NDalicPINVOKE.new_View_Property(), true) {
912       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
913     }
914
915     public static readonly int STYLE_NAME = NDalicPINVOKE.View_Property_STYLE_NAME_get();
916     public static readonly int BACKGROUND_COLOR = NDalicPINVOKE.View_Property_BACKGROUND_COLOR_get();
917     public static readonly int BACKGROUND_IMAGE = NDalicPINVOKE.View_Property_BACKGROUND_IMAGE_get();
918     public static readonly int KEY_INPUT_FOCUS = NDalicPINVOKE.View_Property_KEY_INPUT_FOCUS_get();
919     public static readonly int BACKGROUND = NDalicPINVOKE.View_Property_BACKGROUND_get();
920
921   }
922
923   public class KeyboardFocus : global::System.IDisposable {
924     private global::System.Runtime.InteropServices.HandleRef swigCPtr;
925     protected bool swigCMemOwn;
926
927     internal KeyboardFocus(global::System.IntPtr cPtr, bool cMemoryOwn) {
928       swigCMemOwn = cMemoryOwn;
929       swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
930     }
931
932     internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyboardFocus obj) {
933       return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
934     }
935
936     ~KeyboardFocus() {
937       Dispose();
938     }
939
940     public virtual void Dispose() {
941       lock(this) {
942         if (swigCPtr.Handle != global::System.IntPtr.Zero) {
943           if (swigCMemOwn) {
944             swigCMemOwn = false;
945             NDalicPINVOKE.delete_View_KeyboardFocus(swigCPtr);
946           }
947           swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
948         }
949         global::System.GC.SuppressFinalize(this);
950       }
951     }
952
953     public KeyboardFocus() : this(NDalicPINVOKE.new_View_KeyboardFocus(), true) {
954       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
955     }
956
957     public enum Direction {
958       LEFT,
959       RIGHT,
960       UP,
961       DOWN,
962       PAGE_UP,
963       PAGE_DOWN
964     }
965   }
966
967   public View () : this (NDalicPINVOKE.View_New(), true) {
968       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
969
970   }
971   public View(View uiControl) : this(NDalicPINVOKE.new_View__SWIG_1(View.getCPtr(uiControl)), true) {
972     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
973   }
974
975   public View Assign(View handle) {
976     View ret = new View(NDalicPINVOKE.View_Assign(swigCPtr, View.getCPtr(handle)), false);
977     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
978     return ret;
979   }
980
981   private new static View DownCast(BaseHandle handle) {
982     View ret = new View(NDalicPINVOKE.View_DownCast(BaseHandle.getCPtr(handle)), true);
983     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
984     return ret;
985   }
986
987   public static T DownCast<T>(Actor actor) where T : View
988   {
989       return (T)( ViewRegistry.GetViewFromActor( actor ) );
990   }
991
992   public void SetKeyInputFocus() {
993     NDalicPINVOKE.View_SetKeyInputFocus(swigCPtr);
994     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
995   }
996
997   public bool HasKeyInputFocus() {
998     bool ret = NDalicPINVOKE.View_HasKeyInputFocus(swigCPtr);
999     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1000     return ret;
1001   }
1002
1003   public void ClearKeyInputFocus() {
1004     NDalicPINVOKE.View_ClearKeyInputFocus(swigCPtr);
1005     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1006   }
1007
1008   public PinchGestureDetector GetPinchGestureDetector() {
1009     PinchGestureDetector ret = new PinchGestureDetector(NDalicPINVOKE.View_GetPinchGestureDetector(swigCPtr), true);
1010     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1011     return ret;
1012   }
1013
1014   public PanGestureDetector GetPanGestureDetector() {
1015     PanGestureDetector ret = new PanGestureDetector(NDalicPINVOKE.View_GetPanGestureDetector(swigCPtr), true);
1016     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1017     return ret;
1018   }
1019
1020   public TapGestureDetector GetTapGestureDetector() {
1021     TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.View_GetTapGestureDetector(swigCPtr), true);
1022     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1023     return ret;
1024   }
1025
1026   public LongPressGestureDetector GetLongPressGestureDetector() {
1027     LongPressGestureDetector ret = new LongPressGestureDetector(NDalicPINVOKE.View_GetLongPressGestureDetector(swigCPtr), true);
1028     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1029     return ret;
1030   }
1031
1032   public void SetStyleName(string styleName) {
1033     NDalicPINVOKE.View_SetStyleName(swigCPtr, styleName);
1034     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1035   }
1036
1037   public string GetStyleName() {
1038     string ret = NDalicPINVOKE.View_GetStyleName(swigCPtr);
1039     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1040     return ret;
1041   }
1042
1043   public void SetBackgroundColor(Vector4 color) {
1044     NDalicPINVOKE.View_SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1045     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1046   }
1047
1048   public Vector4 GetBackgroundColor() {
1049     Vector4 ret = new Vector4(NDalicPINVOKE.View_GetBackgroundColor(swigCPtr), true);
1050     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1051     return ret;
1052   }
1053
1054   public void SetBackgroundImage(Image image) {
1055     NDalicPINVOKE.View_SetBackgroundImage(swigCPtr, Image.getCPtr(image));
1056     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1057   }
1058
1059   public void ClearBackground() {
1060     NDalicPINVOKE.View_ClearBackground(swigCPtr);
1061     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1062   }
1063
1064   public ControlKeySignal KeyEventSignal() {
1065     ControlKeySignal ret = new ControlKeySignal(NDalicPINVOKE.View_KeyEventSignal(swigCPtr), false);
1066     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1067     return ret;
1068   }
1069
1070   public KeyInputFocusSignal KeyInputFocusGainedSignal() {
1071     KeyInputFocusSignal ret = new KeyInputFocusSignal(NDalicPINVOKE.View_KeyInputFocusGainedSignal(swigCPtr), false);
1072     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1073     return ret;
1074   }
1075
1076   public KeyInputFocusSignal KeyInputFocusLostSignal() {
1077     KeyInputFocusSignal ret = new KeyInputFocusSignal(NDalicPINVOKE.View_KeyInputFocusLostSignal(swigCPtr), false);
1078     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1079     return ret;
1080   }
1081
1082   public View(ViewImpl implementation) : this(NDalicPINVOKE.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true) {
1083     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1084   }
1085
1086   public enum PropertyRange {
1087     PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
1088     CONTROL_PROPERTY_START_INDEX = PROPERTY_START_INDEX,
1089     CONTROL_PROPERTY_END_INDEX = CONTROL_PROPERTY_START_INDEX+1000
1090   }
1091
1092   public string StyleName
1093   {
1094     get
1095     {
1096       string temp;
1097       GetProperty( View.Property.STYLE_NAME).Get( out temp );
1098       return temp;
1099     }
1100     set
1101     {
1102       SetProperty( View.Property.STYLE_NAME, new Dali.Property.Value( value ) );
1103     }
1104   }
1105
1106   public Vector4 BackgroundColor
1107   {
1108     get
1109     {
1110       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
1111       GetProperty( View.Property.BACKGROUND_COLOR).Get(  temp );
1112       return temp;
1113     }
1114     set
1115     {
1116       SetProperty( View.Property.BACKGROUND_COLOR, new Dali.Property.Value( value ) );
1117     }
1118   }
1119
1120   public Dali.Property.Map BackgroundImage
1121   {
1122     get
1123     {
1124       Dali.Property.Map temp = new Dali.Property.Map();
1125       GetProperty( View.Property.BACKGROUND_IMAGE).Get(  temp );
1126       return temp;
1127     }
1128     set
1129     {
1130       SetProperty( View.Property.BACKGROUND_IMAGE, new Dali.Property.Value( value ) );
1131     }
1132   }
1133
1134   public bool KeyInputFocus
1135   {
1136     get
1137     {
1138       bool temp = false;
1139       GetProperty( View.Property.KEY_INPUT_FOCUS).Get( ref temp );
1140       return temp;
1141     }
1142     set
1143     {
1144       SetProperty( View.Property.KEY_INPUT_FOCUS, new Dali.Property.Value( value ) );
1145     }
1146   }
1147
1148   public Dali.Property.Map Background
1149   {
1150     get
1151     {
1152       Dali.Property.Map temp = new Dali.Property.Map();
1153       GetProperty( View.Property.BACKGROUND).Get(  temp );
1154       return temp;
1155     }
1156     set
1157     {
1158       SetProperty( View.Property.BACKGROUND, new Dali.Property.Value( value ) );
1159     }
1160   }
1161
1162   public string State
1163   {
1164     get
1165     {
1166       string temp;
1167       GetProperty( View.Property.STATE).Get( out temp );
1168       return temp;
1169     }
1170     set
1171     {
1172       SetProperty( View.Property.STATE, new Dali.Property.Value( value ) );
1173     }
1174   }
1175
1176   public string SubState
1177   {
1178     get
1179     {
1180       string temp;
1181       GetProperty( View.Property.SUB_STATE).Get( out temp );
1182       return temp;
1183     }
1184     set
1185     {
1186       SetProperty( View.Property.SUB_STATE, new Dali.Property.Value( value ) );
1187     }
1188   }
1189
1190   public Dali.Property.Map Tooltip
1191   {
1192     get
1193     {
1194       Dali.Property.Map temp = new Dali.Property.Map();
1195       GetProperty( View.Property.TOOLTIP).Get(  temp );
1196       return temp;
1197     }
1198     set
1199     {
1200       SetProperty( View.Property.TOOLTIP, new Dali.Property.Value( value ) );
1201     }
1202   }
1203
1204   public string TooltipText
1205   {
1206     set
1207     {
1208       SetProperty( View.Property.TOOLTIP, new Dali.Property.Value( value ) );
1209     }
1210   }
1211
1212   public float Flex
1213   {
1214     get
1215     {
1216       float temp = 0.0f;
1217       GetProperty( FlexContainer.ChildProperty.FLEX).Get( ref temp );
1218       return temp;
1219     }
1220     set
1221     {
1222       SetProperty( FlexContainer.ChildProperty.FLEX, new Dali.Property.Value( value ) );
1223     }
1224   }
1225
1226   public int AlignSelf
1227   {
1228     get
1229     {
1230       int temp = 0;
1231       GetProperty( FlexContainer.ChildProperty.ALIGN_SELF).Get( ref temp );
1232       return temp;
1233     }
1234     set
1235     {
1236       SetProperty( FlexContainer.ChildProperty.ALIGN_SELF, new Dali.Property.Value( value ) );
1237     }
1238   }
1239
1240   public Vector4 FlexMargin
1241   {
1242     get
1243     {
1244       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
1245       GetProperty( FlexContainer.ChildProperty.FLEX_MARGIN).Get(  temp );
1246       return temp;
1247     }
1248     set
1249     {
1250       SetProperty( FlexContainer.ChildProperty.FLEX_MARGIN, new Dali.Property.Value( value ) );
1251     }
1252   }
1253
1254   public Vector2 CellIndex
1255   {
1256     get
1257     {
1258       Vector2 temp = new Vector2(0.0f,0.0f);
1259       GetProperty( TableView.ChildProperty.CELL_INDEX).Get(  temp );
1260       return temp;
1261     }
1262     set
1263     {
1264       SetProperty( TableView.ChildProperty.CELL_INDEX, new Dali.Property.Value( value ) );
1265     }
1266   }
1267
1268   public float RowSpan
1269   {
1270     get
1271     {
1272       float temp = 0.0f;
1273       GetProperty( TableView.ChildProperty.ROW_SPAN).Get( ref temp );
1274       return temp;
1275     }
1276     set
1277     {
1278       SetProperty( TableView.ChildProperty.ROW_SPAN, new Dali.Property.Value( value ) );
1279     }
1280   }
1281
1282   public float ColumnSpan
1283   {
1284     get
1285     {
1286       float temp = 0.0f;
1287       GetProperty( TableView.ChildProperty.COLUMN_SPAN).Get( ref temp );
1288       return temp;
1289     }
1290     set
1291     {
1292       SetProperty( TableView.ChildProperty.COLUMN_SPAN, new Dali.Property.Value( value ) );
1293     }
1294   }
1295
1296   public string CellHorizontalAlignment
1297   {
1298     get
1299     {
1300       string temp;
1301       GetProperty( TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT).Get( out temp );
1302       return temp;
1303     }
1304     set
1305     {
1306       SetProperty( TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT, new Dali.Property.Value( value ) );
1307     }
1308   }
1309
1310   public string CellVerticalAlignment
1311   {
1312     get
1313     {
1314       string temp;
1315       GetProperty( TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT).Get( out temp );
1316       return temp;
1317     }
1318     set
1319     {
1320       SetProperty( TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT, new Dali.Property.Value( value ) );
1321     }
1322   }
1323 }
1324
1325 }