Skip to content

Class Edges

Definition

Namespace: StardewUI.Layout
Assembly: StardewUI.dll

Describes a set of edge dimensions, e.g. for margin or padding.

[StardewUI.DuckType]
public record Edges : IEquatable<StardewUI.Layout.Edges>

Inheritance
Object ⇦ Edges

Implements
IEquatable<Edges>

Members

Constructors

Name Description
Edges(Int32, Int32, Int32, Int32) Describes a set of edge dimensions, e.g. for margin or padding.
Edges(Int32) Initializes a new Edges with all edges set to the same value.
Edges(Int32, Int32) Initialies a new Edges with symmetrical horizontal and vertical values.

Fields

Name Description
NONE An Edges instance with all edges set to zero.

Properties

Name Description
Bottom The bottom edge.
EqualityContract
Horizontal Gets the total value for all horizontal edges (Left + Right).
Left The left edge.
Right The right edge.
Top The top edge.
Total The total size occupied by all edges.
Vertical Gets the total value for all vertical edges (Top + Bottom).

Methods

Name Description
Equals(Edges)
GetHashCode() (Overrides Object.GetHashCode())
HorizontalOnly() Gets a copy of this instance with only the horizontal edges set (vertical edges zeroed out).
Parse(string) Parses an Edges value from a comma-separated string representation.
Rotate(SimpleRotation) Rotates the edges, transposing the individual edge values.
ToString() (Overrides Object.ToString())
VerticalOnly() Gets a copy of this instance with only the vertical edges set (horizontal edges zeroed out).

Details

Constructors

Edges(int, int, int, int)

Describes a set of edge dimensions, e.g. for margin or padding.

public Edges(int Left, int Top, int Right, int Bottom);
Parameters

Left   Int32
The left edge.

Top   Int32
The top edge.

Right   Int32
The right edge.

Bottom   Int32
The bottom edge.


Edges(int)

Initializes a new Edges with all edges set to the same value.

public Edges(int all);
Parameters

all   Int32
Common value for all edges.


Edges(int, int)

Initialies a new Edges with symmetrical horizontal and vertical values.

public Edges(int horizontal, int vertical);
Parameters

horizontal   Int32
Common value for the Left and Right edges.

vertical   Int32
Common value for the Top and Bottom edges.


Fields

NONE

An Edges instance with all edges set to zero.

public static readonly StardewUI.Layout.Edges NONE;
Field Value

Edges


Properties

Bottom

The bottom edge.

public int Bottom { get; set; }
Property Value

Int32


EqualityContract

protected System.Type EqualityContract { get; }
Property Value

Type


Horizontal

Gets the total value for all horizontal edges (Left + Right).

public int Horizontal { get; }
Property Value

Int32


Left

The left edge.

public int Left { get; set; }
Property Value

Int32


The right edge.

public int Right { get; set; }
Property Value

Int32


Top

The top edge.

public int Top { get; set; }
Property Value

Int32


Total

The total size occupied by all edges.

public Microsoft.Xna.Framework.Vector2 Total { get; }
Property Value

Vector2


Vertical

Gets the total value for all vertical edges (Top + Bottom).

public int Vertical { get; }
Property Value

Int32


Methods

Equals(Edges)

public virtual bool Equals(StardewUI.Layout.Edges other);
Parameters

other   Edges

Returns

Boolean

Remarks

Overrides the default implementation to avoid using reflection on every frame during dirty checks.


GetHashCode()

public override int GetHashCode();
Returns

Int32


HorizontalOnly()

Gets a copy of this instance with only the horizontal edges set (vertical edges zeroed out).

public StardewUI.Layout.Edges HorizontalOnly();
Returns

Edges


Parse(string)

Parses an Edges value from a comma-separated string representation.

public static StardewUI.Layout.Edges Parse(string value);
Parameters

value   string
The formatted edges to parse.

Returns

Edges

The parsed Edges.

Remarks

The behavior depends on the number of comma-separated tokens in the string, equivalent to the constructor overload with that number of parameters:

  • A single value will give all edges the same length
  • Two values will set the horizontal (left/right) and vertical (top/bottom) lengths
  • Four values will set each length individually
  • Any other format will throw FormatException.

Rotate(SimpleRotation)

Rotates the edges, transposing the individual edge values.

public StardewUI.Layout.Edges Rotate(StardewUI.Graphics.SimpleRotation rotation);
Parameters

rotation   SimpleRotation
The rotation type (angle).

Returns

Edges

A rotated copy of this Edges instance.


ToString()

public override string ToString();
Returns

string


VerticalOnly()

Gets a copy of this instance with only the vertical edges set (horizontal edges zeroed out).

public StardewUI.Layout.Edges VerticalOnly();
Returns

Edges