Release 4.0.0-preview1-00301
[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             int ret = NDalicPINVOKE.Handle_GetPropertyIndex(swigCPtr, name);
113             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114             return ret;
115         }
116
117         /// <summary>
118         /// Queries whether a property can be writable.
119         /// </summary>
120         /// <param name="index">The index of the property.</param>
121         /// <returns>True if the property is writable.</returns>
122         /// <since_tizen> 3 </since_tizen>
123         public bool IsPropertyWritable(int index)
124         {
125             bool ret = NDalicPINVOKE.Handle_IsPropertyWritable(swigCPtr, index);
126             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127             return ret;
128         }
129
130         /// <summary>
131         /// whether a writable property can be the target of an animation.
132         /// </summary>
133         /// <param name="index">The index of the property.</param>
134         /// <returns>True if the property is animatable.</returns>
135         /// <since_tizen> 3 </since_tizen>
136         public bool IsPropertyAnimatable(int index)
137         {
138             bool ret = NDalicPINVOKE.Handle_IsPropertyAnimatable(swigCPtr, index);
139             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140             return ret;
141         }
142
143         /// <summary>
144         /// Queries the type of a property.
145         /// </summary>
146         /// <param name="index">The index of the property.</param>
147         /// <returns>The type of the property.</returns>
148         /// <since_tizen> 3 </since_tizen>
149         public PropertyType GetPropertyType(int index)
150         {
151             PropertyType ret = (PropertyType)NDalicPINVOKE.Handle_GetPropertyType(swigCPtr, index);
152             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153             return ret;
154         }
155
156         /// <summary>
157         /// Sets the value of an existing property.
158         /// </summary>
159         /// <param name="index">The index of the property.</param>
160         /// <param name="propertyValue">The new value of the property.</param>
161         /// <since_tizen> 3 </since_tizen>
162         public void SetProperty(int index, PropertyValue propertyValue)
163         {
164             Tizen.NUI.Object.SetProperty(swigCPtr, index, propertyValue);
165         }
166
167         /// <summary>
168         /// Registers a new animatable property.
169         /// </summary>
170         /// <param name="name">The name of the property.</param>
171         /// <param name="propertyValue">The new value of the property.</param>
172         /// <returns>The type of the property.</returns>
173         /// <since_tizen> 3 </since_tizen>
174         public int RegisterProperty(string name, PropertyValue propertyValue)
175         {
176             int ret = NDalicPINVOKE.Handle_RegisterProperty__SWIG_0(swigCPtr, name, PropertyValue.getCPtr(propertyValue));
177             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178             return ret;
179         }
180
181         /// <summary>
182         /// Registers a new animatable property.
183         /// </summary>
184         /// <param name="name">The name of the property.</param>
185         /// <param name="propertyValue">The new value of the property.</param>
186         /// <param name="accessMode">The property access mode (writable, animatable etc).</param>
187         /// <returns>The type of the property.</returns>
188         /// <since_tizen> 3 </since_tizen>
189         public int RegisterProperty(string name, PropertyValue propertyValue, PropertyAccessMode accessMode)
190         {
191             int ret = NDalicPINVOKE.Handle_RegisterProperty__SWIG_1(swigCPtr, name, PropertyValue.getCPtr(propertyValue), (int)accessMode);
192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193             return ret;
194         }
195
196         /// <summary>
197         /// Retrieves a property value.
198         /// </summary>
199         /// <param name="index">The index of the property.</param>
200         /// <returns>The property value.</returns>
201         /// <since_tizen> 3 </since_tizen>
202         public PropertyValue GetProperty(int index)
203         {
204             PropertyValue ret = Tizen.NUI.Object.GetProperty(swigCPtr, index);
205             return ret;
206         }
207
208         /// <summary>
209         /// Adds a property notification to this object.
210         /// </summary>
211         /// <param name="property">The name of the property.</param>
212         /// <param name="condition">The notification will be triggered when this condition is satisfied.</param>
213         /// <returns>A handle to the newly created PropertyNotification.</returns>
214         /// <since_tizen> 4 </since_tizen>
215         public PropertyNotification AddPropertyNotification(string property, PropertyCondition condition)
216         {
217             PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.Handle_AddPropertyNotification__SWIG_0(swigCPtr, PropertyHelper.GetPropertyFromString(this, property).propertyIndex, PropertyCondition.getCPtr(condition)), true);
218             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219             return ret;
220         }
221
222         internal PropertyNotification AddPropertyNotification(int index, int componentIndex, PropertyCondition condition)
223         {
224             PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.Handle_AddPropertyNotification__SWIG_1(swigCPtr, index, componentIndex, PropertyCondition.getCPtr(condition)), true);
225             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226             return ret;
227         }
228
229         /// <summary>
230         /// Removes a property notification from this object.
231         /// </summary>
232         /// <param name="propertyNotification">The propertyNotification to be removed.</param>
233         /// <since_tizen> 4 </since_tizen>
234         public void RemovePropertyNotification(PropertyNotification propertyNotification)
235         {
236             NDalicPINVOKE.Handle_RemovePropertyNotification(swigCPtr, PropertyNotification.getCPtr(propertyNotification));
237             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
238         }
239
240         /// <summary>
241         /// Removes a property notification from this object.
242         /// </summary>
243         /// <since_tizen> 4 </since_tizen>
244         public void RemovePropertyNotifications()
245         {
246             NDalicPINVOKE.Handle_RemovePropertyNotifications(swigCPtr);
247             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248         }
249
250         internal void RemoveConstraints()
251         {
252             NDalicPINVOKE.Handle_RemoveConstraints__SWIG_0(swigCPtr);
253             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254         }
255
256         internal void RemoveConstraints(uint tag)
257         {
258             NDalicPINVOKE.Handle_RemoveConstraints__SWIG_1(swigCPtr, tag);
259             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260         }
261
262         /// <summary>
263         /// Enumeration for Handle's capabilities that can be queried.
264         /// </summary>
265         /// <since_tizen> 3 </since_tizen>
266         public enum Capability
267         {
268             /// <summary>
269             /// Some objects support dynamic property creation at run-time.
270             /// New properties are registered by calling RegisterProperty() with an unused property name.
271             /// </summary>
272             /// <since_tizen> 3 </since_tizen>
273             DYNAMIC_PROPERTIES = 0x01
274         }
275
276     }
277
278 }