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.
public readonly struct Constraints : IEquatable<Constraints>Implements
Constructors
Constraints(int, int, int, int)
Parameters:
public Constraints(int minWidth, int maxWidth, int minHeight, int maxHeight)Properties
MaxHeight
Returns: Int32
public int MaxHeight { get; }MaxWidth
Returns: Int32
public int MaxWidth { get; }MinHeight
Returns: Int32
public int MinHeight { get; }MinWidth
Returns: Int32
public int MinWidth { get; }Unbounded
Creates unbounded constraints (infinite max).
Returns: Constraints
public static Constraints Unbounded { get; }Methods
Constrain(Size)
Constrains a size to fit within these constraints.
Parameters:
size(Size):
Returns: Size
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.
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.
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.
public override int GetHashCode()Loose(int, int)
Creates constraints with max bounds but zero min.
Parameters:
Returns: Constraints
public static Constraints Loose(int maxWidth, int maxHeight)Loose(Size)
Creates constraints with max bounds but zero min.
Parameters:
size(Size):
Returns: Constraints
public static Constraints Loose(Size size)Tight(int, int)
Creates constraints for a fixed size.
Parameters:
Returns: Constraints
public static Constraints Tight(int width, int height)Tight(Size)
Creates constraints for a fixed size.
Parameters:
size(Size):
Returns: Constraints
public static Constraints Tight(Size size)ToString()
Returns the fully qualified type name of this instance.
Returns: String
The fully qualified type name.
public override string ToString()WithHeight(int)
Returns new constraints with the height constrained to a specific value.
Parameters:
height(Int32):
Returns: Constraints
public Constraints WithHeight(int height)WithMaxHeight(int)
Returns new constraints with the max height reduced.
Parameters:
maxHeight(Int32):
Returns: Constraints
public Constraints WithMaxHeight(int maxHeight)WithMaxWidth(int)
Returns new constraints with the max width reduced.
Parameters:
maxWidth(Int32):
Returns: Constraints
public Constraints WithMaxWidth(int maxWidth)WithWidth(int)
Returns new constraints with the width constrained to a specific value.
Parameters:
width(Int32):
Returns: Constraints
public Constraints WithWidth(int width)Members
operator !=(Constraints, Constraints)
Parameters:
left(Constraints):right(Constraints):
Returns: Boolean
public static bool operator !=(Constraints left, Constraints right)operator ==(Constraints, Constraints)
Parameters:
left(Constraints):right(Constraints):
Returns: Boolean
public static bool operator ==(Constraints left, Constraints right)