eccb6685077b3dd3327237aa8008a8147e287b0d
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / PathConstrainer.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 PathConstrainer : BaseHandle
22     {
23         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
24
25         internal PathConstrainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PathConstrainer_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(PathConstrainer 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_PathConstrainer(swigCPtr);
61                 }
62                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
63             }
64
65             base.Dispose(type);
66         }
67
68
69
70         public class Property : global::System.IDisposable
71         {
72             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
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             protected bool disposed = false;
90
91
92             ~Property()
93             {
94                 if (!isDisposeQueued)
95                 {
96                     isDisposeQueued = true;
97                     DisposeQueue.Instance.Add(this);
98                 }
99             }
100
101             public void Dispose()
102             {
103                 //Throw excpetion if Dispose() is called in separate thread.
104                 if (!Window.IsInstalled())
105                 {
106                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
107                 }
108
109                 if (isDisposeQueued)
110                 {
111                     Dispose(DisposeTypes.Implicit);
112                 }
113                 else
114                 {
115                     Dispose(DisposeTypes.Explicit);
116                     System.GC.SuppressFinalize(this);
117                 }
118             }
119
120             protected virtual void Dispose(DisposeTypes type)
121             {
122                 if (disposed)
123                 {
124                     return;
125                 }
126
127                 if (type == DisposeTypes.Explicit)
128                 {
129                     //Called by User
130                     //Release your own managed resources here.
131                     //You should release all of your own disposable objects here.
132
133                 }
134
135                 //Release your own unmanaged resources here.
136                 //You should not access any managed member here except static instance.
137                 //because the execution order of Finalizes is non-deterministic.
138
139                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
140                 {
141                     if (swigCMemOwn)
142                     {
143                         swigCMemOwn = false;
144                         NDalicPINVOKE.delete_PathConstrainer_Property(swigCPtr);
145                     }
146                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
147                 }
148
149                 disposed = true;
150             }
151
152             public Property() : this(NDalicPINVOKE.new_PathConstrainer_Property(), true)
153             {
154                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155             }
156
157             internal static readonly int FORWARD = NDalicPINVOKE.PathConstrainer_Property_FORWARD_get();
158             internal static readonly int POINTS = NDalicPINVOKE.PathConstrainer_Property_POINTS_get();
159             internal static readonly int CONTROL_POINTS = NDalicPINVOKE.PathConstrainer_Property_CONTROL_POINTS_get();
160
161         }
162
163         public PathConstrainer() : this(NDalicPINVOKE.PathConstrainer_New(), true)
164         {
165             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166
167         }
168         public static PathConstrainer DownCast(BaseHandle handle)
169         {
170             PathConstrainer ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as PathConstrainer;
171             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172             return ret;
173         }
174
175         internal PathConstrainer(PathConstrainer handle) : this(NDalicPINVOKE.new_PathConstrainer__SWIG_1(PathConstrainer.getCPtr(handle)), true)
176         {
177             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178         }
179
180         internal PathConstrainer Assign(PathConstrainer rhs)
181         {
182             PathConstrainer ret = new PathConstrainer(NDalicPINVOKE.PathConstrainer_Assign(swigCPtr, PathConstrainer.getCPtr(rhs)), false);
183             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184             return ret;
185         }
186
187         public void Apply(Property target, Property source, Vector2 range, Vector2 wrap)
188         {
189             NDalicPINVOKE.PathConstrainer_Apply__SWIG_0(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range), Vector2.getCPtr(wrap));
190             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191         }
192
193         public void Apply(Property target, Property source, Vector2 range)
194         {
195             NDalicPINVOKE.PathConstrainer_Apply__SWIG_1(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range));
196             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197         }
198
199         internal void Remove(Animatable target)
200         {
201             NDalicPINVOKE.PathConstrainer_Remove(swigCPtr, Animatable.getCPtr(target));
202             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203         }
204
205         public Vector3 Forward
206         {
207             get
208             {
209                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
210                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.FORWARD).Get(temp);
211                 return temp;
212             }
213             set
214             {
215                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.FORWARD, new Tizen.NUI.PropertyValue(value));
216             }
217         }
218
219         public PropertyArray Points
220         {
221             get
222             {
223                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
224                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.POINTS).Get(temp);
225                 return temp;
226             }
227             set
228             {
229                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.POINTS, new Tizen.NUI.PropertyValue(value));
230             }
231         }
232
233         public PropertyArray ControlPoints
234         {
235             get
236             {
237                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
238                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.CONTROL_POINTS).Get(temp);
239                 return temp;
240             }
241             set
242             {
243                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.CONTROL_POINTS, new Tizen.NUI.PropertyValue(value));
244             }
245         }
246
247     }
248
249 }