2 * Copyright (c) 2018 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.
18 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
24 /// [Draft] This class represents a layout size (width and height)
26 internal class LayoutSize : global::System.IDisposable
28 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
29 protected bool swigCMemOwn;
31 internal LayoutSize(global::System.IntPtr cPtr, bool cMemoryOwn)
33 swigCMemOwn = cMemoryOwn;
34 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LayoutSize obj)
39 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
47 public virtual void Dispose()
51 if (swigCPtr.Handle != global::System.IntPtr.Zero)
56 LayoutPINVOKE.delete_LayoutSize(swigCPtr);
58 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
60 global::System.GC.SuppressFinalize(this);
64 public LayoutSize() : this(LayoutPINVOKE.new_LayoutSize__SWIG_0(), true)
66 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
69 public LayoutSize(int x, int y) : this(LayoutPINVOKE.new_LayoutSize__SWIG_1(x, y), true)
71 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74 internal void SetWidth(LayoutLength value)
76 LayoutPINVOKE.LayoutSize_SetWidth__SWIG_1(swigCPtr, LayoutLength.getCPtr(value));
77 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80 internal void SetHeight(LayoutLength value)
82 LayoutPINVOKE.LayoutSize_SetHeight__SWIG_1(swigCPtr, LayoutLength.getCPtr(value));
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86 private bool EqualTo(LayoutSize rhs)
88 bool ret = LayoutPINVOKE.LayoutSize_EqualTo(swigCPtr, LayoutSize.getCPtr(rhs));
89 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93 public bool IsEqualTo(LayoutSize target)
95 if (this.Width == target.Width && this.Height == target.Height)
103 // This causes crash!
104 // compile warning message :
105 //'LayoutSize' defines operator == or operator != but does not override Object.Equals(object o)
106 //'LayoutSize' defines operator == or operator != but does not override Object.GetHashCode()
107 //public static bool operator ==(LayoutSize r1, LayoutSize r2)
109 // return r1.EqualTo(r2);
111 //public static bool operator !=(LayoutSize r1, LayoutSize r2)
113 // return !r1.EqualTo(r2);
119 //This should be blocked! Otherwise, user can set multiple-cascading property setting like "LinearLayout.CellPadding.Width = 100;". This will not be working!
122 // LayoutPINVOKE.LayoutSize_width_set(swigCPtr, value);
123 // if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127 int ret = LayoutPINVOKE.LayoutSize_width_get(swigCPtr);
128 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135 //This should be blocked! Otherwise, user can set multiple-cascading property setting like "LinearLayout.CellPadding.Height = 100;". This will not be working!
138 // LayoutPINVOKE.LayoutSize_height_set(swigCPtr, value);
139 // if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143 int ret = LayoutPINVOKE.LayoutSize_height_get(swigCPtr);
144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();