[dali_1.2.40] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / events / actor-event.i
1 /*
2  * Copyright (c) 2017 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 Position CurrentPosition
41     {
42       get
43       {
44         return GetCurrentPosition();
45       }
46     }
47
48     public Size2D Size2D
49     {
50       get
51       {
52         Size temp = new Size(0.0f,0.0f,0.0f);
53         GetProperty( Actor.Property.SIZE).Get(  temp );
54         return new Size2D(temp);
55       }
56       set
57       {
58         SetProperty( Actor.Property.SIZE, new Dali.Property.Value( new Size(value) ) );
59       }
60     }
61
62     public Size CurrentSize
63     {
64       get
65       {
66         return GetCurrentSize();
67       }
68     }
69
70     public Actor Parent
71     {
72       get
73       {
74         return GetParent();
75       }
76     }
77
78     public bool Visibility
79     {
80       get
81       {
82         return IsVisible();
83       }
84     }
85
86     public float Opacity
87     {
88       get
89       {
90         float temp = 0;
91         GetProperty( Actor.Property.OPACITY ).Get( ref temp );
92         return temp;
93       }
94       set
95       {
96         SetProperty( Actor.Property.OPACITY, new Dali.Property.Value( value ) );
97       }
98     }
99
100     public Position2D Position2D
101     {
102       get
103       {
104         Position temp = new Position(0.0f,0.0f,0.0f);
105         GetProperty( Actor.Property.POSITION).Get(  temp );
106         return new Position2D(temp);
107       }
108       set
109       {
110         SetProperty( Actor.Property.POSITION, new Dali.Property.Value( new Position(value) ) );
111       }
112     }
113
114     public Vector2 ScreenPosition
115     {
116       get
117       {
118         Vector2 temp = new Vector2( 0.0f, 0.0f );
119         GetProperty( Actor.Property.SCREEN_POSITION ).Get( temp );
120         return temp;
121       }
122     }
123
124     protected bool PositionUsesAnchorPoint
125     {
126       get
127       {
128         bool temp = false;
129         GetProperty( Actor.Property.POSITION_USES_ANCHOR_POINT ).Get( ref temp );
130         return temp;
131       }
132       set
133       {
134         SetProperty( Actor.Property.POSITION_USES_ANCHOR_POINT, new Dali.Property.Value( value ) );
135       }
136     }
137
138     public bool StateFocusEnable
139     {
140       get
141       {
142         return IsKeyboardFocusable();
143       }
144       set
145       {
146         SetKeyboardFocusable(value);
147       }
148     }
149
150     public bool IsOnStage
151     {
152       get
153       {
154         return OnStage();
155       }
156     }
157
158     public int SiblingOrder
159     {
160       get
161       {
162         int temp = 0;
163         GetProperty( Actor.Property.SIBLING_ORDER ).Get( ref temp );
164         return temp;
165       }
166       set
167       {
168         SetProperty( Actor.Property.SIBLING_ORDER, new Dali.Property.Value( value ) );
169       }
170     }
171
172     public void Show()
173     {
174       SetVisible(true);
175     }
176
177     public void Hide()
178     {
179       SetVisible(false);
180     }
181
182     public void Raise()
183     {
184       NDalicPINVOKE.Raise(swigCPtr);
185       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186     }
187
188     public void Lower()
189     {
190       NDalicPINVOKE.Lower(swigCPtr);
191       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192     }
193
194     public void RaiseToTop()
195     {
196       NDalicPINVOKE.RaiseToTop(swigCPtr);
197       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198     }
199
200     public void LowerToBottom()
201     {
202       NDalicPINVOKE.LowerToBottom(swigCPtr);
203       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204     }
205
206     public void RaiseAbove(Actor target)
207     {
208       NDalicPINVOKE.RaiseAbove(swigCPtr, Actor.getCPtr(target));
209       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210     }
211
212     public void LowerBelow(Actor target)
213     {
214       NDalicPINVOKE.RaiseAbove(swigCPtr, Actor.getCPtr(target));
215       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216     }
217
218 %}
219
220 %enddef
221
222 %define DALI_ACTOR_EVENTHANDLER_PARAM( NameSpace, ClassName)
223
224 ACTOR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
225 ACTOR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
226
227 %enddef
228
229 namespace Dali
230 {
231   DALI_ACTOR_EVENTHANDLER_PARAM( Dali, Actor);
232 }