e46ca02bf91be4158d23f75a26f90dcf27943a45
[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
60                     //Unreference this instance from Registry.
61                     Registry.Unregister(this);
62
63                     NDalicPINVOKE.delete_PathConstrainer(swigCPtr);
64                 }
65                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
66             }
67
68             base.Dispose(type);
69         }
70
71
72
73         public class Property : global::System.IDisposable
74         {
75             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
76             protected bool swigCMemOwn;
77
78             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
79             {
80                 swigCMemOwn = cMemoryOwn;
81                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
82             }
83
84             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
85             {
86                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
87             }
88
89             //A Flag to check who called Dispose(). (By User or DisposeQueue)
90             private bool isDisposeQueued = false;
91             //A Flat to check if it is already disposed.
92             protected bool disposed = false;
93
94
95             ~Property()
96             {
97                 if (!isDisposeQueued)
98                 {
99                     isDisposeQueued = true;
100                     DisposeQueue.Instance.Add(this);
101                 }
102             }
103
104             public void Dispose()
105             {
106                 //Throw excpetion if Dispose() is called in separate thread.
107                 if (!Window.IsInstalled())
108                 {
109                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
110                 }
111
112                 if (isDisposeQueued)
113                 {
114                     Dispose(DisposeTypes.Implicit);
115                 }
116                 else
117                 {
118                     Dispose(DisposeTypes.Explicit);
119                     System.GC.SuppressFinalize(this);
120                 }
121             }
122
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_PathConstrainer_Property(swigCPtr);
148                     }
149                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
150                 }
151
152                 disposed = true;
153             }
154
155             public Property() : this(NDalicPINVOKE.new_PathConstrainer_Property(), true)
156             {
157                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158             }
159
160             internal static readonly int FORWARD = NDalicPINVOKE.PathConstrainer_Property_FORWARD_get();
161             internal static readonly int POINTS = NDalicPINVOKE.PathConstrainer_Property_POINTS_get();
162             internal static readonly int CONTROL_POINTS = NDalicPINVOKE.PathConstrainer_Property_CONTROL_POINTS_get();
163
164         }
165
166         public PathConstrainer() : this(NDalicPINVOKE.PathConstrainer_New(), true)
167         {
168             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169
170         }
171         public new static PathConstrainer DownCast(BaseHandle handle)
172         {
173             PathConstrainer ret = new PathConstrainer(NDalicPINVOKE.PathConstrainer_DownCast(BaseHandle.getCPtr(handle)), true);
174             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175             return ret;
176         }
177
178         internal PathConstrainer(PathConstrainer handle) : this(NDalicPINVOKE.new_PathConstrainer__SWIG_1(PathConstrainer.getCPtr(handle)), true)
179         {
180             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181         }
182
183         internal PathConstrainer Assign(PathConstrainer rhs)
184         {
185             PathConstrainer ret = new PathConstrainer(NDalicPINVOKE.PathConstrainer_Assign(swigCPtr, PathConstrainer.getCPtr(rhs)), false);
186             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187             return ret;
188         }
189
190         public void Apply(Property target, Property source, Vector2 range, Vector2 wrap)
191         {
192             NDalicPINVOKE.PathConstrainer_Apply__SWIG_0(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range), Vector2.getCPtr(wrap));
193             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194         }
195
196         public void Apply(Property target, Property source, Vector2 range)
197         {
198             NDalicPINVOKE.PathConstrainer_Apply__SWIG_1(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range));
199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200         }
201
202         internal void Remove(Animatable target)
203         {
204             NDalicPINVOKE.PathConstrainer_Remove(swigCPtr, Animatable.getCPtr(target));
205             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206         }
207
208         public Vector3 Forward
209         {
210             get
211             {
212                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
213                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.FORWARD).Get(temp);
214                 return temp;
215             }
216             set
217             {
218                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.FORWARD, new Tizen.NUI.PropertyValue(value));
219             }
220         }
221
222         public PropertyArray Points
223         {
224             get
225             {
226                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
227                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.POINTS).Get(temp);
228                 return temp;
229             }
230             set
231             {
232                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.POINTS, new Tizen.NUI.PropertyValue(value));
233             }
234         }
235
236         public PropertyArray ControlPoints
237         {
238             get
239             {
240                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
241                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.CONTROL_POINTS).Get(temp);
242                 return temp;
243             }
244             set
245             {
246                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.CONTROL_POINTS, new Tizen.NUI.PropertyValue(value));
247             }
248         }
249
250     }
251
252 }