55d9b0456942239fc476fef63cebed818cb89612
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Common / PropertyCondition.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 using System.ComponentModel;
18
19 namespace Tizen.NUI
20 {
21     /// <summary>
22     /// A condition that can be evaluated on a Property Value
23     /// </summary>
24     /// <since_tizen> 4 </since_tizen>
25     public class PropertyCondition : BaseHandle
26     {
27
28         /// <summary>
29         /// Create a property condition instance.
30         /// </summary>
31         /// <since_tizen> 4 </since_tizen>
32         public PropertyCondition() : this(Interop.PropertyCondition.NewPropertyCondition(), true)
33         {
34             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
35         }
36
37         internal PropertyCondition(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
38         {
39         }
40
41         /// <summary>
42         /// Retrieves the arguments that this condition uses.
43         /// </summary>
44         /// <returns>The arguments used for this condition.</returns>
45         /// <since_tizen> 4 </since_tizen>
46         public uint GetArgumentCount()
47         {
48             uint ret = Interop.PropertyCondition.GetArgumentCount(SwigCPtr);
49             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
50             return ret;
51         }
52
53         /// <summary>
54         /// Retrieves the arguments that this condition uses
55         /// </summary>
56         /// <param name="index">The condition index to get the argument.</param>
57         /// <returns>The arguments used for this condition.</returns>
58         /// <since_tizen> 4 </since_tizen>
59         public float GetArgument(uint index)
60         {
61             float ret = Interop.PropertyCondition.GetArgument(SwigCPtr, index);
62             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63             return ret;
64         }
65
66         /// <summary>
67         /// LessThan condition compares whether property is less than arg.
68         /// </summary>
69         /// <param name="arg">The argument for the condition.</param>
70         /// <returns>A property condition function object.</returns>
71         /// <since_tizen> 4 </since_tizen>
72         public static PropertyCondition LessThan(float arg)
73         {
74             PropertyCondition ret = new PropertyCondition(Interop.PropertyCondition.LessThanCondition(arg), true);
75             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76             return ret;
77         }
78
79         /// <summary>
80         /// GreaterThan condition compares whether property is greater than arg.
81         /// </summary>
82         /// <param name="arg">The argument for the condition.</param>
83         /// <returns>A property condition function object.</returns>
84         /// <since_tizen> 4 </since_tizen>
85         public static PropertyCondition GreaterThan(float arg)
86         {
87             PropertyCondition ret = new PropertyCondition(Interop.PropertyCondition.GreaterThanCondition(arg), true);
88             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89             return ret;
90         }
91
92         /// <summary>
93         /// Inside condition compares whether property is greater than arg0 and less than arg1.
94         /// </summary>
95         /// <param name="arg0">The first argument for the condition.</param>
96         /// <param name="arg1">The second argument for the condition.</param>
97         /// <returns>A property condition function object.</returns>
98         /// <since_tizen> 4 </since_tizen>
99         public static PropertyCondition Inside(float arg0, float arg1)
100         {
101             PropertyCondition ret = new PropertyCondition(Interop.PropertyCondition.InsideCondition(arg0, arg1), true);
102             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103             return ret;
104         }
105
106         /// <summary>
107         /// Outside condition compares whether property is less than arg0 or greater than arg1
108         /// </summary>
109         /// <param name="arg0">The first argument for the condition.</param>
110         /// <param name="arg1">The second argument for the condition.</param>
111         /// <returns>A property condition function object.</returns>
112         /// <since_tizen> 4 </since_tizen>
113         public static PropertyCondition Outside(float arg0, float arg1)
114         {
115             PropertyCondition ret = new PropertyCondition(Interop.PropertyCondition.OutsideCondition(arg0, arg1), true);
116             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117             return ret;
118         }
119
120         /// <summary>
121         /// Detects when a property changes by stepAmount from initialValue, in both positive and negative directions. This will continue checking for multiples of stepAmount.
122         /// </summary>
123         /// <param name="stepAmount">The step size required to trigger condition.</param>
124         /// <param name="initialValue">The initial value to step from.</param>
125         /// <returns>A property condition function object.</returns>
126         /// <since_tizen> 4 </since_tizen>
127         public static PropertyCondition Step(float stepAmount, float initialValue)
128         {
129             PropertyCondition ret = new PropertyCondition(Interop.PropertyCondition.StepCondition(stepAmount, initialValue), true);
130             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131             return ret;
132         }
133
134         /// <summary>
135         /// Receives notifications as a property goes above/below the inputted values. Values must be ordered and can be either ascending or descending.
136         /// </summary>
137         /// <param name="stepAmount">List of values to receive notifications for as a property crosses them.</param>
138         /// <returns>A property condition function object.</returns>
139         /// <since_tizen> 4 </since_tizen>
140         public static PropertyCondition Step(float stepAmount)
141         {
142             PropertyCondition ret = new PropertyCondition(Interop.PropertyCondition.StepCondition(stepAmount), true);
143             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144             return ret;
145         }
146
147         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyCondition obj)
148         {
149             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
150         }
151
152         /// This will not be public opened.
153         [EditorBrowsable(EditorBrowsableState.Never)]
154         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
155         {
156             Interop.PropertyCondition.DeletePropertyCondition(swigCPtr);
157         }
158     }
159 }