Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / RulerPtr.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 RulerPtr : global::System.IDisposable
21     {
22         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
23         protected bool swigCMemOwn;
24
25         internal RulerPtr(global::System.IntPtr cPtr, bool cMemoryOwn)
26         {
27             swigCMemOwn = cMemoryOwn;
28             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
29         }
30
31         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RulerPtr obj)
32         {
33             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
34         }
35
36         //A Flag to check who called Dispose(). (By User or DisposeQueue)
37         private bool isDisposeQueued = false;
38         //A Flat to check if it is already disposed.
39         protected bool disposed = false;
40
41
42         ~RulerPtr()
43         {
44             if (!isDisposeQueued)
45             {
46                 isDisposeQueued = true;
47                 DisposeQueue.Instance.Add(this);
48             }
49         }
50
51         public void Dispose()
52         {
53             //Throw excpetion if Dispose() is called in separate thread.
54             if (!Window.IsInstalled())
55             {
56                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
57             }
58
59             if (isDisposeQueued)
60             {
61                 Dispose(DisposeTypes.Implicit);
62             }
63             else
64             {
65                 Dispose(DisposeTypes.Explicit);
66                 System.GC.SuppressFinalize(this);
67             }
68         }
69
70         protected virtual void Dispose(DisposeTypes type)
71         {
72             if (disposed)
73             {
74                 return;
75             }
76
77             if (type == DisposeTypes.Explicit)
78             {
79                 //Called by User
80                 //Release your own managed resources here.
81                 //You should release all of your own disposable objects here.
82
83             }
84
85             //Release your own unmanaged resources here.
86             //You should not access any managed member here except static instance.
87             //because the execution order of Finalizes is non-deterministic.
88
89             if (swigCPtr.Handle != global::System.IntPtr.Zero)
90             {
91                 if (swigCMemOwn)
92                 {
93                     swigCMemOwn = false;
94                     NDalicPINVOKE.delete_RulerPtr(swigCPtr);
95                 }
96                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
97             }
98
99             disposed = true;
100         }
101
102
103         public RulerPtr() : this(NDalicPINVOKE.new_RulerPtr__SWIG_0(), true)
104         {
105             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106         }
107
108         public RulerPtr(Ruler p) : this(NDalicPINVOKE.new_RulerPtr__SWIG_1(Ruler.getCPtr(p)), true)
109         {
110             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111         }
112
113         public RulerPtr(RulerPtr rhs) : this(NDalicPINVOKE.new_RulerPtr__SWIG_2(RulerPtr.getCPtr(rhs)), true)
114         {
115             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116         }
117
118         public Ruler Get()
119         {
120             global::System.IntPtr cPtr = NDalicPINVOKE.RulerPtr_Get(swigCPtr);
121             Ruler ret = (cPtr == global::System.IntPtr.Zero) ? null : new Ruler(cPtr, false);
122             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123             return ret;
124         }
125
126         public Ruler __deref__()
127         {
128             global::System.IntPtr cPtr = NDalicPINVOKE.RulerPtr___deref__(swigCPtr);
129             Ruler ret = (cPtr == global::System.IntPtr.Zero) ? null : new Ruler(cPtr, false);
130             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131             return ret;
132         }
133
134         public Ruler __ref__()
135         {
136             Ruler ret = new Ruler(NDalicPINVOKE.RulerPtr___ref__(swigCPtr), false);
137             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138             return ret;
139         }
140
141         public RulerPtr Assign(RulerPtr rhs)
142         {
143             RulerPtr ret = new RulerPtr(NDalicPINVOKE.RulerPtr_Assign__SWIG_0(swigCPtr, RulerPtr.getCPtr(rhs)), false);
144             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145             return ret;
146         }
147
148         public RulerPtr Assign(Ruler rhs)
149         {
150             RulerPtr ret = new RulerPtr(NDalicPINVOKE.RulerPtr_Assign__SWIG_1(swigCPtr, Ruler.getCPtr(rhs)), false);
151             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
152             return ret;
153         }
154
155         public void Reset()
156         {
157             NDalicPINVOKE.RulerPtr_Reset__SWIG_0(swigCPtr);
158             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159         }
160
161         public void Reset(Ruler rhs)
162         {
163             NDalicPINVOKE.RulerPtr_Reset__SWIG_1(swigCPtr, Ruler.getCPtr(rhs));
164             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165         }
166
167         public Ruler Detach()
168         {
169             global::System.IntPtr cPtr = NDalicPINVOKE.RulerPtr_Detach(swigCPtr);
170             Ruler ret = (cPtr == global::System.IntPtr.Zero) ? null : new Ruler(cPtr, false);
171             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172             return ret;
173         }
174
175         public float Snap(float x, float bias)
176         {
177             float ret = NDalicPINVOKE.RulerPtr_Snap__SWIG_0(swigCPtr, x, bias);
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179             return ret;
180         }
181
182         public float Snap(float x)
183         {
184             float ret = NDalicPINVOKE.RulerPtr_Snap__SWIG_1(swigCPtr, x);
185             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186             return ret;
187         }
188
189         public float GetPositionFromPage(uint page, out uint volume, bool wrap)
190         {
191             float ret = NDalicPINVOKE.RulerPtr_GetPositionFromPage(swigCPtr, page, out volume, wrap);
192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193             return ret;
194         }
195
196         public uint GetPageFromPosition(float position, bool wrap)
197         {
198             uint ret = NDalicPINVOKE.RulerPtr_GetPageFromPosition(swigCPtr, position, wrap);
199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200             return ret;
201         }
202
203         public uint GetTotalPages()
204         {
205             uint ret = NDalicPINVOKE.RulerPtr_GetTotalPages(swigCPtr);
206             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207             return ret;
208         }
209
210         public Ruler.RulerType GetType()
211         {
212             Ruler.RulerType ret = (Ruler.RulerType)NDalicPINVOKE.RulerPtr_GetType(swigCPtr);
213             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214             return ret;
215         }
216
217         public bool IsEnabled()
218         {
219             bool ret = NDalicPINVOKE.RulerPtr_IsEnabled(swigCPtr);
220             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221             return ret;
222         }
223
224         public void Enable()
225         {
226             NDalicPINVOKE.RulerPtr_Enable(swigCPtr);
227             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228         }
229
230         public void Disable()
231         {
232             NDalicPINVOKE.RulerPtr_Disable(swigCPtr);
233             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234         }
235
236         public void SetDomain(RulerDomain domain)
237         {
238             NDalicPINVOKE.RulerPtr_SetDomain(swigCPtr, RulerDomain.getCPtr(domain));
239             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
240         }
241
242         public RulerDomain GetDomain()
243         {
244             RulerDomain ret = new RulerDomain(NDalicPINVOKE.RulerPtr_GetDomain(swigCPtr), false);
245             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246             return ret;
247         }
248
249         public void DisableDomain()
250         {
251             NDalicPINVOKE.RulerPtr_DisableDomain(swigCPtr);
252             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253         }
254
255         public float Clamp(float x, float length, float scale)
256         {
257             float ret = NDalicPINVOKE.RulerPtr_Clamp__SWIG_0(swigCPtr, x, length, scale);
258             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259             return ret;
260         }
261
262         public float Clamp(float x, float length)
263         {
264             float ret = NDalicPINVOKE.RulerPtr_Clamp__SWIG_1(swigCPtr, x, length);
265             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
266             return ret;
267         }
268
269         public float Clamp(float x)
270         {
271             float ret = NDalicPINVOKE.RulerPtr_Clamp__SWIG_2(swigCPtr, x);
272             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273             return ret;
274         }
275
276         internal float Clamp(float x, float length, float scale, SWIGTYPE_p_Dali__Toolkit__ClampState clamped)
277         {
278             float ret = NDalicPINVOKE.RulerPtr_Clamp__SWIG_3(swigCPtr, x, length, scale, SWIGTYPE_p_Dali__Toolkit__ClampState.getCPtr(clamped));
279             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
280             return ret;
281         }
282
283         public float SnapAndClamp(float x, float bias, float length, float scale)
284         {
285             float ret = NDalicPINVOKE.RulerPtr_SnapAndClamp__SWIG_0(swigCPtr, x, bias, length, scale);
286             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287             return ret;
288         }
289
290         public float SnapAndClamp(float x, float bias, float length)
291         {
292             float ret = NDalicPINVOKE.RulerPtr_SnapAndClamp__SWIG_1(swigCPtr, x, bias, length);
293             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
294             return ret;
295         }
296
297         public float SnapAndClamp(float x, float bias)
298         {
299             float ret = NDalicPINVOKE.RulerPtr_SnapAndClamp__SWIG_2(swigCPtr, x, bias);
300             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301             return ret;
302         }
303
304         public float SnapAndClamp(float x)
305         {
306             float ret = NDalicPINVOKE.RulerPtr_SnapAndClamp__SWIG_3(swigCPtr, x);
307             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
308             return ret;
309         }
310
311         internal float SnapAndClamp(float x, float bias, float length, float scale, SWIGTYPE_p_Dali__Toolkit__ClampState clamped)
312         {
313             float ret = NDalicPINVOKE.RulerPtr_SnapAndClamp__SWIG_4(swigCPtr, x, bias, length, scale, SWIGTYPE_p_Dali__Toolkit__ClampState.getCPtr(clamped));
314             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315             return ret;
316         }
317
318         public void Reference()
319         {
320             NDalicPINVOKE.RulerPtr_Reference(swigCPtr);
321             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322         }
323
324         public void Unreference()
325         {
326             NDalicPINVOKE.RulerPtr_Unreference(swigCPtr);
327             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328         }
329
330         public int ReferenceCount()
331         {
332             int ret = NDalicPINVOKE.RulerPtr_ReferenceCount(swigCPtr);
333             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334             return ret;
335         }
336
337     }
338
339 }