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