2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 using System.ComponentModel;
26 /// <since_tizen> 3 </since_tizen>
27 public class Animatable : BaseHandle
31 /// Create an instance of animatable.
33 /// <since_tizen> 3 </since_tizen>
34 public Animatable() : this(Interop.Handle.New(), true)
36 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
40 internal Animatable(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Handle.Upcast(cPtr), cMemoryOwn)
45 /// Enumeration for Handle's capabilities that can be queried.
47 /// <since_tizen> 3 </since_tizen>
48 public enum Capability
51 /// Some objects support dynamic property creation at run-time.
52 /// New properties are registered by calling RegisterProperty() with an unused property name.
54 /// <since_tizen> 3 </since_tizen>
55 DYNAMIC_PROPERTIES = 0x01
59 /// Queries the name of a property.
61 /// <param name="index">The index of the property.</param>
62 /// <returns>The name of the property.</returns>
63 /// <since_tizen> 3 </since_tizen>
64 public string GetPropertyName(int index)
66 string ret = Interop.Handle.GetPropertyName(SwigCPtr, index);
67 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72 /// Queries the index of a property.
74 /// <param name="name">The name of the property.</param>
75 /// <returns>The index of the property.</returns>
76 /// <since_tizen> 3 </since_tizen>
77 public int GetPropertyIndex(string name)
79 // Convert property string to be lowercase
80 StringBuilder sb = new StringBuilder(name);
81 sb[0] = (char)(sb[0] | 0x20);
82 string str = sb.ToString();
84 int ret = Interop.Handle.GetPropertyIndex(SwigCPtr, str);
85 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 /// Queries whether a property can be writable.
92 /// <param name="index">The index of the property.</param>
93 /// <returns>True if the property is writable.</returns>
94 /// <since_tizen> 3 </since_tizen>
95 public bool IsPropertyWritable(int index)
97 bool ret = Interop.Handle.IsPropertyWritable(SwigCPtr, index);
98 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103 /// whether a writable property can be the target of an animation.
105 /// <param name="index">The index of the property.</param>
106 /// <returns>True if the property is animatable.</returns>
107 /// <since_tizen> 3 </since_tizen>
108 public bool IsPropertyAnimatable(int index)
110 bool ret = Interop.Handle.IsPropertyAnimatable(SwigCPtr, index);
111 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116 /// Queries the type of a property.
118 /// <param name="index">The index of the property.</param>
119 /// <returns>The type of the property.</returns>
120 /// <since_tizen> 3 </since_tizen>
121 public PropertyType GetPropertyType(int index)
123 PropertyType ret = (PropertyType)Interop.Handle.GetPropertyType(SwigCPtr, index);
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 /// Sets the value of an existing property.
131 /// <param name="index">The index of the property.</param>
132 /// <param name="propertyValue">The new value of the property.</param>
133 /// <since_tizen> 3 </since_tizen>
134 public void SetProperty(int index, PropertyValue propertyValue)
136 Tizen.NUI.Object.SetProperty(SwigCPtr, index, propertyValue);
140 /// Registers a new animatable property.
142 /// <param name="name">The name of the property.</param>
143 /// <param name="propertyValue">The new value of the property.</param>
144 /// <returns>The type of the property.</returns>
145 /// <since_tizen> 3 </since_tizen>
146 public int RegisterProperty(string name, PropertyValue propertyValue)
148 int ret = Interop.Handle.RegisterProperty(SwigCPtr, name, PropertyValue.getCPtr(propertyValue));
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 /// Registers a new animatable property.
156 /// <param name="name">The name of the property.</param>
157 /// <param name="propertyValue">The new value of the property.</param>
158 /// <param name="accessMode">The property access mode (writable, animatable etc).</param>
159 /// <returns>The type of the property.</returns>
160 /// <since_tizen> 3 </since_tizen>
161 public int RegisterProperty(string name, PropertyValue propertyValue, PropertyAccessMode accessMode)
163 int ret = Interop.Handle.RegisterProperty(SwigCPtr, name, PropertyValue.getCPtr(propertyValue), (int)accessMode);
164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169 /// Retrieves a property value.
171 /// <param name="index">The index of the property.</param>
172 /// <returns>The property value.</returns>
173 /// <since_tizen> 3 </since_tizen>
174 public PropertyValue GetProperty(int index)
176 PropertyValue ret = Tizen.NUI.Object.GetProperty(SwigCPtr, index);
181 /// Adds a property notification to this object.
183 /// <param name="property">The name of the property.</param>
184 /// <param name="condition">The notification will be triggered when this condition is satisfied.</param>
185 /// <returns>A handle to the newly created PropertyNotification.</returns>
186 /// <since_tizen> 4 </since_tizen>
187 public PropertyNotification AddPropertyNotification(string property, PropertyCondition condition)
189 Property properties = PropertyHelper.GetPropertyFromString(this, property);
190 PropertyNotification ret = new PropertyNotification(Interop.Handle.AddPropertyNotification(SwigCPtr, properties.propertyIndex, PropertyCondition.getCPtr(condition)), true);
191 properties.Dispose();
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197 /// Removes a property notification from this object.
199 /// <param name="propertyNotification">The propertyNotification to be removed.</param>
200 /// <since_tizen> 4 </since_tizen>
201 public void RemovePropertyNotification(PropertyNotification propertyNotification)
203 Interop.Handle.RemovePropertyNotification(SwigCPtr, PropertyNotification.getCPtr(propertyNotification));
204 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 /// Removes a property notification from this object.
210 /// <since_tizen> 4 </since_tizen>
211 public void RemovePropertyNotifications()
213 Interop.Handle.RemovePropertyNotifications(SwigCPtr);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animatable obj)
219 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
222 internal uint GetPropertyCount()
224 uint ret = Interop.HandleInternal.HandleGetPropertyCount(SwigCPtr);
225 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
229 internal PropertyNotification AddPropertyNotification(int index, int componentIndex, PropertyCondition condition)
231 PropertyNotification ret = new PropertyNotification(Interop.Handle.AddPropertyNotification(SwigCPtr, index, componentIndex, PropertyCondition.getCPtr(condition)), true);
232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
236 internal void RemoveConstraints()
238 Interop.HandleInternal.HandleRemoveConstraints(SwigCPtr);
239 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
242 internal void RemoveConstraints(uint tag)
244 Interop.HandleInternal.HandleRemoveConstraints(SwigCPtr, tag);
245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248 /// This will not be public opened.
249 [EditorBrowsable(EditorBrowsableState.Never)]
250 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
252 Interop.Handle.DeleteHandle(swigCPtr);