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