2 * Copyright (c) 2019 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), non mutable.
26 internal struct LayoutSize
29 /// [Draft] Constructor from width and height
31 /// <param name="width">Int to initialize with.</param>
32 /// <param name="height">Int to initialize with.</param>
33 public LayoutSize(int width, int height)
40 /// Computes a hash code for this LayoutSize for use in hash based collections.
42 /// <returns>A non unique hash code .</returns>
43 public override int GetHashCode()
45 return Width ^ Height;
49 /// Whether the values of two LayoutSize objects are equals
51 /// <param name="obj">Object to be compared against.</param>
52 /// <returns>true if obj is equal to this LayoutSize.</returns>
53 public override bool Equals(object obj)
55 if (obj is LayoutSize)
57 LayoutSize layoutSize = (LayoutSize)obj;
58 return ((layoutSize.Width == Width) && (layoutSize.Height == Height));
64 /// Compares whether the two LayoutSize instances are equal.
66 /// <param name="lhs">A LayoutSize instance.</param>
67 /// <param name="rhs">A LayoutSize instance.</param>
68 /// <returns>true if the two LayoutSize instances have equal values.</returns>
69 public static bool operator ==(LayoutSize lhs, LayoutSize rhs)
71 return ((lhs.Width == rhs.Width) && (lhs.Height == rhs.Height));
76 /// Compares whether the two LayoutSize instances are same or not.
78 /// <param name="lhs">A LayoutSize instance.</param>
79 /// <param name="rhs">A LayoutSize instance.</param>
80 /// <returns>true if the two LayoutSize instances have do not have equal values.</returns>
81 public static bool operator !=(LayoutSize lhs, LayoutSize rhs)
83 return ((lhs.Width != rhs.Width) || (lhs.Height != rhs.Height));
87 /// [Draft] Get the width value of this layout
89 public int Width{ get; private set; }
92 /// [Draft] Get the height value of this layout
94 public int Height{ get; private set; }