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