Merge "DALi C# binding - Write pure C# Color & Position classes and use typemaps...
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / events / actor-event.i
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 %define ACTOR_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
20     using System;
21     using System.Runtime.InteropServices;
22 %}
23
24 %enddef
25
26 %define ACTOR_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
27   %typemap(cscode) NameSpace::ClassName %{
28
29     public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
30       ClassName ret = new ClassName(cPtr, false);
31       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
32       return ret;
33     }
34
35     public IntPtr GetPtrfrom ## ClassName ()
36     {
37        return (IntPtr)swigCPtr;
38     }
39
40     public Actor Parent
41     {
42       get
43       {
44         Actor parent = GetParent();
45         return parent;
46       }
47     }
48
49    public bool Visibility
50    {
51       get
52       {
53         bool visibility = IsVisible();
54         return visibility;
55       }
56     }
57
58    public float Opacity
59    {
60       set
61       {
62         SetOpacity(value);
63       }
64       get
65       {
66         float ret = GetCurrentOpacity();
67         return ret;
68       }
69    }
70
71     public bool StateFocusEnable
72     {
73       set
74       {
75         SetKeyboardFocusable(value);
76       }
77       get
78       {
79         bool focusable = IsKeyboardFocusable();
80         return focusable;
81       }
82     }
83
84     public void Show()
85     {
86       SetVisible(true);
87     }
88
89     public void Hide()
90     {
91       SetVisible(false);
92     }
93
94 /* Properties earlier added by Ruby Script */
95
96   public Dali.CSharp.Position ParentOrigin
97   {
98     get
99     {
100       Vector3 temp = new Vector3(0.0f,0.0f,0.0f);
101       GetProperty( Actor.Property.PARENT_ORIGIN).Get(  temp );
102       Dali.CSharp.Position ret = new Dali.CSharp.Position(temp.x, temp.y, temp.z);
103       return ret;
104     }
105     set
106     {
107       SetProperty( Actor.Property.PARENT_ORIGIN, new Dali.Property.Value( value ) );
108     }
109   }
110   public float ParentOriginX
111   {
112     get
113     {
114       float temp = 0.0f;
115       GetProperty( Actor.Property.PARENT_ORIGIN_X).Get( ref temp );
116       return temp;
117     }
118     set
119     {
120       SetProperty( Actor.Property.PARENT_ORIGIN_X, new Dali.Property.Value( value ) );
121     }
122   }
123   public float ParentOriginY
124   {
125     get
126     {
127       float temp = 0.0f;
128       GetProperty( Actor.Property.PARENT_ORIGIN_Y).Get( ref temp );
129       return temp;
130     }
131     set
132     {
133       SetProperty( Actor.Property.PARENT_ORIGIN_Y, new Dali.Property.Value( value ) );
134     }
135   }
136   public float ParentOriginZ
137   {
138     get
139     {
140       float temp = 0.0f;
141       GetProperty( Actor.Property.PARENT_ORIGIN_Z).Get( ref temp );
142       return temp;
143     }
144     set
145     {
146       SetProperty( Actor.Property.PARENT_ORIGIN_Z, new Dali.Property.Value( value ) );
147     }
148   }
149   public Dali.CSharp.Position AnchorPoint
150   {
151     get
152     {
153       Vector3 temp = new Vector3(0.0f,0.0f,0.0f);
154       GetProperty( Actor.Property.ANCHOR_POINT).Get(  temp );
155       Dali.CSharp.Position ret = new Dali.CSharp.Position(temp.x, temp.y, temp.z);
156       return ret;
157     }
158     set
159     {
160       SetProperty( Actor.Property.ANCHOR_POINT, new Dali.Property.Value( value ) );
161     }
162   }
163   public float AnchorPointX
164   {
165     get
166     {
167       float temp = 0.0f;
168       GetProperty( Actor.Property.ANCHOR_POINT_X).Get( ref temp );
169       return temp;
170     }
171     set
172     {
173       SetProperty( Actor.Property.ANCHOR_POINT_X, new Dali.Property.Value( value ) );
174     }
175   }
176   public float AnchorPointY
177   {
178     get
179     {
180       float temp = 0.0f;
181       GetProperty( Actor.Property.ANCHOR_POINT_Y).Get( ref temp );
182       return temp;
183     }
184     set
185     {
186       SetProperty( Actor.Property.ANCHOR_POINT_Y, new Dali.Property.Value( value ) );
187     }
188   }
189   public float AnchorPointZ
190   {
191     get
192     {
193       float temp = 0.0f;
194       GetProperty( Actor.Property.ANCHOR_POINT_Z).Get( ref temp );
195       return temp;
196     }
197     set
198     {
199       SetProperty( Actor.Property.ANCHOR_POINT_Z, new Dali.Property.Value( value ) );
200     }
201   }
202   public Dali.CSharp.Position Size
203   {
204     get
205     {
206       Vector3 temp = new Vector3(0.0f,0.0f,0.0f);
207       GetProperty( Actor.Property.SIZE).Get(  temp );
208       Dali.CSharp.Position ret = new Dali.CSharp.Position(temp.x, temp.y, temp.z);
209       return ret;
210     }
211     set
212     {
213       SetProperty( Actor.Property.SIZE, new Dali.Property.Value( value ) );
214     }
215   }
216   public float SizeWidth
217   {
218     get
219     {
220       float temp = 0.0f;
221       GetProperty( Actor.Property.SIZE_WIDTH).Get( ref temp );
222       return temp;
223     }
224     set
225     {
226       SetProperty( Actor.Property.SIZE_WIDTH, new Dali.Property.Value( value ) );
227     }
228   }
229   public float SizeHeight
230   {
231     get
232     {
233       float temp = 0.0f;
234       GetProperty( Actor.Property.SIZE_HEIGHT).Get( ref temp );
235       return temp;
236     }
237     set
238     {
239       SetProperty( Actor.Property.SIZE_HEIGHT, new Dali.Property.Value( value ) );
240     }
241   }
242   public float SizeDepth
243   {
244     get
245     {
246       float temp = 0.0f;
247       GetProperty( Actor.Property.SIZE_DEPTH).Get( ref temp );
248       return temp;
249     }
250     set
251     {
252       SetProperty( Actor.Property.SIZE_DEPTH, new Dali.Property.Value( value ) );
253     }
254   }
255   public Dali.CSharp.Position Position
256   {
257     get
258     {
259       Vector3 temp = new Vector3(0.0f,0.0f,0.0f);
260       GetProperty( Actor.Property.POSITION).Get(  temp );
261       Dali.CSharp.Position ret = new Dali.CSharp.Position(temp.x, temp.y, temp.z);
262       return ret;
263     }
264     set
265     {
266       SetProperty( Actor.Property.POSITION, new Dali.Property.Value( value ) );
267     }
268   }
269   public float PositionX
270   {
271     get
272     {
273       float temp = 0.0f;
274       GetProperty( Actor.Property.POSITION_X).Get( ref temp );
275       return temp;
276     }
277     set
278     {
279       SetProperty( Actor.Property.POSITION_X, new Dali.Property.Value( value ) );
280     }
281   }
282   public float PositionY
283   {
284     get
285     {
286       float temp = 0.0f;
287       GetProperty( Actor.Property.POSITION_Y).Get( ref temp );
288       return temp;
289     }
290     set
291     {
292       SetProperty( Actor.Property.POSITION_Y, new Dali.Property.Value( value ) );
293     }
294   }
295   public float PositionZ
296   {
297     get
298     {
299       float temp = 0.0f;
300       GetProperty( Actor.Property.POSITION_Z).Get( ref temp );
301       return temp;
302     }
303     set
304     {
305       SetProperty( Actor.Property.POSITION_Z, new Dali.Property.Value( value ) );
306     }
307   }
308   public Dali.CSharp.Position WorldPosition
309   {
310     get
311     {
312       Vector3 temp = new Vector3(0.0f,0.0f,0.0f);
313       GetProperty( Actor.Property.WORLD_POSITION).Get(  temp );
314       Dali.CSharp.Position ret = new Dali.CSharp.Position(temp.x, temp.y, temp.z);
315       return ret;
316     }
317 }  public float WorldPositionX
318   {
319     get
320     {
321       float temp = 0.0f;
322       GetProperty( Actor.Property.WORLD_POSITION_X).Get( ref temp );
323       return temp;
324     }
325 }  public float WorldPositionY
326   {
327     get
328     {
329       float temp = 0.0f;
330       GetProperty( Actor.Property.WORLD_POSITION_Y).Get( ref temp );
331       return temp;
332     }
333 }  public float WorldPositionZ
334   {
335     get
336     {
337       float temp = 0.0f;
338       GetProperty( Actor.Property.WORLD_POSITION_Z).Get( ref temp );
339       return temp;
340     }
341 }  public Quaternion Orientation
342   {
343     get
344     {
345       Quaternion temp = new Quaternion();
346       GetProperty( Actor.Property.ORIENTATION).Get(  temp );
347       return temp;
348     }
349     set
350     {
351       SetProperty( Actor.Property.ORIENTATION, new Dali.Property.Value( value ) );
352     }
353   }
354   public Quaternion WorldOrientation
355   {
356     get
357     {
358       Quaternion temp = new Quaternion();
359       GetProperty( Actor.Property.WORLD_ORIENTATION).Get(  temp );
360       return temp;
361     }
362 }  public Dali.CSharp.Position Scale
363   {
364     get
365     {
366       Vector3 temp = new Vector3(0.0f,0.0f,0.0f);
367       GetProperty( Actor.Property.SCALE).Get(  temp );
368       Dali.CSharp.Position ret = new Dali.CSharp.Position(temp.x, temp.y, temp.z);
369       return ret;
370     }
371     set
372     {
373       SetProperty( Actor.Property.SCALE, new Dali.Property.Value( value ) );
374     }
375   }
376   public float ScaleX
377   {
378     get
379     {
380       float temp = 0.0f;
381       GetProperty( Actor.Property.SCALE_X).Get( ref temp );
382       return temp;
383     }
384     set
385     {
386       SetProperty( Actor.Property.SCALE_X, new Dali.Property.Value( value ) );
387     }
388   }
389   public float ScaleY
390   {
391     get
392     {
393       float temp = 0.0f;
394       GetProperty( Actor.Property.SCALE_Y).Get( ref temp );
395       return temp;
396     }
397     set
398     {
399       SetProperty( Actor.Property.SCALE_Y, new Dali.Property.Value( value ) );
400     }
401   }
402   public float ScaleZ
403   {
404     get
405     {
406       float temp = 0.0f;
407       GetProperty( Actor.Property.SCALE_Z).Get( ref temp );
408       return temp;
409     }
410     set
411     {
412       SetProperty( Actor.Property.SCALE_Z, new Dali.Property.Value( value ) );
413     }
414   }
415   public Dali.CSharp.Position WorldScale
416   {
417     get
418     {
419       Vector3 temp = new Vector3(0.0f,0.0f,0.0f);
420       GetProperty( Actor.Property.WORLD_SCALE).Get(  temp );
421       Dali.CSharp.Position ret = new Dali.CSharp.Position(temp.x, temp.y, temp.z);
422       return ret;
423     }
424 }  public bool Visible
425   {
426     get
427     {
428       bool temp = false;
429       GetProperty( Actor.Property.VISIBLE).Get( ref temp );
430       return temp;
431     }
432     set
433     {
434       SetProperty( Actor.Property.VISIBLE, new Dali.Property.Value( value ) );
435     }
436   }
437   public Dali.CSharp.Color Color
438   {
439     get
440     {
441       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
442       GetProperty( Actor.Property.COLOR).Get(  temp );
443       Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.x, temp.y, temp.z, temp.w);
444       return ret;
445     }
446     set
447     {
448       SetProperty( Actor.Property.COLOR, new Dali.Property.Value( value ) );
449     }
450   }
451   public float ColorRed
452   {
453     get
454     {
455       float temp = 0.0f;
456       GetProperty( Actor.Property.COLOR_RED).Get( ref temp );
457       return temp;
458     }
459     set
460     {
461       SetProperty( Actor.Property.COLOR_RED, new Dali.Property.Value( value ) );
462     }
463   }
464   public float ColorGreen
465   {
466     get
467     {
468       float temp = 0.0f;
469       GetProperty( Actor.Property.COLOR_GREEN).Get( ref temp );
470       return temp;
471     }
472     set
473     {
474       SetProperty( Actor.Property.COLOR_GREEN, new Dali.Property.Value( value ) );
475     }
476   }
477   public float ColorBlue
478   {
479     get
480     {
481       float temp = 0.0f;
482       GetProperty( Actor.Property.COLOR_BLUE).Get( ref temp );
483       return temp;
484     }
485     set
486     {
487       SetProperty( Actor.Property.COLOR_BLUE, new Dali.Property.Value( value ) );
488     }
489   }
490   public float ColorAlpha
491   {
492     get
493     {
494       float temp = 0.0f;
495       GetProperty( Actor.Property.COLOR_ALPHA).Get( ref temp );
496       return temp;
497     }
498     set
499     {
500       SetProperty( Actor.Property.COLOR_ALPHA, new Dali.Property.Value( value ) );
501     }
502   }
503   public Dali.CSharp.Color WorldColor
504   {
505     get
506     {
507       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
508       GetProperty( Actor.Property.WORLD_COLOR).Get(  temp );
509       Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
510       return ret;
511     }
512 }  public Matrix WorldMatrix
513   {
514     get
515     {
516       Matrix temp = new Matrix();
517       GetProperty( Actor.Property.WORLD_MATRIX).Get(  temp );
518       return temp;
519     }
520 }  public string Name
521   {
522     get
523     {
524       string temp;
525       GetProperty( Actor.Property.NAME).Get( out temp );
526       return temp;
527     }
528     set
529     {
530       SetProperty( Actor.Property.NAME, new Dali.Property.Value( value ) );
531     }
532   }
533   public bool Sensitive
534   {
535     get
536     {
537       bool temp = false;
538       GetProperty( Actor.Property.SENSITIVE).Get( ref temp );
539       return temp;
540     }
541     set
542     {
543       SetProperty( Actor.Property.SENSITIVE, new Dali.Property.Value( value ) );
544     }
545   }
546   public bool LeaveRequired
547   {
548     get
549     {
550       bool temp = false;
551       GetProperty( Actor.Property.LEAVE_REQUIRED).Get( ref temp );
552       return temp;
553     }
554     set
555     {
556       SetProperty( Actor.Property.LEAVE_REQUIRED, new Dali.Property.Value( value ) );
557     }
558   }
559   public bool InheritOrientation
560   {
561     get
562     {
563       bool temp = false;
564       GetProperty( Actor.Property.INHERIT_ORIENTATION).Get( ref temp );
565       return temp;
566     }
567     set
568     {
569       SetProperty( Actor.Property.INHERIT_ORIENTATION, new Dali.Property.Value( value ) );
570     }
571   }
572   public bool InheritScale
573   {
574     get
575     {
576       bool temp = false;
577       GetProperty( Actor.Property.INHERIT_SCALE).Get( ref temp );
578       return temp;
579     }
580     set
581     {
582       SetProperty( Actor.Property.INHERIT_SCALE, new Dali.Property.Value( value ) );
583     }
584   }
585   public string ColorMode
586   {
587     get
588     {
589       string temp;
590       GetProperty( Actor.Property.COLOR_MODE).Get( out temp );
591       return temp;
592     }
593     set
594     {
595       SetProperty( Actor.Property.COLOR_MODE, new Dali.Property.Value( value ) );
596     }
597   }
598   public string PositionInheritance
599   {
600     get
601     {
602       string temp;
603       GetProperty( Actor.Property.POSITION_INHERITANCE).Get( out temp );
604       return temp;
605     }
606     set
607     {
608       SetProperty( Actor.Property.POSITION_INHERITANCE, new Dali.Property.Value( value ) );
609     }
610   }
611   public string DrawMode
612   {
613     get
614     {
615       string temp;
616       GetProperty( Actor.Property.DRAW_MODE).Get( out temp );
617       return temp;
618     }
619     set
620     {
621       SetProperty( Actor.Property.DRAW_MODE, new Dali.Property.Value( value ) );
622     }
623   }
624   public Dali.CSharp.Position SizeModeFactor
625   {
626     get
627     {
628       Vector3 temp = new Vector3(0.0f,0.0f,0.0f);
629       GetProperty( Actor.Property.SIZE_MODE_FACTOR).Get(  temp );
630       Dali.CSharp.Position ret = new Dali.CSharp.Position(temp.x, temp.y, temp.z);
631       return ret;
632     }
633     set
634     {
635       SetProperty( Actor.Property.SIZE_MODE_FACTOR, new Dali.Property.Value( value ) );
636     }
637   }
638   public string WidthResizePolicy
639   {
640     get
641     {
642       string temp;
643       GetProperty( Actor.Property.WIDTH_RESIZE_POLICY).Get( out temp );
644       return temp;
645     }
646     set
647     {
648       SetProperty( Actor.Property.WIDTH_RESIZE_POLICY, new Dali.Property.Value( value ) );
649     }
650   }
651   public string HeightResizePolicy
652   {
653     get
654     {
655       string temp;
656       GetProperty( Actor.Property.HEIGHT_RESIZE_POLICY).Get( out temp );
657       return temp;
658     }
659     set
660     {
661       SetProperty( Actor.Property.HEIGHT_RESIZE_POLICY, new Dali.Property.Value( value ) );
662     }
663   }
664   public string SizeScalePolicy
665   {
666     get
667     {
668       string temp;
669       GetProperty( Actor.Property.SIZE_SCALE_POLICY).Get( out temp );
670       return temp;
671     }
672     set
673     {
674       SetProperty( Actor.Property.SIZE_SCALE_POLICY, new Dali.Property.Value( value ) );
675     }
676   }
677   public bool WidthForHeight
678   {
679     get
680     {
681       bool temp = false;
682       GetProperty( Actor.Property.WIDTH_FOR_HEIGHT).Get( ref temp );
683       return temp;
684     }
685     set
686     {
687       SetProperty( Actor.Property.WIDTH_FOR_HEIGHT, new Dali.Property.Value( value ) );
688     }
689   }
690   public bool HeightForWidth
691   {
692     get
693     {
694       bool temp = false;
695       GetProperty( Actor.Property.HEIGHT_FOR_WIDTH).Get( ref temp );
696       return temp;
697     }
698     set
699     {
700       SetProperty( Actor.Property.HEIGHT_FOR_WIDTH, new Dali.Property.Value( value ) );
701     }
702   }
703   public Vector4 Padding
704   {
705     get
706     {
707       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
708       GetProperty( Actor.Property.PADDING).Get(  temp );
709       return temp;
710     }
711     set
712     {
713       SetProperty( Actor.Property.PADDING, new Dali.Property.Value( value ) );
714     }
715   }
716   public Dali.CSharp.Size MinimumSize
717   {
718     get
719     {
720       Vector2 temp = new Vector2(0.0f,0.0f);
721       GetProperty( Actor.Property.MINIMUM_SIZE).Get(  temp );
722       Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
723       return ret;
724     }
725     set
726     {
727       SetProperty( Actor.Property.MINIMUM_SIZE, new Dali.Property.Value( value ) );
728     }
729   }
730   public Dali.CSharp.Size MaximumSize
731   {
732     get
733     {
734       Vector2 temp = new Vector2(0.0f,0.0f);
735       GetProperty( Actor.Property.MAXIMUM_SIZE).Get(  temp );
736       Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
737       return ret;
738     }
739     set
740     {
741       SetProperty( Actor.Property.MAXIMUM_SIZE, new Dali.Property.Value( value ) );
742     }
743   }
744   public bool InheritPosition
745   {
746     get
747     {
748       bool temp = false;
749       GetProperty( Actor.Property.INHERIT_POSITION).Get( ref temp );
750       return temp;
751     }
752     set
753     {
754       SetProperty( Actor.Property.INHERIT_POSITION, new Dali.Property.Value( value ) );
755     }
756   }
757   public string ClippingMode
758   {
759     get
760     {
761       string temp;
762       GetProperty( Actor.Property.CLIPPING_MODE).Get( out temp );
763       return temp;
764     }
765     set
766     {
767       SetProperty( Actor.Property.CLIPPING_MODE, new Dali.Property.Value( value ) );
768     }
769   }
770   public bool BatchParent
771   {
772     get
773     {
774       bool temp = false;
775       GetProperty( Actor.Property.BATCH_PARENT).Get( ref temp );
776       return temp;
777     }
778     set
779     {
780       SetProperty( Actor.Property.BATCH_PARENT, new Dali.Property.Value( value ) );
781     }
782   }
783
784 /* Properties ends */
785
786 %}
787
788 %enddef
789
790 %define DALI_ACTOR_EVENTHANDLER_PARAM( NameSpace, ClassName)
791
792 ACTOR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
793 ACTOR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
794
795 %enddef
796
797 %define DALI_CONST_VECTOR4_REF_TO_COLOR_CONVERSION
798 %typemap(cstype) (const Vector4& color) "Dali.CSharp.Color"
799 %typemap(csin,
800          pre=" Vector4 temp$csinput = new Vector4($csinput.R, $csinput.G, $csinput.B, $csinput.A);",
801          cshin="ref $csinput"
802         ) (const Vector4& color) "$csclassname.getCPtr(temp$csinput)"
803
804 %enddef
805
806 %define DALI_VECTOR2_TO_SIZE_CONVERSION
807 %typemap(cstype) (const Vector2& position) "Dali.CSharp.Size"
808 %typemap(csin,
809          pre=" Vector2 temp$csinput = new Vector2($csinput.W, $csinput.H);",
810          cshin="ref $csinput"
811         ) (const Vector2& position) "$csclassname.getCPtr(temp$csinput)"
812
813 %enddef
814
815 namespace Dali
816 {
817   DALI_ACTOR_EVENTHANDLER_PARAM( Dali, Actor);
818   DALI_CONST_VECTOR4_REF_TO_COLOR_CONVERSION;
819   DALI_VECTOR2_TO_SIZE_CONVERSION;
820 }