[NUI] Property setter is changed (#1097)
[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 using System;
18 using Tizen.NUI.Binding;
19
20 namespace Tizen.NUI
21 {
22     /// <summary>
23     /// Extents class describing the a collection of uint16_t.
24     /// </summary>
25     /// <since_tizen> 4 </since_tizen>
26     [TypeConverter(typeof(ExtentsTypeConverter))]
27     public class Extents : Disposable
28     {
29
30         /// <summary>
31         /// Extents class
32         /// </summary>
33         /// <since_tizen> 4 </since_tizen>
34         protected bool swigCMemOwn;
35
36         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
37
38         /// <summary>
39         /// Constructor.
40         /// </summary>
41         /// <since_tizen> 4 </since_tizen>
42         public Extents() : this(Interop.Extents.new_Extents__SWIG_0(), true)
43         {
44             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
45         }
46
47         /// <summary>
48         /// Constructor.
49         /// </summary>
50         /// <param name="copy">A reference to the copied Extents.</param>
51         /// <since_tizen> 4 </since_tizen>
52         public Extents(Extents copy) : this(Interop.Extents.new_Extents__SWIG_1(Extents.getCPtr(copy)), true)
53         {
54             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
55         }
56
57         /// <summary>
58         /// Constructor.
59         /// <param name="start">Start extent.</param>
60         /// <param name="end">End extent.</param>
61         /// <param name="top">Top extent.</param>
62         /// <param name="bottom">Bottom extent.</param>
63         /// </summary>
64         /// <since_tizen> 4 </since_tizen>
65         public Extents(ushort start, ushort end, ushort top, ushort bottom) : this(Interop.Extents.new_Extents__SWIG_2(start, end, top, bottom), true)
66         {
67             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68         }
69
70         internal Extents(global::System.IntPtr cPtr, bool cMemoryOwn)
71         {
72             swigCMemOwn = cMemoryOwn;
73             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
74         }
75
76         internal Extents(ExtentsChangedCallback cb, ushort start, ushort end, ushort top, ushort bottom) : this(Interop.Extents.new_Extents__SWIG_2(start, end, top, bottom), true)
77         {
78             callback = cb;
79             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80         }
81
82         internal delegate void ExtentsChangedCallback(ushort start, ushort end, ushort top, ushort botton);
83         private ExtentsChangedCallback callback = null;
84
85         /// <summary>
86         /// The Start extent.
87         /// </summary>
88         /// <since_tizen> 4 </since_tizen>
89         public ushort Start
90         {
91             set
92             {
93                 Interop.Extents.Extents_start_set(swigCPtr, value);
94                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95
96                 callback?.Invoke(Start, End, Top, Bottom);
97             }
98             get
99             {
100                 ushort ret = Interop.Extents.Extents_start_get(swigCPtr);
101                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102                 return ret;
103             }
104         }
105
106         /// <summary>
107         /// The End extend.
108         /// </summary>
109         /// <since_tizen> 4 </since_tizen>
110         public ushort End
111         {
112             set
113             {
114                 Interop.Extents.Extents_end_set(swigCPtr, value);
115                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116
117                 callback?.Invoke(Start, End, Top, Bottom);
118             }
119             get
120             {
121                 ushort ret = Interop.Extents.Extents_end_get(swigCPtr);
122                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123                 return ret;
124             }
125         }
126
127         /// <summary>
128         /// The Top extend.
129         /// </summary>
130         /// <since_tizen> 4 </since_tizen>
131         public ushort Top
132         {
133             set
134             {
135                 Interop.Extents.Extents_top_set(swigCPtr, value);
136                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137
138                 callback?.Invoke(Start, End, Top, Bottom);
139             }
140             get
141             {
142                 ushort ret = Interop.Extents.Extents_top_get(swigCPtr);
143                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144                 return ret;
145             }
146         }
147
148         /// <summary>
149         /// The Bottom Extend.
150         /// </summary>
151         /// <since_tizen> 4 </since_tizen>
152         public ushort Bottom
153         {
154             set
155             {
156                 Interop.Extents.Extents_bottom_set(swigCPtr, value);
157                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158
159                 callback?.Invoke(Start, End, Top, Bottom);
160             }
161             get
162             {
163                 ushort ret = Interop.Extents.Extents_bottom_get(swigCPtr);
164                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165                 return ret;
166             }
167         }
168
169         /// <summary>
170         /// Equality operator.
171         /// </summary>
172         /// <param name="rhs">The Extents to test against.</param>
173         /// <returns>True if the extents are not equal.</returns>
174         /// <since_tizen> 4 </since_tizen>
175         public bool EqualTo(Extents rhs)
176         {
177             bool ret = Interop.Extents.Extents_EqualTo(swigCPtr, Extents.getCPtr(rhs));
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179             return ret;
180         }
181
182         /// <summary>
183         /// Inequality operator.
184         /// </summary>
185         /// <param name="rhs">The Extents to test against.</param>
186         /// <returns>True if the extents are not equal.</returns>
187         /// <since_tizen> 4 </since_tizen>
188         public bool NotEqualTo(Extents rhs)
189         {
190             bool ret = Interop.Extents.Extents_NotEqualTo(swigCPtr, Extents.getCPtr(rhs));
191             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192             return ret;
193         }
194
195         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Extents obj)
196         {
197             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
198         }
199
200         internal Extents Assign(SWIGTYPE_p_uint16_t array)
201         {
202             Extents ret = new Extents(Interop.Extents.Extents_Assign__SWIG_1(swigCPtr, SWIGTYPE_p_uint16_t.getCPtr(array)), false);
203             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204             return ret;
205         }
206
207         internal Extents Assign(Extents copy)
208         {
209             Extents ret = new Extents(Interop.Extents.Extents_Assign__SWIG_0(swigCPtr, Extents.getCPtr(copy)), false);
210             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211             return ret;
212         }
213
214         /// <summary>
215         /// To make a Extents instance be disposed.
216         /// </summary>
217         /// <param name="type">Extents type</param>
218         /// <since_tizen> 4 </since_tizen>
219         protected override void Dispose(DisposeTypes type)
220         {
221             if (disposed)
222             {
223                 return;
224             }
225
226             //Release your own unmanaged resources here.
227             //You should not access any managed member here except static instance.
228             //because the execution order of Finalizes is non-deterministic.
229
230             if (swigCPtr.Handle != global::System.IntPtr.Zero)
231             {
232                 if (swigCMemOwn)
233                 {
234                     swigCMemOwn = false;
235                     Interop.Extents.delete_Extents(swigCPtr);
236                 }
237                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
238             }
239             base.Dispose(type);
240         }
241     }
242 }