Skip to content

Constraints ​

Namespace: Hex1b.Layout

Assembly: Hex1b.dll

Represents layout constraints passed from parent to child. The child must return a size that fits within these constraints.

csharp
public readonly struct Constraints : IEquatable<Constraints>

Implements ​

Constructors ​

Constraints(int, int, int, int) ​

Parameters:

csharp
public Constraints(int minWidth, int maxWidth, int minHeight, int maxHeight)

Properties ​

MaxHeight ​

Returns: Int32

csharp
public int MaxHeight { get; }

MaxWidth ​

Returns: Int32

csharp
public int MaxWidth { get; }

MinHeight ​

Returns: Int32

csharp
public int MinHeight { get; }

MinWidth ​

Returns: Int32

csharp
public int MinWidth { get; }

Unbounded ​

Creates unbounded constraints (infinite max).

Returns: Constraints

csharp
public static Constraints Unbounded { get; }

Methods ​

Constrain(Size) ​

Constrains a size to fit within these constraints.

Parameters:

Returns: Size

csharp
public Size Constrain(Size size)

Equals(Constraints) ​

Indicates whether the current object is equal to another object of the same type.

Parameters:

  • other (Constraints): An object to compare with this object.

Returns: Boolean

true if the current object is equal to the other parameter; otherwise, false.

csharp
public bool Equals(Constraints other)

Equals(object?) ​

Indicates whether this instance and a specified object are equal.

Parameters:

  • obj (Object): The object to compare with the current instance.

Returns: Boolean

true if obj and this instance are the same type and represent the same value; otherwise, false.

csharp
public override bool Equals(object? obj)

GetHashCode() ​

Returns the hash code for this instance.

Returns: Int32

A 32-bit signed integer that is the hash code for this instance.

csharp
public override int GetHashCode()

Loose(int, int) ​

Creates constraints with max bounds but zero min.

Parameters:

Returns: Constraints

csharp
public static Constraints Loose(int maxWidth, int maxHeight)

Loose(Size) ​

Creates constraints with max bounds but zero min.

Parameters:

Returns: Constraints

csharp
public static Constraints Loose(Size size)

Tight(int, int) ​

Creates constraints for a fixed size.

Parameters:

Returns: Constraints

csharp
public static Constraints Tight(int width, int height)

Tight(Size) ​

Creates constraints for a fixed size.

Parameters:

Returns: Constraints

csharp
public static Constraints Tight(Size size)

ToString() ​

Returns the fully qualified type name of this instance.

Returns: String

The fully qualified type name.

csharp
public override string ToString()

WithHeight(int) ​

Returns new constraints with the height constrained to a specific value.

Parameters:

Returns: Constraints

csharp
public Constraints WithHeight(int height)

WithMaxHeight(int) ​

Returns new constraints with the max height reduced.

Parameters:

Returns: Constraints

csharp
public Constraints WithMaxHeight(int maxHeight)

WithMaxWidth(int) ​

Returns new constraints with the max width reduced.

Parameters:

Returns: Constraints

csharp
public Constraints WithMaxWidth(int maxWidth)

WithWidth(int) ​

Returns new constraints with the width constrained to a specific value.

Parameters:

Returns: Constraints

csharp
public Constraints WithWidth(int width)

Members ​

operator !=(Constraints, Constraints) ​

Parameters:

Returns: Boolean

csharp
public static bool operator !=(Constraints left, Constraints right)

operator ==(Constraints, Constraints) ​

Parameters:

Returns: Boolean

csharp
public static bool operator ==(Constraints left, Constraints right)

Released under the MIT License.