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