2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.ComponentModel;
20 using Tizen.NUI.Binding;
25 /// Extents class describing the a collection of uint16_t.
27 /// <since_tizen> 4 </since_tizen>
28 [Binding.TypeConverter(typeof(ExtentsTypeConverter))]
29 public class Extents : Disposable, ICloneable
36 /// <since_tizen> 4 </since_tizen>
37 public Extents() : this(Interop.Extents.NewExtents(), true)
39 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.NewExtents(Extents.getCPtr(copy)), true)
49 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
53 /// The type cast operator, ushort to Extents.
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)
60 return new Extents(value, value, value, value);
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>
70 /// <since_tizen> 4 </since_tizen>
71 public Extents(ushort start, ushort end, ushort top, ushort bottom) : this(Interop.Extents.NewExtents(start, end, top, bottom), true)
73 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76 internal Extents(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
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.NewExtents(start, end, top, bottom), true)
93 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97 /// Copy other extents
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)
107 throw new ArgumentNullException(nameof(that));
109 Interop.Extents.StartSet(SwigCPtr, that.Start);
110 Interop.Extents.EndSet(SwigCPtr, that.End);
111 Interop.Extents.TopSet(SwigCPtr, that.Top);
112 Interop.Extents.BottomSet(SwigCPtr, that.Bottom);
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;
128 /// The Start extent.
131 /// The setter is deprecated in API8 and will be removed in API10. Please use new Extents(...) constructor.
134 /// // DO NOT use like the followings!
135 /// Extents extents = new Extents();
136 /// extents.Start = 1;
137 /// // Please USE like this
138 /// ushort start = 1, end = 2, top = 3, bottom = 4;
139 /// Extents extents = new Extents(start, end, top, bottom);
141 /// <since_tizen> 4 </since_tizen>
144 [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor")]
147 Interop.Extents.StartSet(SwigCPtr, value);
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150 callback?.Invoke(Start, End, Top, Bottom);
154 ushort ret = Interop.Extents.StartGet(SwigCPtr);
155 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
164 /// The setter is deprecated in API8 and will be removed in API10. Please use new Extents(...) constructor.
167 /// // DO NOT use like the followings!
168 /// Extents extents = new Extents();
170 /// // Please USE like this
171 /// ushort start = 1, end = 2, top = 3, bottom = 4;
172 /// Extents extents = new Extents(start, end, top, bottom);
174 /// <since_tizen> 4 </since_tizen>
177 [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor")]
180 Interop.Extents.EndSet(SwigCPtr, value);
181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 callback?.Invoke(Start, End, Top, Bottom);
187 ushort ret = Interop.Extents.EndGet(SwigCPtr);
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
197 /// The setter is deprecated in API8 and will be removed in API10. Please use new Extents(...) constructor.
200 /// // DO NOT use like the followings!
201 /// Extents extents = new Extents();
203 /// // Please USE like this
204 /// ushort start = 1, end = 2, top = 3, bottom = 4;
205 /// Extents extents = new Extents(start, end, top, bottom);
207 /// <since_tizen> 4 </since_tizen>
210 [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor")]
213 Interop.Extents.TopSet(SwigCPtr, value);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216 callback?.Invoke(Start, End, Top, Bottom);
220 ushort ret = Interop.Extents.TopGet(SwigCPtr);
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
227 /// The Bottom Extend.
230 /// The setter is deprecated in API8 and will be removed in API10. Please use new Extents(...) constructor.
233 /// // DO NOT use like the followings!
234 /// Extents extents = new Extents();
235 /// extents.Bottom = 4;
236 /// // Please USE like this
237 /// ushort start = 1, end = 2, top = 3, bottom = 4;
238 /// Extents extents = new Extents(start, end, top, bottom);
240 /// <since_tizen> 4 </since_tizen>
243 [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Extents(...) constructor")]
246 Interop.Extents.BottomSet(SwigCPtr, value);
247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249 callback?.Invoke(Start, End, Top, Bottom);
253 ushort ret = Interop.Extents.BottomGet(SwigCPtr);
254 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
260 /// Equality operator.
262 /// <param name="rhs">The Extents to test against.</param>
263 /// <returns>True if the extents are not equal.</returns>
264 /// <since_tizen> 4 </since_tizen>
265 public bool EqualTo(Extents rhs)
267 bool ret = Interop.Extents.EqualTo(SwigCPtr, Extents.getCPtr(rhs));
268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 /// Inequality operator.
275 /// <param name="rhs">The Extents to test against.</param>
276 /// <returns>True if the extents are not equal.</returns>
277 /// <since_tizen> 4 </since_tizen>
278 public bool NotEqualTo(Extents rhs)
280 bool ret = Interop.Extents.NotEqualTo(SwigCPtr, Extents.getCPtr(rhs));
281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 [EditorBrowsable(EditorBrowsableState.Never)]
287 public object Clone() => new Extents(this);
289 internal Extents Assign(SWIGTYPE_p_uint16_t array)
291 Extents ret = new Extents(Interop.Extents.AssignUint16(SwigCPtr, SWIGTYPE_p_uint16_t.getCPtr(array)), false);
292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296 internal Extents Assign(Extents copy)
298 Extents ret = new Extents(Interop.Extents.Assign(SwigCPtr, Extents.getCPtr(copy)), false);
299 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303 /// This will not be public opened.
304 [EditorBrowsable(EditorBrowsableState.Never)]
305 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
307 Interop.Extents.DeleteExtents(swigCPtr);