/*
* Copyright(c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System.Text;
namespace Tizen.NUI
{
///
/// Animatable.
///
/// 3
public class Animatable : BaseHandle
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal Animatable(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Handle_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animatable obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
///
/// To make the Animatable instance be disposed.
///
/// 3
protected override void Dispose(DisposeTypes type)
{
if (disposed)
{
return;
}
if (type == DisposeTypes.Explicit)
{
//Called by User
//Release your own managed resources here.
//You should release all of your own disposable objects here.
}
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
if (swigCMemOwn)
{
swigCMemOwn = false;
NDalicPINVOKE.delete_Handle(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
base.Dispose(type);
}
///
/// Create an instance of animatable.
///
/// 3
public Animatable() : this(NDalicPINVOKE.Handle_New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal uint GetPropertyCount()
{
uint ret = NDalicPINVOKE.Handle_GetPropertyCount(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Queries the name of a property.
///
/// The index of the property.
/// The name of the property.
/// 3
public string GetPropertyName(int index)
{
string ret = NDalicPINVOKE.Handle_GetPropertyName(swigCPtr, index);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Queries the index of a property.
///
/// The name of the property.
/// The index of the property.
/// 3
public int GetPropertyIndex(string name)
{
// Convert property string to be lowercase
StringBuilder sb = new StringBuilder(name);
sb[0] = (char)(sb[0] | 0x20);
string str = sb.ToString();
int ret = NDalicPINVOKE.Handle_GetPropertyIndex(swigCPtr, str);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Queries whether a property can be writable.
///
/// The index of the property.
/// True if the property is writable.
/// 3
public bool IsPropertyWritable(int index)
{
bool ret = NDalicPINVOKE.Handle_IsPropertyWritable(swigCPtr, index);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// whether a writable property can be the target of an animation.
///
/// The index of the property.
/// True if the property is animatable.
/// 3
public bool IsPropertyAnimatable(int index)
{
bool ret = NDalicPINVOKE.Handle_IsPropertyAnimatable(swigCPtr, index);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Queries the type of a property.
///
/// The index of the property.
/// The type of the property.
/// 3
public PropertyType GetPropertyType(int index)
{
PropertyType ret = (PropertyType)NDalicPINVOKE.Handle_GetPropertyType(swigCPtr, index);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Sets the value of an existing property.
///
/// The index of the property.
/// The new value of the property.
/// 3
public void SetProperty(int index, PropertyValue propertyValue)
{
Tizen.NUI.Object.SetProperty(swigCPtr, index, propertyValue);
}
///
/// Registers a new animatable property.
///
/// The name of the property.
/// The new value of the property.
/// The type of the property.
/// 3
public int RegisterProperty(string name, PropertyValue propertyValue)
{
int ret = NDalicPINVOKE.Handle_RegisterProperty__SWIG_0(swigCPtr, name, PropertyValue.getCPtr(propertyValue));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Registers a new animatable property.
///
/// The name of the property.
/// The new value of the property.
/// The property access mode (writable, animatable etc).
/// The type of the property.
/// 3
public int RegisterProperty(string name, PropertyValue propertyValue, PropertyAccessMode accessMode)
{
int ret = NDalicPINVOKE.Handle_RegisterProperty__SWIG_1(swigCPtr, name, PropertyValue.getCPtr(propertyValue), (int)accessMode);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Retrieves a property value.
///
/// The index of the property.
/// The property value.
/// 3
public PropertyValue GetProperty(int index)
{
PropertyValue ret = Tizen.NUI.Object.GetProperty(swigCPtr, index);
return ret;
}
///
/// Adds a property notification to this object.
///
/// The name of the property.
/// The notification will be triggered when this condition is satisfied.
/// A handle to the newly created PropertyNotification.
/// 4
public PropertyNotification AddPropertyNotification(string property, PropertyCondition condition)
{
PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.Handle_AddPropertyNotification__SWIG_0(swigCPtr, PropertyHelper.GetPropertyFromString(this, property).propertyIndex, PropertyCondition.getCPtr(condition)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal PropertyNotification AddPropertyNotification(int index, int componentIndex, PropertyCondition condition)
{
PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.Handle_AddPropertyNotification__SWIG_1(swigCPtr, index, componentIndex, PropertyCondition.getCPtr(condition)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Removes a property notification from this object.
///
/// The propertyNotification to be removed.
/// 4
public void RemovePropertyNotification(PropertyNotification propertyNotification)
{
NDalicPINVOKE.Handle_RemovePropertyNotification(swigCPtr, PropertyNotification.getCPtr(propertyNotification));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Removes a property notification from this object.
///
/// 4
public void RemovePropertyNotifications()
{
NDalicPINVOKE.Handle_RemovePropertyNotifications(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal void RemoveConstraints()
{
NDalicPINVOKE.Handle_RemoveConstraints__SWIG_0(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal void RemoveConstraints(uint tag)
{
NDalicPINVOKE.Handle_RemoveConstraints__SWIG_1(swigCPtr, tag);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Enumeration for Handle's capabilities that can be queried.
///
/// 3
public enum Capability
{
///
/// Some objects support dynamic property creation at run-time.
/// New properties are registered by calling RegisterProperty() with an unused property name.
///
/// 3
DYNAMIC_PROPERTIES = 0x01
}
}
}