3b5b1e06523bb56cf5873b81c2f3ba3887f4f4db
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Uint16Pair.cs
1 /*
2  * Copyright(c) 2019 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 using System;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23
24     //"Please do not use! this will be deprecated"
25     /// <summary>
26     /// Simple class for passing around pairs of small unsigned integers.<br />
27     /// Use this for integer dimensions and points with limited range such as image
28     /// sizes and pixel coordinates where a pair of floating point numbers is
29     /// inefficient and illogical (i.e.the data is inherently integer).<br />
30     /// One of these can be passed in a single 32 bit integer register on
31     /// common architectures.<br />
32     /// </summary>
33     internal class Uint16Pair : Disposable
34     {
35
36         internal Uint16Pair(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
37         {
38         }
39
40         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Uint16Pair obj)
41         {
42             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
43         }
44
45         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
46         {
47             Interop.Uint16Pair.DeleteUint16Pair(swigCPtr);
48         }
49
50         /// <summary>
51         /// Less than comparison operator for storing in collections (not geometrically meaningful).
52         /// </summary>
53         /// <param name="arg1">A reference for comparison.</param>
54         /// <param name="arg2">A reference for comparison</param>
55         /// <return>True if arg1 less than arg2</return>
56         public static bool operator <(Uint16Pair arg1, Uint16Pair arg2)
57         {
58             return arg1.LessThan(arg2);
59         }
60
61         /// <summary>
62         /// More than comparison operator for storing in collections (not geometrically meaningful).
63         /// </summary>
64         /// <param name="arg1">A reference for comparison.</param>
65         /// <param name="arg2">A reference for comparison</param>
66         /// <return>True if arg1 > arg2</return>
67         public static bool operator >(Uint16Pair arg1, Uint16Pair arg2)
68         {
69             return arg1.GreaterThan(arg2);
70         }
71
72         /// <summary>
73         /// Default constructor for the(0, 0) tuple.
74         /// </summary>
75         public Uint16Pair() : this(Interop.Uint16Pair.NewUint16Pair(), true)
76         {
77             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78         }
79
80         /// <summary>
81         /// Default constructor for the(0, 0) tuple.
82         /// </summary>
83         /// <param name="width">The width or X dimension of the tuple. Make sure it is less than 65536.</param>
84         /// <param name="height">The height or Y dimension of the tuple.Make sure it is less than 65536.</param>
85         public Uint16Pair(uint width, uint height) : this(Interop.Uint16Pair.NewUint16Pair(width, height), true)
86         {
87             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88         }
89
90         /// <summary>
91         /// Constructor taking separate x and y (width and height) parameters.
92         /// </summary>
93         /// <param name="rhs">A reference to assign.</param>
94         public Uint16Pair(Uint16Pair rhs) : this(Interop.Uint16Pair.NewUint16Pair(Uint16Pair.getCPtr(rhs)), true)
95         {
96             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97         }
98
99         /// <summary>
100         /// Sets the width.
101         /// </summary>
102         /// <param name="width">The x dimension to be stored in this 2-tuple.</param>
103         public void SetWidth(ushort width)
104         {
105             Interop.Uint16Pair.SetWidth(SwigCPtr, width);
106             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107         }
108
109         /// <summary>
110         /// Get the width.
111         /// </summary>
112         /// <return>
113         /// The x dimension stored in this 2-tuple.
114         /// </return>
115         public ushort GetWidth()
116         {
117             ushort ret = Interop.Uint16Pair.GetWidth(SwigCPtr);
118             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119             return ret;
120         }
121
122         /// <summary>
123         /// Sets the height.
124         /// </summary>
125         /// <param name="height">The y dimension to be stored in this 2-tuple.</param>
126         public void SetHeight(ushort height)
127         {
128             Interop.Uint16Pair.SetHeight(SwigCPtr, height);
129             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130         }
131
132         /// <summary>
133         /// Get the height.
134         /// </summary>
135         /// <return>
136         /// The y dimension stored in this 2-tuple.
137         /// </return>
138         public ushort GetHeight()
139         {
140             ushort ret = Interop.Uint16Pair.GetHeight(SwigCPtr);
141             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142             return ret;
143         }
144
145         /// <summary>
146         /// Sets the x dimension.
147         /// </summary>
148         /// <param name="x">The x dimension to be stored in this 2-tuple.</param>
149         public void SetX(ushort x)
150         {
151             Interop.Uint16Pair.SetX(SwigCPtr, x);
152             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153         }
154
155         /// <summary>
156         /// Get the x dimension.
157         /// </summary>
158         /// <return>
159         /// The x dimension stored in this 2-tuple.
160         /// </return>
161         public ushort GetX()
162         {
163             ushort ret = Interop.Uint16Pair.GetX(SwigCPtr);
164             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165             return ret;
166         }
167
168         /// <summary>
169         /// Sets the y dimension.
170         /// </summary>
171         /// <param name="y">The y dimension to be stored in this 2-tuple.</param>
172         public void SetY(ushort y)
173         {
174             Interop.Uint16Pair.SetY(SwigCPtr, y);
175             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176         }
177
178         /// <summary>
179         /// Get the y dimension.
180         /// </summary>
181         /// <return>
182         /// The y dimension stored in this 2-tuple.
183         /// </return>
184         public ushort GetY()
185         {
186             ushort ret = Interop.Uint16Pair.GetY(SwigCPtr);
187             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188             return ret;
189         }
190
191         /// <summary>
192         /// Constructor taking separate x and y (width and height) parameters.
193         /// </summary>
194         /// <param name="rhs">A reference to assign.</param>
195         /// <return>The created object.</return>
196         public Uint16Pair Assign(Uint16Pair rhs)
197         {
198             Uint16Pair ret = new Uint16Pair(Interop.Uint16Pair.Assign(SwigCPtr, Uint16Pair.getCPtr(rhs)), false);
199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200             return ret;
201         }
202
203         private bool EqualTo(Uint16Pair rhs)
204         {
205             bool ret = Interop.Uint16Pair.EqualTo(SwigCPtr, Uint16Pair.getCPtr(rhs));
206             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207             return ret;
208         }
209
210         private bool NotEqualTo(Uint16Pair rhs)
211         {
212             bool ret = Interop.Uint16Pair.NotEqualTo(SwigCPtr, Uint16Pair.getCPtr(rhs));
213             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214             return ret;
215         }
216
217         private bool LessThan(Uint16Pair rhs)
218         {
219             bool ret = Interop.Uint16Pair.LessThan(SwigCPtr, Uint16Pair.getCPtr(rhs));
220             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221             return ret;
222         }
223
224         private bool GreaterThan(Uint16Pair rhs)
225         {
226             bool ret = Interop.Uint16Pair.GreaterThan(SwigCPtr, Uint16Pair.getCPtr(rhs));
227             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228             return ret;
229         }
230     }
231 }