[NUI] Fix build warning CA1062 (#2234)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Extents.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 using Tizen.NUI.Binding;
21
22 namespace Tizen.NUI
23 {
24     /// <summary>
25     /// Extents class describing the a collection of uint16_t.
26     /// </summary>
27     /// <since_tizen> 4 </since_tizen>
28     [Binding.TypeConverter(typeof(ExtentsTypeConverter))]
29     public class Extents : Disposable, ICloneable
30     {
31
32
33         /// <summary>
34         /// Constructor.
35         /// </summary>
36         /// <since_tizen> 4 </since_tizen>
37         public Extents() : this(Interop.Extents.new_Extents__SWIG_0(), true)
38         {
39             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
40         }
41
42         /// <summary>
43         /// Constructor.
44         /// </summary>
45         /// <param name="copy">A reference to the copied Extents.</param>
46         /// <since_tizen> 4 </since_tizen>
47         public Extents(Extents copy) : this(Interop.Extents.new_Extents__SWIG_1(Extents.getCPtr(copy)), true)
48         {
49             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
50         }
51
52         /// <summary>
53         /// The type cast operator, ushort to Extents.
54         /// </summary>
55         /// <param name="value">A value of ushort type.</param>
56         /// <returns>return a Extents instance</returns>
57         [EditorBrowsable(EditorBrowsableState.Never)]
58         public static implicit operator Extents(ushort value)
59         {
60             return new Extents(value, value, value, value);
61         }
62
63         /// <summary>
64         /// Constructor.
65         /// <param name="start">Start extent.</param>
66         /// <param name="end">End extent.</param>
67         /// <param name="top">Top extent.</param>
68         /// <param name="bottom">Bottom extent.</param>
69         /// </summary>
70         /// <since_tizen> 4 </since_tizen>
71         public Extents(ushort start, ushort end, ushort top, ushort bottom) : this(Interop.Extents.new_Extents__SWIG_2(start, end, top, bottom), true)
72         {
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74         }
75
76         internal Extents(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
77         {
78         }
79
80         /// <summary>
81         /// Constructor
82         /// </summary>
83         /// <param name="cb"></param>
84         /// <param name="start"></param>
85         /// <param name="end"></param>
86         /// <param name="top"></param>
87         /// <param name="bottom"></param>
88         /// <since_tizen> Only used by Tizen.NUI.Components, will not be opened </since_tizen>
89         [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
90         public Extents(ExtentsChangedCallback cb, ushort start, ushort end, ushort top, ushort bottom) : this(Interop.Extents.new_Extents__SWIG_2(start, end, top, bottom), true)
91         {
92             callback = cb;
93             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94         }
95
96         /// <summary>
97         /// Copy other extents
98         /// </summary>
99         /// <param name="that"></param>
100         /// <exception cref="ArgumentNullException"> Thrown when that is null. </exception>
101         /// <since_tizen> Only used by Tizen.NUI.Components, will not be opened </since_tizen>
102         [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
103         public void CopyFrom(Extents that)
104         {
105             if (null == that)
106             {
107                 throw new ArgumentNullException(nameof(that));
108             }
109             Interop.Extents.Extents_start_set(swigCPtr, that.Start);
110             Interop.Extents.Extents_end_set(swigCPtr, that.End);
111             Interop.Extents.Extents_top_set(swigCPtr, that.Top);
112             Interop.Extents.Extents_bottom_set(swigCPtr, that.Bottom);
113         }
114
115         /// <summary>
116         /// Constructor
117         /// </summary>
118         /// <param name="start"></param>
119         /// <param name="end"></param>
120         /// <param name="top"></param>
121         /// <param name="bottom"></param>
122         /// <since_tizen> Only used by Tizen.NUI.Components, will not be opened </since_tizen>
123                 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
124         public delegate void ExtentsChangedCallback(ushort start, ushort end, ushort top, ushort bottom);
125         private ExtentsChangedCallback callback = null;
126
127         /// <summary>
128         /// The Start extent.
129         /// </summary>
130         /// <since_tizen> 4 </since_tizen>
131         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor")]
132         public ushort Start
133         {
134             set
135             {
136                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor");
137                 Interop.Extents.Extents_start_set(swigCPtr, value);
138                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
139
140                 callback?.Invoke(Start, End, Top, Bottom);
141             }
142             get
143             {
144                 ushort ret = Interop.Extents.Extents_start_get(swigCPtr);
145                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146                 return ret;
147             }
148         }
149
150         /// <summary>
151         /// The End extend.
152         /// </summary>
153         /// <since_tizen> 4 </since_tizen>
154         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor")]
155         public ushort End
156         {
157             set
158             {
159                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor");
160
161                 Interop.Extents.Extents_end_set(swigCPtr, value);
162                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163
164                 callback?.Invoke(Start, End, Top, Bottom);
165             }
166             get
167             {
168                 ushort ret = Interop.Extents.Extents_end_get(swigCPtr);
169                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170                 return ret;
171             }
172         }
173
174         /// <summary>
175         /// The Top extend.
176         /// </summary>
177         /// <since_tizen> 4 </since_tizen>
178         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor")]
179         public ushort Top
180         {
181             set
182             {
183                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor");
184
185                 Interop.Extents.Extents_top_set(swigCPtr, value);
186                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187
188                 callback?.Invoke(Start, End, Top, Bottom);
189             }
190             get
191             {
192                 ushort ret = Interop.Extents.Extents_top_get(swigCPtr);
193                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194                 return ret;
195             }
196         }
197
198         /// <summary>
199         /// The Bottom Extend.
200         /// </summary>
201         /// <since_tizen> 4 </since_tizen>
202         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor")]
203         public ushort Bottom
204         {
205             set
206             {
207                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor");
208
209                 Interop.Extents.Extents_bottom_set(swigCPtr, value);
210                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211
212                 callback?.Invoke(Start, End, Top, Bottom);
213             }
214             get
215             {
216                 ushort ret = Interop.Extents.Extents_bottom_get(swigCPtr);
217                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218                 return ret;
219             }
220         }
221
222         /// <summary>
223         /// Equality operator.
224         /// </summary>
225         /// <param name="rhs">The Extents to test against.</param>
226         /// <returns>True if the extents are not equal.</returns>
227         /// <since_tizen> 4 </since_tizen>
228         public bool EqualTo(Extents rhs)
229         {
230             bool ret = Interop.Extents.Extents_EqualTo(swigCPtr, Extents.getCPtr(rhs));
231             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232             return ret;
233         }
234
235         /// <summary>
236         /// Inequality operator.
237         /// </summary>
238         /// <param name="rhs">The Extents to test against.</param>
239         /// <returns>True if the extents are not equal.</returns>
240         /// <since_tizen> 4 </since_tizen>
241         public bool NotEqualTo(Extents rhs)
242         {
243             bool ret = Interop.Extents.Extents_NotEqualTo(swigCPtr, Extents.getCPtr(rhs));
244             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245             return ret;
246         }
247
248         /// <inheritdoc/>
249         [EditorBrowsable(EditorBrowsableState.Never)]
250         public object Clone() => new Extents(this);
251
252         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Extents obj)
253         {
254             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
255         }
256
257         internal Extents Assign(SWIGTYPE_p_uint16_t array)
258         {
259             Extents ret = new Extents(Interop.Extents.Extents_Assign__SWIG_1(swigCPtr, SWIGTYPE_p_uint16_t.getCPtr(array)), false);
260             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
261             return ret;
262         }
263
264         internal Extents Assign(Extents copy)
265         {
266             Extents ret = new Extents(Interop.Extents.Extents_Assign__SWIG_0(swigCPtr, Extents.getCPtr(copy)), false);
267             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268             return ret;
269         }
270
271         /// This will not be public opened.
272         [EditorBrowsable(EditorBrowsableState.Never)]
273         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
274         {
275             Interop.Extents.delete_Extents(swigCPtr);
276         }
277     }
278 }