472ea16fafbc96863035c23197b8d524a8aef5c8
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Animatable.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 Tizen.NUI
18 {
19
20     /// <summary>
21     /// Animatable.
22     /// </summary>
23     public class Animatable : BaseHandle
24     {
25         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
26
27         internal Animatable(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Handle_SWIGUpcast(cPtr), cMemoryOwn)
28         {
29             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
30         }
31
32         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animatable obj)
33         {
34             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
35         }
36
37         protected override void Dispose(DisposeTypes type)
38         {
39             if (disposed)
40             {
41                 return;
42             }
43
44             if (type == DisposeTypes.Explicit)
45             {
46                 //Called by User
47                 //Release your own managed resources here.
48                 //You should release all of your own disposable objects here.
49
50             }
51
52             //Release your own unmanaged resources here.
53             //You should not access any managed member here except static instance.
54             //because the execution order of Finalizes is non-deterministic.
55
56             if (swigCPtr.Handle != global::System.IntPtr.Zero)
57             {
58                 if (swigCMemOwn)
59                 {
60                     swigCMemOwn = false;
61                     NDalicPINVOKE.delete_Handle(swigCPtr);
62                 }
63                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
64             }
65
66             base.Dispose(type);
67         }
68
69         /// <summary>
70         /// Create an instance of animatable.
71         /// </summary>
72         /// <since_tizen> 3 </since_tizen>
73         public Animatable() : this(NDalicPINVOKE.Handle_New(), true)
74         {
75             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76
77         }
78
79         internal uint GetPropertyCount()
80         {
81             uint ret = NDalicPINVOKE.Handle_GetPropertyCount(swigCPtr);
82             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
83             return ret;
84         }
85
86         /// <summary>
87         /// Queries the name of a property.
88         /// </summary>
89         /// <param name="index">The index of the property.</param>
90         /// <returns>The name of the property.</returns>
91         /// <since_tizen> 3 </since_tizen>
92         public string GetPropertyName(int index)
93         {
94             string ret = NDalicPINVOKE.Handle_GetPropertyName(swigCPtr, index);
95             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96             return ret;
97         }
98
99         /// <summary>
100         /// Queries the index of a property.
101         /// </summary>
102         /// <param name="name">The name of the property.</param>
103         /// <returns>The index of the property.</returns>
104         /// <since_tizen> 3 </since_tizen>
105         public int GetPropertyIndex(string name)
106         {
107             int ret = NDalicPINVOKE.Handle_GetPropertyIndex(swigCPtr, name);
108             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109             return ret;
110         }
111
112         /// <summary>
113         /// Queries whether a property can be writable.
114         /// </summary>
115         /// <param name="index">The index of the property.</param>
116         /// <returns>True if the property is writable.</returns>
117         /// <since_tizen> 3 </since_tizen>
118         public bool IsPropertyWritable(int index)
119         {
120             bool ret = NDalicPINVOKE.Handle_IsPropertyWritable(swigCPtr, index);
121             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122             return ret;
123         }
124
125         /// <summary>
126         /// whether a writable property can be the target of an animation.
127         /// </summary>
128         /// <param name="index">The index of the property.</param>
129         /// <returns>True if the property is animatable.</returns>
130         /// <since_tizen> 3 </since_tizen>
131         public bool IsPropertyAnimatable(int index)
132         {
133             bool ret = NDalicPINVOKE.Handle_IsPropertyAnimatable(swigCPtr, index);
134             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135             return ret;
136         }
137
138         /// <summary>
139         /// Queries the type of a property.
140         /// </summary>
141         /// <param name="index">The index of the property.</param>
142         /// <returns>The type of the property.</returns>
143         /// <since_tizen> 3 </since_tizen>
144         public PropertyType GetPropertyType(int index)
145         {
146             PropertyType ret = (PropertyType)NDalicPINVOKE.Handle_GetPropertyType(swigCPtr, index);
147             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148             return ret;
149         }
150
151         /// <summary>
152         /// Sets the value of an existing property.
153         /// </summary>
154         /// <param name="index">The index of the property.</param>
155         /// <param name="propertyValue">The new value of the property.</param>
156         /// <since_tizen> 3 </since_tizen>
157         public void SetProperty(int index, PropertyValue propertyValue)
158         {
159             Tizen.NUI.Object.SetProperty(swigCPtr, index, propertyValue);
160         }
161
162         /// <summary>
163         /// Registers a new animatable property.
164         /// </summary>
165         /// <param name="name">The name of the property.</param>
166         /// <param name="propertyValue">The new value of the property.</param>
167         /// <returns>The type of the property.</returns>
168         /// <since_tizen> 3 </since_tizen>
169         public int RegisterProperty(string name, PropertyValue propertyValue)
170         {
171             int ret = NDalicPINVOKE.Handle_RegisterProperty__SWIG_0(swigCPtr, name, PropertyValue.getCPtr(propertyValue));
172             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173             return ret;
174         }
175
176         /// <summary>
177         /// Registers a new animatable property.
178         /// </summary>
179         /// <param name="name">The name of the property.</param>
180         /// <param name="propertyValue">The new value of the property.</param>
181         /// <param name="accessMode">The property access mode (writable, animatable etc).</param>
182         /// <returns>The type of the property.</returns>
183         /// <since_tizen> 3 </since_tizen>
184         public int RegisterProperty(string name, PropertyValue propertyValue, PropertyAccessMode accessMode)
185         {
186             int ret = NDalicPINVOKE.Handle_RegisterProperty__SWIG_1(swigCPtr, name, PropertyValue.getCPtr(propertyValue), (int)accessMode);
187             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188             return ret;
189         }
190
191         /// <summary>
192         /// Retrieves a property value.
193         /// </summary>
194         /// <param name="index">The index of the property.</param>
195         /// <returns>The property value.</returns>
196         /// <since_tizen> 3 </since_tizen>
197         public PropertyValue GetProperty(int index)
198         {
199             PropertyValue ret = Tizen.NUI.Object.GetProperty(swigCPtr, index);
200             return ret;
201         }
202
203         /// <summary>
204         /// Adds a property notification to this object.
205         /// </summary>
206         /// <param name="property">The name of the property.</param>
207         /// <param name="condition">The notification will be triggered when this condition is satisfied.</param>
208         /// <returns>A handle to the newly created PropertyNotification.</returns>
209         /// <since_tizen> 4 </since_tizen>
210         public PropertyNotification AddPropertyNotification(string property, PropertyCondition condition)
211         {
212             PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.Handle_AddPropertyNotification__SWIG_0(swigCPtr, PropertyHelper.GetPropertyFromString(this, property).propertyIndex, PropertyCondition.getCPtr(condition)), true);
213             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214             return ret;
215         }
216
217         internal PropertyNotification AddPropertyNotification(int index, int componentIndex, PropertyCondition condition)
218         {
219             PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.Handle_AddPropertyNotification__SWIG_1(swigCPtr, index, componentIndex, PropertyCondition.getCPtr(condition)), true);
220             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221             return ret;
222         }
223
224         /// <summary>
225         /// Removes a property notification from this object.
226         /// </summary>
227         /// <param name="propertyNotification">The propertyNotification to be removed.</param>
228         /// <since_tizen> 4 </since_tizen>
229         public void RemovePropertyNotification(PropertyNotification propertyNotification)
230         {
231             NDalicPINVOKE.Handle_RemovePropertyNotification(swigCPtr, PropertyNotification.getCPtr(propertyNotification));
232             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233         }
234
235         /// <summary>
236         /// Removes a property notification from this object.
237         /// </summary>
238         /// <since_tizen> 4 </since_tizen>
239         public void RemovePropertyNotifications()
240         {
241             NDalicPINVOKE.Handle_RemovePropertyNotifications(swigCPtr);
242             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243         }
244
245         internal void RemoveConstraints()
246         {
247             NDalicPINVOKE.Handle_RemoveConstraints__SWIG_0(swigCPtr);
248             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249         }
250
251         internal void RemoveConstraints(uint tag)
252         {
253             NDalicPINVOKE.Handle_RemoveConstraints__SWIG_1(swigCPtr, tag);
254             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
255         }
256
257         /// <summary>
258         /// Enumeration for Handle's capabilities that can be queried.
259         /// </summary>
260         /// <since_tizen> 3 </since_tizen>
261         public enum Capability
262         {
263             DYNAMIC_PROPERTIES = 0x01
264         }
265
266     }
267
268 }