Merge "[NUI] Add Extents type Padding in View"
[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         /// <since_tizen> 3 </since_tizen>
71         public class Property : global::System.IDisposable
72         {
73             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
74             /// <since_tizen> 3 </since_tizen>
75             protected bool swigCMemOwn;
76
77             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
78             {
79                 swigCMemOwn = cMemoryOwn;
80                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
81             }
82
83             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
84             {
85                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
86             }
87
88             //A Flag to check who called Dispose(). (By User or DisposeQueue)
89             private bool isDisposeQueued = false;
90             //A Flat to check if it is already disposed.
91             /// <since_tizen> 3 </since_tizen>
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             /// <since_tizen> 3 </since_tizen>
105             public void Dispose()
106             {
107                 //Throw excpetion if Dispose() is called in separate thread.
108                 if (!Window.IsInstalled())
109                 {
110                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
111                 }
112
113                 if (isDisposeQueued)
114                 {
115                     Dispose(DisposeTypes.Implicit);
116                 }
117                 else
118                 {
119                     Dispose(DisposeTypes.Explicit);
120                     System.GC.SuppressFinalize(this);
121                 }
122             }
123
124             /// <since_tizen> 3 </since_tizen>
125             protected virtual void Dispose(DisposeTypes type)
126             {
127                 if (disposed)
128                 {
129                     return;
130                 }
131
132                 if (type == DisposeTypes.Explicit)
133                 {
134                     //Called by User
135                     //Release your own managed resources here.
136                     //You should release all of your own disposable objects here.
137
138                 }
139
140                 //Release your own unmanaged resources here.
141                 //You should not access any managed member here except static instance.
142                 //because the execution order of Finalizes is non-deterministic.
143
144                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
145                 {
146                     if (swigCMemOwn)
147                     {
148                         swigCMemOwn = false;
149                         NDalicPINVOKE.delete_PathConstrainer_Property(swigCPtr);
150                     }
151                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
152                 }
153
154                 disposed = true;
155             }
156
157             /// <since_tizen> 3 </since_tizen>
158             public Property() : this(NDalicPINVOKE.new_PathConstrainer_Property(), true)
159             {
160                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161             }
162
163             internal static readonly int FORWARD = NDalicPINVOKE.PathConstrainer_Property_FORWARD_get();
164             internal static readonly int POINTS = NDalicPINVOKE.PathConstrainer_Property_POINTS_get();
165             internal static readonly int CONTROL_POINTS = NDalicPINVOKE.PathConstrainer_Property_CONTROL_POINTS_get();
166
167         }
168
169         public PathConstrainer() : this(NDalicPINVOKE.PathConstrainer_New(), true)
170         {
171             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172
173         }
174         public static PathConstrainer DownCast(BaseHandle handle)
175         {
176             PathConstrainer ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as PathConstrainer;
177             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178             return ret;
179         }
180
181         internal PathConstrainer(PathConstrainer handle) : this(NDalicPINVOKE.new_PathConstrainer__SWIG_1(PathConstrainer.getCPtr(handle)), true)
182         {
183             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184         }
185
186         internal PathConstrainer Assign(PathConstrainer rhs)
187         {
188             PathConstrainer ret = new PathConstrainer(NDalicPINVOKE.PathConstrainer_Assign(swigCPtr, PathConstrainer.getCPtr(rhs)), false);
189             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190             return ret;
191         }
192
193         public void Apply(Property target, Property source, Vector2 range, Vector2 wrap)
194         {
195             NDalicPINVOKE.PathConstrainer_Apply__SWIG_0(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range), Vector2.getCPtr(wrap));
196             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197         }
198
199         public void Apply(Property target, Property source, Vector2 range)
200         {
201             NDalicPINVOKE.PathConstrainer_Apply__SWIG_1(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range));
202             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203         }
204
205         internal void Remove(Animatable target)
206         {
207             NDalicPINVOKE.PathConstrainer_Remove(swigCPtr, Animatable.getCPtr(target));
208             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209         }
210
211         public Vector3 Forward
212         {
213             get
214             {
215                 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
216                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.FORWARD).Get(temp);
217                 return temp;
218             }
219             set
220             {
221                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.FORWARD, new Tizen.NUI.PropertyValue(value));
222             }
223         }
224
225         public PropertyArray Points
226         {
227             get
228             {
229                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
230                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.POINTS).Get(temp);
231                 return temp;
232             }
233             set
234             {
235                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.POINTS, new Tizen.NUI.PropertyValue(value));
236             }
237         }
238
239         public PropertyArray ControlPoints
240         {
241             get
242             {
243                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
244                 Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.CONTROL_POINTS).Get(temp);
245                 return temp;
246             }
247             set
248             {
249                 Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.CONTROL_POINTS, new Tizen.NUI.PropertyValue(value));
250             }
251         }
252
253     }
254
255 }