Release 4.0.0-preview1-00301
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / LinearConstrainer.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 namespace Tizen.NUI
19 {
20
21     internal class LinearConstrainer : BaseHandle
22     {
23         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
24
25         internal LinearConstrainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.LinearConstrainer_SWIGUpcast(cPtr), cMemoryOwn)
26         {
27             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
28         }
29
30         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LinearConstrainer obj)
31         {
32             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
33         }
34
35         protected override void Dispose(DisposeTypes type)
36         {
37             if (disposed)
38             {
39                 return;
40             }
41
42             if (type == DisposeTypes.Explicit)
43             {
44                 //Called by User
45                 //Release your own managed resources here.
46                 //You should release all of your own disposable objects here.
47
48             }
49
50             //Release your own unmanaged resources here.
51             //You should not access any managed member here except static instance.
52             //because the execution order of Finalizes is non-deterministic.
53
54
55             if (swigCPtr.Handle != global::System.IntPtr.Zero)
56             {
57                 if (swigCMemOwn)
58                 {
59                     swigCMemOwn = false;
60                     NDalicPINVOKE.delete_LinearConstrainer(swigCPtr);
61                 }
62                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
63             }
64
65             base.Dispose(type);
66         }
67
68         public class Property : global::System.IDisposable
69         {
70             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
71             protected bool swigCMemOwn;
72
73             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
74             {
75                 swigCMemOwn = cMemoryOwn;
76                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
77             }
78
79             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
80             {
81                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
82             }
83
84             //A Flag to check who called Dispose(). (By User or DisposeQueue)
85             private bool isDisposeQueued = false;
86             //A Flat to check if it is already disposed.
87             protected bool disposed = false;
88
89
90             ~Property()
91             {
92                 if (!isDisposeQueued)
93                 {
94                     isDisposeQueued = true;
95                     DisposeQueue.Instance.Add(this);
96                 }
97             }
98
99             public void Dispose()
100             {
101                 //Throw excpetion if Dispose() is called in separate thread.
102                 if (!Window.IsInstalled())
103                 {
104                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
105                 }
106
107                 if (isDisposeQueued)
108                 {
109                     Dispose(DisposeTypes.Implicit);
110                 }
111                 else
112                 {
113                     Dispose(DisposeTypes.Explicit);
114                     System.GC.SuppressFinalize(this);
115                 }
116             }
117
118             protected virtual void Dispose(DisposeTypes type)
119             {
120                 if (disposed)
121                 {
122                     return;
123                 }
124
125                 if (type == DisposeTypes.Explicit)
126                 {
127                     //Called by User
128                     //Release your own managed resources here.
129                     //You should release all of your own disposable objects here.
130
131                 }
132
133                 //Release your own unmanaged resources here.
134                 //You should not access any managed member here except static instance.
135                 //because the execution order of Finalizes is non-deterministic.
136
137                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
138                 {
139                     if (swigCMemOwn)
140                     {
141                         swigCMemOwn = false;
142                         NDalicPINVOKE.delete_LinearConstrainer_Property(swigCPtr);
143                     }
144                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
145                 }
146
147                 disposed = true;
148             }
149
150             internal Property() : this(NDalicPINVOKE.new_LinearConstrainer_Property(), true)
151             {
152                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153             }
154
155             internal static readonly int VALUE = NDalicPINVOKE.LinearConstrainer_Property_VALUE_get();
156             internal static readonly int PROGRESS = NDalicPINVOKE.LinearConstrainer_Property_PROGRESS_get();
157         }
158
159         public LinearConstrainer() : this(NDalicPINVOKE.LinearConstrainer_New(), true)
160         {
161             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162
163         }
164         internal static LinearConstrainer DownCast(BaseHandle handle)
165         {
166             LinearConstrainer ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as LinearConstrainer;
167             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168             return ret;
169         }
170
171         internal LinearConstrainer(LinearConstrainer handle) : this(NDalicPINVOKE.new_LinearConstrainer__SWIG_1(LinearConstrainer.getCPtr(handle)), true)
172         {
173             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174         }
175
176         internal LinearConstrainer Assign(LinearConstrainer rhs)
177         {
178             LinearConstrainer ret = new LinearConstrainer(NDalicPINVOKE.LinearConstrainer_Assign(swigCPtr, LinearConstrainer.getCPtr(rhs)), false);
179             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180             return ret;
181         }
182
183         public void Apply(Property target, Property source, Vector2 range, Vector2 wrap)
184         {
185             NDalicPINVOKE.LinearConstrainer_Apply__SWIG_0(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range), Vector2.getCPtr(wrap));
186             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187         }
188
189         public void Apply(Property target, Property source, Vector2 range)
190         {
191             NDalicPINVOKE.LinearConstrainer_Apply__SWIG_1(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range));
192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193         }
194
195         internal void Remove(Animatable target)
196         {
197             NDalicPINVOKE.LinearConstrainer_Remove(swigCPtr, Animatable.getCPtr(target));
198             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199         }
200
201         public PropertyArray Value
202         {
203             get
204             {
205                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
206                 Tizen.NUI.Object.GetProperty(swigCPtr, LinearConstrainer.Property.VALUE).Get(temp);
207                 return temp;
208             }
209             set
210             {
211                 Tizen.NUI.Object.SetProperty(swigCPtr, LinearConstrainer.Property.VALUE, new Tizen.NUI.PropertyValue(value));
212             }
213         }
214         public PropertyArray Progress
215         {
216             get
217             {
218                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
219                 Tizen.NUI.Object.GetProperty(swigCPtr, LinearConstrainer.Property.PROGRESS).Get(temp);
220                 return temp;
221             }
222             set
223             {
224                 Tizen.NUI.Object.SetProperty(swigCPtr, LinearConstrainer.Property.PROGRESS, new Tizen.NUI.PropertyValue(value));
225             }
226         }
227
228     }
229
230 }