/* * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System.ComponentModel; using Tizen.NUI.BaseComponents; namespace Tizen.NUI { /// /// [Draft] This class represents a layout size (width and height), non mutable. /// internal struct LayoutSize { /// /// [Draft] Constructor from width and height /// /// Int to initialize with. /// Int to initialize with. public LayoutSize(int width, int height) { Width = width; Height = height; } /// /// Computes a hash code for this LayoutSize for use in hash based collections. /// /// A non unique hash code . public override int GetHashCode() { return Width ^ Height; } /// /// Whether the values of two LayoutSize objects are equals /// /// Object to be compared against. /// true if obj is equal to this LayoutSize. public override bool Equals(object obj) { if (obj is LayoutSize) { LayoutSize layoutSize = (LayoutSize)obj; return ((layoutSize.Width == Width) && (layoutSize.Height == Height)); } return false; } /// /// Compares whether the two LayoutSize instances are equal. /// /// A LayoutSize instance. /// A LayoutSize instance. /// true if the two LayoutSize instances have equal values. public static bool operator ==(LayoutSize lhs, LayoutSize rhs) { return ((lhs.Width == rhs.Width) && (lhs.Height == rhs.Height)); } /// /// Compares whether the two LayoutSize instances are same or not. /// /// A LayoutSize instance. /// A LayoutSize instance. /// true if the two LayoutSize instances have do not have equal values. public static bool operator !=(LayoutSize lhs, LayoutSize rhs) { return ((lhs.Width != rhs.Width) || (lhs.Height != rhs.Height)); } /// /// [Draft] Get the width value of this layout /// public int Width{ get; private set; } /// /// [Draft] Get the height value of this layout /// public int Height{ get; private set; } } }