Merge "[Stt/Tts][Fix description about exception]"
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Uint16Pair.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 using System;
18 using System.ComponentModel;
19
20 namespace Tizen.NUI
21 {
22
23     //"Please do not use! this will be deprecated"
24     [EditorBrowsable(EditorBrowsableState.Never)]
25     public class Uint16Pair : global::System.IDisposable
26     {
27         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
28         protected bool swigCMemOwn;
29
30         internal Uint16Pair(global::System.IntPtr cPtr, bool cMemoryOwn)
31         {
32             swigCMemOwn = cMemoryOwn;
33             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
34         }
35
36         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Uint16Pair obj)
37         {
38             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
39         }
40
41         //A Flag to check who called Dispose(). (By User or DisposeQueue)
42         private bool isDisposeQueued = false;
43         //A Flat to check if it is already disposed.
44         protected bool disposed = false;
45
46
47         ~Uint16Pair()
48         {
49             if (!isDisposeQueued)
50             {
51                 isDisposeQueued = true;
52                 DisposeQueue.Instance.Add(this);
53             }
54         }
55
56         public void Dispose()
57         {
58             //Throw excpetion if Dispose() is called in separate thread.
59             if (!Window.IsInstalled())
60             {
61                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
62             }
63
64             if (isDisposeQueued)
65             {
66                 Dispose(DisposeTypes.Implicit);
67             }
68             else
69             {
70                 Dispose(DisposeTypes.Explicit);
71                 System.GC.SuppressFinalize(this);
72             }
73         }
74
75         protected virtual void Dispose(DisposeTypes type)
76         {
77             if (disposed)
78             {
79                 return;
80             }
81
82             if (type == DisposeTypes.Explicit)
83             {
84                 //Called by User
85                 //Release your own managed resources here.
86                 //You should release all of your own disposable objects here.
87
88             }
89
90             //Release your own unmanaged resources here.
91             //You should not access any managed member here except static instance.
92             //because the execution order of Finalizes is non-deterministic.
93
94             if (swigCPtr.Handle != global::System.IntPtr.Zero)
95             {
96                 if (swigCMemOwn)
97                 {
98                     swigCMemOwn = false;
99                     NDalicPINVOKE.delete_Uint16Pair(swigCPtr);
100                 }
101                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
102             }
103
104             disposed = true;
105         }
106
107
108         public static bool operator <(Uint16Pair arg1, Uint16Pair arg2)
109         {
110             return arg1.LessThan(arg2);
111         }
112
113         public static bool operator >(Uint16Pair arg1, Uint16Pair arg2)
114         {
115             return arg1.GreaterThan(arg2);
116         }
117
118         public Uint16Pair() : this(NDalicPINVOKE.new_Uint16Pair__SWIG_0(), true)
119         {
120             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121         }
122
123         public Uint16Pair(uint width, uint height) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_1(width, height), true)
124         {
125             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126         }
127
128         public Uint16Pair(Uint16Pair rhs) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_2(Uint16Pair.getCPtr(rhs)), true)
129         {
130             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131         }
132
133         public void SetWidth(ushort width)
134         {
135             NDalicPINVOKE.Uint16Pair_SetWidth(swigCPtr, width);
136             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137         }
138
139         public ushort GetWidth()
140         {
141             ushort ret = NDalicPINVOKE.Uint16Pair_GetWidth(swigCPtr);
142             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143             return ret;
144         }
145
146         public void SetHeight(ushort height)
147         {
148             NDalicPINVOKE.Uint16Pair_SetHeight(swigCPtr, height);
149             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150         }
151
152         public ushort GetHeight()
153         {
154             ushort ret = NDalicPINVOKE.Uint16Pair_GetHeight(swigCPtr);
155             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156             return ret;
157         }
158
159         public void SetX(ushort x)
160         {
161             NDalicPINVOKE.Uint16Pair_SetX(swigCPtr, x);
162             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163         }
164
165         public ushort GetX()
166         {
167             ushort ret = NDalicPINVOKE.Uint16Pair_GetX(swigCPtr);
168             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169             return ret;
170         }
171
172         public void SetY(ushort y)
173         {
174             NDalicPINVOKE.Uint16Pair_SetY(swigCPtr, y);
175             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176         }
177
178         public ushort GetY()
179         {
180             ushort ret = NDalicPINVOKE.Uint16Pair_GetY(swigCPtr);
181             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182             return ret;
183         }
184
185         public Uint16Pair Assign(Uint16Pair rhs)
186         {
187             Uint16Pair ret = new Uint16Pair(NDalicPINVOKE.Uint16Pair_Assign(swigCPtr, Uint16Pair.getCPtr(rhs)), false);
188             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189             return ret;
190         }
191
192         private bool EqualTo(Uint16Pair rhs)
193         {
194             bool ret = NDalicPINVOKE.Uint16Pair_EqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
195             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196             return ret;
197         }
198
199         private bool NotEqualTo(Uint16Pair rhs)
200         {
201             bool ret = NDalicPINVOKE.Uint16Pair_NotEqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
202             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203             return ret;
204         }
205
206         private bool LessThan(Uint16Pair rhs)
207         {
208             bool ret = NDalicPINVOKE.Uint16Pair_LessThan(swigCPtr, Uint16Pair.getCPtr(rhs));
209             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210             return ret;
211         }
212
213         private bool GreaterThan(Uint16Pair rhs)
214         {
215             bool ret = NDalicPINVOKE.Uint16Pair_GreaterThan(swigCPtr, Uint16Pair.getCPtr(rhs));
216             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217             return ret;
218         }
219
220     }
221
222 }