Class ViewChild
Definition
Namespace: StardewUI
Assembly: StardewUI.dll
Provides information about a view that is the child of another view. Used for interactions.
public record ViewChild : StardewUI.Layout.IOffsettable<StardewUI.ViewChild>,
IEquatable<StardewUI.ViewChild>
Inheritance
Object ⇦ ViewChild
Implements
IOffsettable<ViewChild>, IEquatable<ViewChild>
Members
Constructors
| Name | Description |
|---|---|
| ViewChild(IView, Vector2) | Provides information about a view that is the child of another view. Used for interactions. |
Properties
| Name | Description |
|---|---|
| EqualityContract | |
| Position | The position of the View, relative to the parent. |
| View | The child view. |
Methods
| Name | Description |
|---|---|
| Center() | Gets the point at the exact center of the view. |
| CenterPoint() | Gets the nearest whole pixel point at the exact center of the view. |
| ContainsPoint(Vector2) | Checks if a given point, relative to the view's parent, is within the bounds of this child. |
| FocusSearch(Vector2, Direction) | Performs a focus search on the referenced view. |
| GetActualBounds() | Returns a Bounds representing the parent-relative layout bounds of this child. |
| GetContentBounds() | Returns a Bounds representing the parent-relative content bounds of this child. |
| GetFloatingBounds() | Returns a sequence of Bounds representing the parent-relative bounds of this child's own floating elements and those of all its descendants. |
| IsInDirection(Vector2, Direction) | Checks if a view can be reached by travelling from a given point in a given direction. |
| IsVisible(Vector2) | Checks if the visible area of this child contains a point relative to the view's parent. |
| Offset(Vector2) | Offsets the position by a given distance. |
Details
Constructors
ViewChild(IView, Vector2)
Provides information about a view that is the child of another view. Used for interactions.
Parameters
View IView
The child view.
Position Vector2
The position of the View, relative to the parent.
Properties
EqualityContract
Property Value
Position
The position of the View, relative to the parent.
Property Value
View
The child view.
Property Value
Methods
Center()
Gets the point at the exact center of the view.
Returns
CenterPoint()
Gets the nearest whole pixel point at the exact center of the view.
Returns
ContainsPoint(Vector2)
Checks if a given point, relative to the view's parent, is within the bounds of this child.
Parameters
point Vector2
The point to test.
Returns
true if point is within the parent-relative bounds of this child; otherwise false.
FocusSearch(Vector2, Direction)
Performs a focus search on the referenced view.
public StardewUI.Input.FocusSearchResult FocusSearch(Microsoft.Xna.Framework.Vector2 contentPosition, StardewUI.Direction direction);
Parameters
contentPosition Vector2
The current position, relative to the parent that owns this child.
direction Direction
The direction of cursor movement.
Returns
The next focusable view reached by moving in the specified direction, or null if there are no focusable descendants that are possible to reach in that direction.
Remarks
This is equivalent to FocusSearch(Vector2, Direction) but implicitly handles its own Position, so it can be used recursively without directly adjusting any coordinates.
GetActualBounds()
Returns a Bounds representing the parent-relative layout bounds of this child.
Returns
Remarks
Equivalent to the ActualBounds offset by this child's Position.
GetContentBounds()
Returns a Bounds representing the parent-relative content bounds of this child.
Returns
Remarks
Equivalent to the ContentBounds offset by this child's Position.
GetFloatingBounds()
Returns a sequence of Bounds representing the parent-relative bounds of this child's own floating elements and those of all its descendants.
Returns
IsInDirection(Vector2, Direction)
Checks if a view can be reached by travelling from a given point in a given direction.
Parameters
origin Vector2
The origin point.
direction Direction
The direction from origin.
Returns
true if the view's boundaries either already contain the origin or are in the specified direction from the origin; otherwise false.
IsVisible(Vector2)
Checks if the visible area of this child contains a point relative to the view's parent.
Parameters
point Vector2
The point to test.
Returns
true if point is within the visible, parent-relative bounds of this child; otherwise false.
Offset(Vector2)
Offsets the position by a given distance.
Parameters
distance Vector2
The offset distance.
Returns
A copy of the current ViewChild having the same View and a Position offset by distance.