c899cea4eeb124f5db39b4fc169a7292aa491ffd
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / RelativeVector4.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     /// RelativeVector4 is a four-dimensional vector.
25     /// All values (x, y, and z) should be between [0, 1].
26     /// </summary>
27     /// <since_tizen> 3 </since_tizen>
28     [Binding.TypeConverter(typeof(RelativeVector4TypeConverter))]
29     public class RelativeVector4 : Disposable
30     {
31
32         /// <summary>
33         /// The constructor.
34         /// </summary>
35         /// <since_tizen> 3 </since_tizen>
36         public RelativeVector4() : this(Interop.Vector4.new_Vector4__SWIG_0(), true)
37         {
38             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
39         }
40
41         /// <summary>
42         /// The constructor.
43         /// </summary>
44         /// <param name="x">The x component.</param>
45         /// <param name="y">The y component.</param>
46         /// <param name="z">The z component.</param>
47         /// <param name="w">The w component.</param>
48         /// <since_tizen> 3 </since_tizen>
49         public RelativeVector4(float x, float y, float z, float w) : this(Interop.Vector4.new_Vector4__SWIG_1(x, y, z, w), true)
50         {
51             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
52         }
53
54         /// <summary>
55         /// The constructor.
56         /// </summary>
57         /// <param name="relativeVector2">The RelativeVector2 to create this vector from.</param>
58         /// <since_tizen> 3 </since_tizen>
59         public RelativeVector4(RelativeVector2 relativeVector2) : this(Interop.Vector4.new_Vector4__SWIG_3(RelativeVector2.getCPtr(relativeVector2)), true)
60         {
61             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
62         }
63
64         /// <summary>
65         /// The constructor.
66         /// </summary>
67         /// <param name="relativeVector3">The RelativeVector3 to create this vector from.</param>
68         /// <since_tizen> 3 </since_tizen>
69         public RelativeVector4(RelativeVector3 relativeVector3) : this(Interop.Vector4.new_Vector4__SWIG_4(RelativeVector3.getCPtr(relativeVector3)), true)
70         {
71             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72         }
73
74         internal RelativeVector4(RelativeVector4ChangedCallback cb, float x, float y, float z, float w) : this(Interop.Vector4.new_Vector4__SWIG_1(x, y, z, w), true)
75         {
76             callback = cb;
77             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78         }
79         internal delegate void RelativeVector4ChangedCallback(float x, float y, float z, float w);
80         private RelativeVector4ChangedCallback callback = null;
81
82         /// <summary>
83         /// The x component.
84         /// </summary>
85         /// <since_tizen> 3 </since_tizen>
86         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor")]
87         public float X
88         {
89             set
90             {
91                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
92
93                 Interop.Vector4.Vector4_X_set(swigCPtr, value);
94                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95
96                 callback?.Invoke(X, Y, Z, W);
97             }
98             get
99             {
100                 float ret = Interop.Vector4.Vector4_X_get(swigCPtr);
101                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102                 return ret;
103             }
104         }
105
106         /// <summary>
107         /// The y component.
108         /// </summary>
109         /// <since_tizen> 3 </since_tizen>
110         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor")]
111         public float Y
112         {
113             set
114             {
115                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
116
117                 Interop.Vector4.Vector4_Y_set(swigCPtr, value);
118                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119
120                 callback?.Invoke(X, Y, Z, W);
121             }
122             get
123             {
124                 float ret = Interop.Vector4.Vector4_Y_get(swigCPtr);
125                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126                 return ret;
127             }
128         }
129
130         /// <summary>
131         /// The z component.
132         /// </summary>
133         /// <since_tizen> 3 </since_tizen>
134         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor")]
135         public float Z
136         {
137             set
138             {
139                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
140
141                 Interop.Vector4.Vector4_Z_set(swigCPtr, value);
142                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143
144                 callback?.Invoke(X, Y, Z, W);
145             }
146             get
147             {
148                 float ret = Interop.Vector4.Vector4_Z_get(swigCPtr);
149                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150                 return ret;
151             }
152         }
153
154         /// <summary>
155         /// The w component.
156         /// </summary>
157         /// <since_tizen> 3 </since_tizen>
158         [Obsolete("Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor")]
159         public float W
160         {
161             set
162             {
163                 Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new RelativeVector4(...) constructor");
164                 
165                 Interop.Vector4.Vector4_W_set(swigCPtr, value);
166                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167
168                 callback?.Invoke(X, Y, Z, W);
169             }
170             get
171             {
172                 float ret = Interop.Vector4.Vector4_W_get(swigCPtr);
173                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174                 return ret;
175             }
176         }
177
178         /// <summary>
179         /// The addition operator.
180         /// </summary>
181         /// <param name="arg1">The vector to add.</param>
182         /// <param name="arg2">The vector to add.</param>
183         /// <returns>The vector containing the result of the addition.</returns>
184         /// <since_tizen> 3 </since_tizen>
185         public static RelativeVector4 operator +(RelativeVector4 arg1, RelativeVector4 arg2)
186         {
187             RelativeVector4 result = arg1.Add(arg2);
188             return result;
189         }
190
191         /// <summary>
192         /// The subtraction operator.
193         /// </summary>
194         /// <param name="arg1">The vector to subtract.</param>
195         /// <param name="arg2">The vector to subtract.</param>
196         /// <returns>The vector containing the result of the subtraction.</returns>
197         /// <since_tizen> 3 </since_tizen>
198         public static RelativeVector4 operator -(RelativeVector4 arg1, RelativeVector4 arg2)
199         {
200             RelativeVector4 result = arg1.Subtract(arg2);
201             return result;
202         }
203
204         /// <summary>
205         /// The multiplication operator.
206         /// </summary>
207         /// <param name="arg1">The vector to multiply.</param>
208         /// <param name="arg2">The vector to multiply.</param>
209         /// <returns>The vector containing the result of the multiplication.</returns>
210         /// <since_tizen> 3 </since_tizen>
211         public static RelativeVector4 operator *(RelativeVector4 arg1, RelativeVector4 arg2)
212         {
213             RelativeVector4 result = arg1.Multiply(arg2);
214             return result;
215         }
216
217         /// <summary>
218         /// The multiplication operator.
219         /// </summary>
220         /// <param name="arg1">The vector to multiply.</param>
221         /// <param name="arg2">The float value to scale the vector.</param>
222         /// <returns>The vector containing the result of the scaling.</returns>
223         /// <since_tizen> 3 </since_tizen>
224         public static RelativeVector4 operator *(RelativeVector4 arg1, float arg2)
225         {
226             RelativeVector4 result = arg1.Multiply(arg2);
227             return result;
228         }
229
230         /// <summary>
231         /// The division operator.
232         /// </summary>
233         /// <param name="arg1">The vector to divide.</param>
234         /// <param name="arg2">The vector to divide.</param>
235         /// <returns>The vector containing the result of the division.</returns>
236         /// <since_tizen> 3 </since_tizen>
237         public static RelativeVector4 operator /(RelativeVector4 arg1, RelativeVector4 arg2)
238         {
239             RelativeVector4 result = arg1.Divide(arg2);
240             return result;
241         }
242
243         /// <summary>
244         /// The division operator.
245         /// </summary>
246         /// <param name="arg1">The vector to divide.</param>
247         /// <param name="arg2">The float value to scale the vector by.</param>
248         /// <returns>The vector containing the result of the scaling.</returns>
249         /// <since_tizen> 3 </since_tizen>
250         public static RelativeVector4 operator /(RelativeVector4 arg1, float arg2)
251         {
252             RelativeVector4 result = arg1.Divide(arg2);
253             return result;
254         }
255
256         /// <summary>
257         /// </summary>
258         /// <since_tizen> 3 </since_tizen>
259         public static implicit operator Vector4(RelativeVector4 relativeVector4)
260         {
261             return new Vector4(relativeVector4.X, relativeVector4.Y, relativeVector4.Z, relativeVector4.W);
262         }
263
264         /// <summary>
265         /// </summary>
266         /// <since_tizen> 3 </since_tizen>
267         public static implicit operator RelativeVector4(Vector4 vec)
268         {
269             return new RelativeVector4(vec.X, vec.Y, vec.Z, vec.W);
270         }
271
272         /// <summary>
273         /// The const array subscript operator overload. Should be 0, 1 3 or 3.
274         /// </summary>
275         /// <param name="index">The subscript index.</param>
276         /// <returns>The float at the given index.</returns>
277         /// <since_tizen> 3 </since_tizen>
278         public float this[uint index]
279         {
280             get
281             {
282                 return ValueOfIndex(index);
283             }
284         }
285
286         /// <summary>
287         /// Determines whether the specified object is equal to the current object.
288         /// </summary>
289         /// <param name="obj">The object to compare with the current object.</param>
290         /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
291         public override bool Equals(System.Object obj)
292         {
293             RelativeVector4 relativeVector4 = obj as RelativeVector4;
294             bool equal = false;
295             if (X == relativeVector4?.X && Y == relativeVector4?.Y && Z == relativeVector4?.Z && W == relativeVector4?.W)
296             {
297                 equal = true;
298             }
299             return equal;
300         }
301
302         /// <summary>
303         /// Gets the the hash code of this RelativeVector4.
304         /// </summary>
305         /// <returns>The Hash Code.</returns>
306         /// <since_tizen> 6 </since_tizen>
307         public override int GetHashCode()
308         {
309             return swigCPtr.Handle.GetHashCode();
310         }
311
312         /// <summary>
313         /// Compares if the rhs is equal to.
314         /// </summary>
315         /// <param name="rhs">The vector to compare.</param>
316         /// <returns>Returns true if the two vectors are equal, otherwise false.</returns>
317         /// <since_tizen> 3 </since_tizen>
318         public bool EqualTo(RelativeVector4 rhs)
319         {
320             bool ret = Interop.Vector4.Vector4_EqualTo(swigCPtr, RelativeVector4.getCPtr(rhs));
321             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322             return ret;
323         }
324
325         /// <summary>
326         /// Compares if the rhs is not equal to.
327         /// </summary>
328         /// <param name="rhs">The vector to compare.</param>
329         /// <returns>Returns true if the two vectors are not equal, otherwise false.</returns>
330         /// <since_tizen> 3 </since_tizen>
331         public bool NotEqualTo(RelativeVector4 rhs)
332         {
333             bool ret = Interop.Vector4.Vector4_NotEqualTo(swigCPtr, RelativeVector4.getCPtr(rhs));
334             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
335             return ret;
336         }
337
338         /// <summary>
339         /// </summary>
340         internal static RelativeVector4 GetRelativeVector4FromPtr(global::System.IntPtr cPtr)
341         {
342             RelativeVector4 ret = new RelativeVector4(cPtr, false);
343             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344             return ret;
345         }
346
347         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelativeVector4 obj)
348         {
349             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
350         }
351
352         internal RelativeVector4(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
353         {
354         }
355
356         /// This will not be public opened.
357         [EditorBrowsable(EditorBrowsableState.Never)]
358         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
359         {
360             Interop.Vector4.delete_Vector4(swigCPtr);
361         }
362
363         private RelativeVector4 Add(RelativeVector4 rhs)
364         {
365             RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Add(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
366             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
367             return ret;
368         }
369
370         private RelativeVector4 Subtract(RelativeVector4 rhs)
371         {
372             RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Subtract__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
373             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
374             return ret;
375         }
376
377         private RelativeVector4 Multiply(RelativeVector4 rhs)
378         {
379             RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Multiply__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
380             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381             return ret;
382         }
383
384         private RelativeVector4 Multiply(float rhs)
385         {
386             RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true);
387             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
388             return ret;
389         }
390
391         private RelativeVector4 Divide(RelativeVector4 rhs)
392         {
393             RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Divide__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true);
394             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
395             return ret;
396         }
397
398         private RelativeVector4 Divide(float rhs)
399         {
400             RelativeVector4 ret = new RelativeVector4(Interop.Vector4.Vector4_Divide__SWIG_1(swigCPtr, rhs), true);
401             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
402             return ret;
403         }
404
405         private float ValueOfIndex(uint index)
406         {
407             float ret = Interop.Vector4.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index);
408             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409             return ret;
410         }
411     }
412 }
413
414