[NUI] Binds GetCurrentProperty to Animatable class
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Common / Object.cs
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 using global::System.Runtime.InteropServices;
19
20 namespace Tizen.NUI
21 {
22     /// <summary>
23     /// Static Helper class for Property
24     /// Internal
25     /// </summary>
26     /// <since_tizen> 3 </since_tizen>
27     internal static class Object
28     {
29         public static PropertyValue GetProperty(global::System.Runtime.InteropServices.HandleRef handle, int index)
30         {
31             if (handle.Handle == System.IntPtr.Zero)
32             {
33                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
34             }
35
36             PropertyValue ret = new PropertyValue(Interop.Handle.GetProperty(handle, index), true);
37             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
38             return ret;
39         }
40         public static PropertyValue GetCurrentProperty(global::System.Runtime.InteropServices.HandleRef handle, int index)
41         {
42             if (handle.Handle == System.IntPtr.Zero)
43             {
44                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
45             }
46
47             PropertyValue ret = new PropertyValue(Interop.Handle.GetCurrentProperty(handle, index), true);
48             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
49             return ret;
50         }
51
52         public static void SetProperty(global::System.Runtime.InteropServices.HandleRef handle, int index, PropertyValue propertyValue)
53         {
54             if (handle.Handle == System.IntPtr.Zero)
55             {
56                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
57             }
58
59             Interop.Handle.SetProperty(handle, index, PropertyValue.getCPtr(propertyValue));
60             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61         }
62
63         internal static int InternalSetPropertyString(HandleRef actor, int propertyType, string valString)
64         {
65             if (actor.Handle == System.IntPtr.Zero)
66             {
67                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
68             }
69             var ret = Interop.Actor.InternalSetPropertyString(actor, propertyType, valString);
70
71             if (NDalicPINVOKE.SWIGPendingException.Pending)
72             {
73                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74             }
75             return ret;
76         }
77
78         internal static string InternalGetPropertyString(HandleRef actor, int propertyType)
79         {
80             if (actor.Handle == System.IntPtr.Zero)
81             {
82                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
83             }
84             var ret = Interop.Actor.InternalGetPropertyString(actor, propertyType);
85
86             if (NDalicPINVOKE.SWIGPendingException.Pending)
87             {
88                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89             }
90             return ret;
91         }
92
93         internal static int InternalSetPropertyBool(HandleRef actor, int propertyType, bool valBool)
94         {
95             if (actor.Handle == System.IntPtr.Zero)
96             {
97                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
98             }
99             var ret = Interop.Actor.InternalSetPropertyBool(actor, propertyType, valBool);
100
101             if (NDalicPINVOKE.SWIGPendingException.Pending)
102             {
103                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104             }
105             return ret;
106         }
107
108         internal static bool InternalGetPropertyBool(HandleRef actor, int propertyType)
109         {
110             if (actor.Handle == System.IntPtr.Zero)
111             {
112                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
113             }
114             var ret = Interop.Actor.InternalGetPropertyBool(actor, propertyType);
115
116             if (NDalicPINVOKE.SWIGPendingException.Pending)
117             {
118                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119             }
120             return ret;
121         }
122
123         internal static int InternalSetPropertyVector4(HandleRef actor, int propertyType, HandleRef vector4)
124         {
125             if (actor.Handle == System.IntPtr.Zero)
126             {
127                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
128             }
129             var ret = Interop.Actor.InternalSetPropertyVector4(actor, propertyType, vector4);
130
131             if (NDalicPINVOKE.SWIGPendingException.Pending)
132             {
133                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134             }
135             return ret;
136         }
137
138         internal static int InternalRetrievingPropertyVector4(HandleRef actor, int propertyType, HandleRef retrievingVector4)
139         {
140             if (actor.Handle == System.IntPtr.Zero)
141             {
142                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
143             }
144             var ret = Interop.Actor.InternalRetrievingPropertyVector4(actor, propertyType, retrievingVector4);
145
146             if (NDalicPINVOKE.SWIGPendingException.Pending)
147             {
148                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149             }
150             return ret;
151         }
152
153         internal static int InternalGetPropertyInt(HandleRef actor, int propertyType)
154         {
155             if (actor.Handle == System.IntPtr.Zero)
156             {
157                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
158             }
159             var ret = Interop.Actor.InternalGetPropertyInt(actor, propertyType);
160
161             if (NDalicPINVOKE.SWIGPendingException.Pending)
162             {
163                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164             }
165             return ret;
166         }
167
168         internal static int InternalSetPropertyInt(HandleRef actor, int propertyType, int valInt)
169         {
170             if (actor.Handle == System.IntPtr.Zero)
171             {
172                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
173             }
174             var ret = Interop.Actor.InternalSetPropertyInt(actor, propertyType, valInt);
175
176             if (NDalicPINVOKE.SWIGPendingException.Pending)
177             {
178                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179             }
180             return ret;
181         }
182
183         internal static int InternalRetrievingPropertyVector3(HandleRef actor, int propertyType, HandleRef retrievingVector3)
184         {
185             if (actor.Handle == System.IntPtr.Zero)
186             {
187                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
188             }
189             var ret = Interop.Actor.InternalRetrievingPropertyVector3(actor, propertyType, retrievingVector3);
190
191             if (NDalicPINVOKE.SWIGPendingException.Pending)
192             {
193                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194             }
195             return ret;
196         }
197
198         internal static int InternalSetPropertyVector3(HandleRef actor, int propertyType, HandleRef vector3)
199         {
200             if (actor.Handle == System.IntPtr.Zero)
201             {
202                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
203             }
204             var ret = Interop.Actor.InternalSetPropertyVector3(actor, propertyType, vector3);
205
206             if (NDalicPINVOKE.SWIGPendingException.Pending)
207             {
208                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209             }
210             return ret;
211         }
212
213         internal static float InternalGetPropertyFloat(HandleRef actor, int propertyType)
214         {
215             if (actor.Handle == System.IntPtr.Zero)
216             {
217                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
218             }
219             var ret = Interop.Actor.InternalGetPropertyFloat(actor, propertyType);
220
221             if (NDalicPINVOKE.SWIGPendingException.Pending)
222             {
223                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224             }
225             return ret;
226         }
227
228         internal static int InternalSetPropertyFloat(HandleRef actor, int propertyType, float valFloat)
229         {
230             if (actor.Handle == System.IntPtr.Zero)
231             {
232                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
233             }
234             var ret = Interop.Actor.InternalSetPropertyFloat(actor, propertyType, valFloat);
235
236             if (NDalicPINVOKE.SWIGPendingException.Pending)
237             {
238                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239             }
240             return ret;
241         }
242
243         internal static int InternalRetrievingPropertyVector2(HandleRef actor, int propertyType, HandleRef retrievingVector2)
244         {
245             if (actor.Handle == System.IntPtr.Zero)
246             {
247                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
248             }
249             var ret = Interop.Actor.InternalRetrievingPropertyVector2(actor, propertyType, retrievingVector2);
250
251             if (NDalicPINVOKE.SWIGPendingException.Pending)
252             {
253                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254             }
255             return ret;
256         }
257
258         internal static int InternalSetPropertyVector2(HandleRef actor, int propertyType, HandleRef vector2)
259         {
260             if (actor.Handle == System.IntPtr.Zero)
261             {
262                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
263             }
264             var ret = Interop.Actor.InternalSetPropertyVector2(actor, propertyType, vector2);
265
266             if (NDalicPINVOKE.SWIGPendingException.Pending)
267             {
268                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269             }
270             return ret;
271         }
272
273         internal static int InternalRetrievingPropertyVector2ActualVector3(HandleRef actor, int propertyType, HandleRef retrievingVector2)
274         {
275             if (actor.Handle == System.IntPtr.Zero)
276             {
277                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
278             }
279             var ret = Interop.Actor.InternalRetrievingPropertyVector2ActualVector3(actor, propertyType, retrievingVector2);
280
281             if (NDalicPINVOKE.SWIGPendingException.Pending)
282             {
283                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284             }
285             return ret;
286         }
287
288         internal static int InternalSetPropertyVector2ActualVector3(HandleRef actor, int propertyType, HandleRef vector2)
289         {
290             if (actor.Handle == System.IntPtr.Zero)
291             {
292                 throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
293             }
294             var ret = Interop.Actor.InternalSetPropertyVector2ActualVector3(actor, propertyType, vector2);
295
296             if (NDalicPINVOKE.SWIGPendingException.Pending)
297             {
298                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
299             }
300             return ret;
301         }
302     }
303 }