diff options
-rwxr-xr-x | Tizen.NUI/src/internal/NDalic.cs | 42 | ||||
-rwxr-xr-x | Tizen.NUI/src/internal/PropertyHelper.cs | 40 | ||||
-rwxr-xr-x | Tizen.NUI/src/public/Animatable.cs | 8 | ||||
-rwxr-xr-x | Tizen.NUI/src/public/Animation.cs | 55 | ||||
-rwxr-xr-x | Tizen.NUI/src/public/PropertyCondition.cs (renamed from Tizen.NUI/src/internal/PropertyCondition.cs) | 73 | ||||
-rwxr-xr-x | Tizen.NUI/src/public/PropertyNotification.cs (renamed from Tizen.NUI/src/internal/PropertyNotification.cs) | 7 | ||||
-rwxr-xr-x | Tizen.NUI/src/public/PropertyNotifySignal.cs (renamed from Tizen.NUI/src/internal/PropertyNotifySignal.cs) | 5 |
7 files changed, 123 insertions, 107 deletions
diff --git a/Tizen.NUI/src/internal/NDalic.cs b/Tizen.NUI/src/internal/NDalic.cs index b9b3ce3..13697ac 100755 --- a/Tizen.NUI/src/internal/NDalic.cs +++ b/Tizen.NUI/src/internal/NDalic.cs @@ -187,48 +187,6 @@ namespace Tizen.NUI return ret; } - public static PropertyCondition LessThanCondition(float arg) - { - PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.LessThanCondition(arg), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public static PropertyCondition GreaterThanCondition(float arg) - { - PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.GreaterThanCondition(arg), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public static PropertyCondition InsideCondition(float arg0, float arg1) - { - PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.InsideCondition(arg0, arg1), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public static PropertyCondition OutsideCondition(float arg0, float arg1) - { - PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.OutsideCondition(arg0, arg1), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public static PropertyCondition StepCondition(float stepAmount, float initialValue) - { - PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.StepCondition__SWIG_0(stepAmount, initialValue), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public static PropertyCondition StepCondition(float stepAmount) - { - PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.StepCondition__SWIG_1(stepAmount), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public static int WEIGHT { get diff --git a/Tizen.NUI/src/internal/PropertyHelper.cs b/Tizen.NUI/src/internal/PropertyHelper.cs new file mode 100755 index 0000000..e2b6311 --- /dev/null +++ b/Tizen.NUI/src/internal/PropertyHelper.cs @@ -0,0 +1,40 @@ +/** 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. +* +*/ + +namespace Tizen.NUI +{ + internal static class PropertyHelper + { + ///<summary> + /// Returns a Property if stringProperty is a valid index + ///</summary> + internal static Property GetPropertyFromString(Animatable handle, string stringProperty) + { + /// Convert property string to be lowercase + string str1 = stringProperty.Substring(0, 1); + string str2 = stringProperty.Substring(1); + string str = str1.ToLower() + str2; + + Property property = new Property(handle, str); + if (property.propertyIndex == Property.INVALID_INDEX) + { + throw new System.ArgumentException("string property is invalid"); + } + + return property; + } + } +} diff --git a/Tizen.NUI/src/public/Animatable.cs b/Tizen.NUI/src/public/Animatable.cs index 578477f..b5c056e 100755 --- a/Tizen.NUI/src/public/Animatable.cs +++ b/Tizen.NUI/src/public/Animatable.cs @@ -137,9 +137,9 @@ namespace Tizen.NUI return ret; } - internal PropertyNotification AddPropertyNotification(int index, PropertyCondition condition) + public PropertyNotification AddPropertyNotification(string property, PropertyCondition condition) { - PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.Handle_AddPropertyNotification__SWIG_0(swigCPtr, index, PropertyCondition.getCPtr(condition)), true); + 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; } @@ -151,13 +151,13 @@ namespace Tizen.NUI return ret; } - internal void RemovePropertyNotification(PropertyNotification propertyNotification) + public void RemovePropertyNotification(PropertyNotification propertyNotification) { NDalicPINVOKE.Handle_RemovePropertyNotification(swigCPtr, PropertyNotification.getCPtr(propertyNotification)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal void RemovePropertyNotifications() + public void RemovePropertyNotifications() { NDalicPINVOKE.Handle_RemovePropertyNotifications(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); diff --git a/Tizen.NUI/src/public/Animation.cs b/Tizen.NUI/src/public/Animation.cs index ba4e606..312ad08 100755 --- a/Tizen.NUI/src/public/Animation.cs +++ b/Tizen.NUI/src/public/Animation.cs @@ -458,15 +458,7 @@ namespace Tizen.NUI /// <param name="alphaFunction">The alpha function to apply</param> public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null) { - string _str1 = property.Substring(0, 1); - string _str2 = property.Substring(1); - string _str = _str1.ToLower() + _str2; - - Property _prop = new Property(target, _str); - if (_prop.propertyIndex == Property.INVALID_INDEX) - { - throw new System.ArgumentException("second argument string property is invalid parameter!"); - } + Property _prop = PropertyHelper.GetPropertyFromString(target, property); PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex); if(propertyType.Equals(PropertyType.Float)) @@ -502,15 +494,7 @@ namespace Tizen.NUI /// <param name="alphaFunction">The alpha function to apply</param> public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null) { - string _str1 = property.Substring(0, 1); - string _str2 = property.Substring(1); - string _str = _str1.ToLower() + _str2; - - Property _prop = new Property(target, _str); - if (_prop.propertyIndex == Property.INVALID_INDEX) - { - throw new System.ArgumentException("second argument string property is invalid parameter!"); - } + Property _prop = PropertyHelper.GetPropertyFromString(target, property); PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex); if(propertyType.Equals(PropertyType.Float)) @@ -546,15 +530,7 @@ namespace Tizen.NUI /// <param name="alphaFunction">The alpha function to apply</param> public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null) { - string _str1 = property.Substring(0, 1); - string _str2 = property.Substring(1); - string _str = _str1.ToLower() + _str2; - - Property _prop = new Property(target, _str); - if (_prop.propertyIndex == Property.INVALID_INDEX) - { - throw new System.ArgumentException("second argument string property is invalid parameter!"); - } + Property _prop = PropertyHelper.GetPropertyFromString(target, property); PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex); if(propertyType.Equals(PropertyType.Float)) @@ -591,15 +567,7 @@ namespace Tizen.NUI /// <param name="alphaFunction">The alpha function to apply</param> public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null) { - string _str1 = property.Substring(0, 1); - string _str2 = property.Substring(1); - string _str = _str1.ToLower() + _str2; - - Property _prop = new Property(target, _str); - if (_prop.propertyIndex == Property.INVALID_INDEX) - { - throw new System.ArgumentException("second argument string property is invalid parameter!"); - } + Property _prop = PropertyHelper.GetPropertyFromString(target, property); PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex); if(propertyType.Equals(PropertyType.Float)) @@ -636,11 +604,8 @@ namespace Tizen.NUI /// <param name="alphaFunction">The alpha function to apply</param> public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null) { - string _str1 = property.Substring(0, 1); - string _str2 = property.Substring(1); - string _str = _str1.ToLower() + _str2; + Property _prop = PropertyHelper.GetPropertyFromString(target, property); - Property _prop = new Property(target, _str); if (_prop.propertyIndex == Property.INVALID_INDEX) { throw new System.ArgumentException("second argument string property is invalid parameter!"); @@ -669,15 +634,7 @@ namespace Tizen.NUI /// <param name="alphaFunction">The alpha function to apply</param> public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null) { - string _str1 = property.Substring(0, 1); - string _str2 = property.Substring(1); - string _str = _str1.ToLower() + _str2; - - Property _prop = new Property(target, _str); - if (_prop.propertyIndex == Property.INVALID_INDEX) - { - throw new System.ArgumentException("second argument string property is invalid parameter!"); - } + Property _prop = PropertyHelper.GetPropertyFromString(target, property); Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); if (alphaFunction != null) diff --git a/Tizen.NUI/src/internal/PropertyCondition.cs b/Tizen.NUI/src/public/PropertyCondition.cs index 278349f..4fc3f66 100755 --- a/Tizen.NUI/src/internal/PropertyCondition.cs +++ b/Tizen.NUI/src/public/PropertyCondition.cs @@ -16,8 +16,10 @@ namespace Tizen.NUI { - - internal class PropertyCondition : BaseHandle + /// <summary> + /// A condition that can be evaluated on a Property Value + /// </summary> + public class PropertyCondition : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; @@ -69,28 +71,81 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - public PropertyCondition(PropertyCondition handle) : this(NDalicPINVOKE.new_PropertyCondition__SWIG_1(PropertyCondition.getCPtr(handle)), true) + /// <summary> + /// Retrieves the arguments that this condition uses. + /// </summary> + public uint GetArgumentCount() { + uint ret = NDalicPINVOKE.PropertyCondition_GetArgumentCount(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + ///<summary> + /// Retrieves the arguments that this condition uses + ///</summary> + public float GetArgument(uint index) + { + float ret = NDalicPINVOKE.PropertyCondition_GetArgument(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; } - public PropertyCondition Assign(PropertyCondition rhs) + ///<summary> + /// LessThan condition compares whether property is less than arg. + ///</summary> + public static PropertyCondition LessThan(float arg) { - PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.PropertyCondition_Assign(swigCPtr, PropertyCondition.getCPtr(rhs)), false); + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.LessThanCondition(arg), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - public uint GetArgumentCount() + ///<summary> + /// GreaterThan condition compares whether property is greater than arg. + ///</summary> + public static PropertyCondition GreaterThan(float arg) { - uint ret = NDalicPINVOKE.PropertyCondition_GetArgumentCount(swigCPtr); + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.GreaterThanCondition(arg), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - public float GetArgument(uint index) + ///<summary> + /// Inside condition compares whether property is greater than arg0 and less than arg1. + ///</summary> + public static PropertyCondition Inside(float arg0, float arg1) { - float ret = NDalicPINVOKE.PropertyCondition_GetArgument(swigCPtr, index); + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.InsideCondition(arg0, arg1), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + ///<summary> + /// Outside condition compares whether property is less than arg0 or greater than arg1 + ///</summary> + public static PropertyCondition Outside(float arg0, float arg1) + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.OutsideCondition(arg0, arg1), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + ///<summary> + /// Detects when a property changes by stepAmount from initialValue, in both positive and negative directions. This will continue checking for multiples of stepAmount. + ///</summary> + public static PropertyCondition Step(float stepAmount, float initialValue) + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.StepCondition__SWIG_0(stepAmount, initialValue), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + ///<summary> + /// Receives notifications as a property goes above/below the inputted values. Values must be ordered and can be either ascending or descending. + ///</summary> + public static PropertyCondition Step(float stepAmount) + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.StepCondition__SWIG_1(stepAmount), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } diff --git a/Tizen.NUI/src/internal/PropertyNotification.cs b/Tizen.NUI/src/public/PropertyNotification.cs index 50dc344..3b0fc65 100755 --- a/Tizen.NUI/src/internal/PropertyNotification.cs +++ b/Tizen.NUI/src/public/PropertyNotification.cs @@ -20,8 +20,11 @@ namespace Tizen.NUI using System; using System.Runtime.InteropServices; - - internal class PropertyNotification : BaseHandle + ///<summary> + /// Issues a notification upon a condition of the property being met. + /// See PropertyCondition for available defined conditions. + ///</summary> + public class PropertyNotification : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; diff --git a/Tizen.NUI/src/internal/PropertyNotifySignal.cs b/Tizen.NUI/src/public/PropertyNotifySignal.cs index 59e96cb..4919007 100755 --- a/Tizen.NUI/src/internal/PropertyNotifySignal.cs +++ b/Tizen.NUI/src/public/PropertyNotifySignal.cs @@ -17,7 +17,10 @@ namespace Tizen.NUI { - internal class PropertyNotifySignal : global::System.IDisposable + ///<summary> + /// Signal connection class for PropertyNotification + ///</summary> + public class PropertyNotifySignal : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; |