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