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