Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / PathConstrainer.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16
17 namespace Tizen.NUI
18 {
19
20     internal class PathConstrainer : BaseHandle
21     {
22         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
23
24         internal PathConstrainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PathConstrainer_SWIGUpcast(cPtr), cMemoryOwn)
25         {
26             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
27         }
28
29         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PathConstrainer obj)
30         {
31             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
32         }
33
34         protected override void Dispose(DisposeTypes type)
35         {
36             if (disposed)
37             {
38                 return;
39             }
40
41             if (type == DisposeTypes.Explicit)
42             {
43                 //Called by User
44                 //Release your own managed resources here.
45                 //You should release all of your own disposable objects here.
46
47             }
48
49             //Release your own unmanaged resources here.
50             //You should not access any managed member here except static instance.
51             //because the execution order of Finalizes is non-deterministic.
52
53
54             if (swigCPtr.Handle != global::System.IntPtr.Zero)
55             {
56                 if (swigCMemOwn)
57                 {
58                     swigCMemOwn = false;
59                     NDalicPINVOKE.delete_PathConstrainer(swigCPtr);
60                 }
61                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
62             }
63
64             base.Dispose(type);
65         }
66
67
68
69         public class Property : global::System.IDisposable
70         {
71             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
72             protected bool swigCMemOwn;
73
74             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
75             {
76                 swigCMemOwn = cMemoryOwn;
77                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
78             }
79
80             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
81             {
82                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
83             }
84
85             //A Flag to check who called Dispose(). (By User or DisposeQueue)
86             private bool isDisposeQueued = false;
87             //A Flat to check if it is already disposed.
88             protected bool disposed = false;
89
90
91             ~Property()
92             {
93                 if (!isDisposeQueued)
94                 {
95                     isDisposeQueued = true;
96                     DisposeQueue.Instance.Add(this);
97                 }
98             }
99
100             public void Dispose()
101             {
102                 //Throw excpetion if Dispose() is called in separate thread.
103                 if (!Window.IsInstalled())
104                 {
105                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
106                 }
107
108                 if (isDisposeQueued)
109                 {
110                     Dispose(DisposeTypes.Implicit);
111                 }
112                 else
113                 {
114                     Dispose(DisposeTypes.Explicit);
115                     System.GC.SuppressFinalize(this);
116                 }
117             }
118
119             protected virtual void Dispose(DisposeTypes type)
120             {
121                 if (disposed)
122                 {
123                     return;
124                 }
125
126                 if (type == DisposeTypes.Explicit)
127                 {
128                     //Called by User
129                     //Release your own managed resources here.
130                     //You should release all of your own disposable objects here.
131
132                 }
133
134                 //Release your own unmanaged resources here.
135                 //You should not access any managed member here except static instance.
136                 //because the execution order of Finalizes is non-deterministic.
137
138                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
139                 {
140                     if (swigCMemOwn)
141                     {
142                         swigCMemOwn = false;
143                         NDalicPINVOKE.delete_PathConstrainer_Property(swigCPtr);
144                     }
145                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
146                 }
147
148                 disposed = true;
149             }
150
151             public Property() : this(NDalicPINVOKE.new_PathConstrainer_Property(), true)
152             {
153                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154             }
155
156             internal static readonly int FORWARD = NDalicPINVOKE.PathConstrainer_Property_FORWARD_get();
157             internal static readonly int POINTS = NDalicPINVOKE.PathConstrainer_Property_POINTS_get();
158             internal static readonly int CONTROL_POINTS = NDalicPINVOKE.PathConstrainer_Property_CONTROL_POINTS_get();
159
160         }
161
162         public PathConstrainer() : this(NDalicPINVOKE.PathConstrainer_New(), true)
163         {
164             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165
166         }
167         public new static PathConstrainer DownCast(BaseHandle handle)
168         {
169             PathConstrainer ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as PathConstrainer;
170             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171             return ret;
172         }
173
174         internal PathConstrainer(PathConstrainer handle) : this(NDalicPINVOKE.new_PathConstrainer__SWIG_1(PathConstrainer.getCPtr(handle)), true)
175         {
176             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177         }
178
179         internal PathConstrainer Assign(PathConstrainer rhs)
180         {
181             PathConstrainer ret = new PathConstrainer(NDalicPINVOKE.PathConstrainer_Assign(swigCPtr, PathConstrainer.getCPtr(rhs)), false);
182             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183             return ret;
184         }
185
186         public void Apply(Property target, Property source, Vector2 range, Vector2 wrap)
187         {
188             NDalicPINVOKE.PathConstrainer_Apply__SWIG_0(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range), Vector2.getCPtr(wrap));
189             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190         }
191
192         public void Apply(Property target, Property source, Vector2 range)
193         {
194             NDalicPINVOKE.PathConstrainer_Apply__SWIG_1(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range));
195             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196         }
197
198         internal void Remove(Animatable target)
199         {
200             NDalicPINVOKE.PathConstrainer_Remove(swigCPtr, Animatable.getCPtr(target));
201             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202         }
203
204         public Vector3 Forward
205         {
206             get
207             {
208                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
209                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.FORWARD).Get(temp);
210                 return temp;
211             }
212             set
213             {
214                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.FORWARD, new Tizen.NUI.PropertyValue(value));
215             }
216         }
217
218         public PropertyArray Points
219         {
220             get
221             {
222                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
223                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.POINTS).Get(temp);
224                 return temp;
225             }
226             set
227             {
228                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.POINTS, new Tizen.NUI.PropertyValue(value));
229             }
230         }
231
232         public PropertyArray ControlPoints
233         {
234             get
235             {
236                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
237                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.CONTROL_POINTS).Get(temp);
238                 return temp;
239             }
240             set
241             {
242                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.CONTROL_POINTS, new Tizen.NUI.PropertyValue(value));
243             }
244         }
245
246     }
247
248 }