Class Overlay
Definition
Namespace: StardewUI.Overlays
Assembly: StardewUI.dll
A basic overlay with immutable properties.
Inheritance
Object ⇦ Overlay
Implements
IOverlay
Members
Constructors
Name | Description |
---|---|
Overlay(IView, IView, Alignment, Alignment, Alignment, Alignment, Vector2) | A basic overlay with immutable properties. |
Properties
Name | Description |
---|---|
HorizontalAlignment | Horizontal alignment of the overlay relative to the Parent edge. |
HorizontalParentAlignment | Specifies which edge of the Parent (or screen, if no parent is specified) will be used to align the overlay edge denoted by its HorizontalAlignment. |
Parent | The parent of this overlay, used for positioning. If not specified, then the overlay will be positioned relative to the entire UI viewport. |
ParentOffset | Additional pixel offset to apply to the overlay's position, after alignments. |
VerticalAlignment | Vertical alignment of the overlay relative to the Parent edge. |
VerticalParentAlignment | Specifies which edge of the Parent (or screen, if no parent is specified) will be used to align the overlay edge denoted by its VerticalAlignment. |
View | The view to be displayed/interacted with as an overlay. |
Methods
Name | Description |
---|---|
OnClose() | Runs when the overlay is removed from the active stack. |
OnClose(Action) | Registers an action to be run when the overlay is closed. |
Pop() | Removes the front-most overlay. |
Push(IOverlay) | Pushes an overlay to the front. |
Remove(IOverlay) | Removes a specific overlay from the stack, regardless of its position. |
Events
Name | Description |
---|---|
Close | Raised when the overlay is removed from the active stack. |
Details
Constructors
Overlay(IView, IView, Alignment, Alignment, Alignment, Alignment, Vector2)
A basic overlay with immutable properties.
public Overlay(StardewUI.IView view, StardewUI.IView parent, StardewUI.Layout.Alignment horizontalAlignment, StardewUI.Layout.Alignment horizontalParentAlignment, StardewUI.Layout.Alignment verticalAlignment, StardewUI.Layout.Alignment verticalParentAlignment, Microsoft.Xna.Framework.Vector2 parentOffset);
Parameters
horizontalAlignment
Alignment
The HorizontalAlignment.
horizontalParentAlignment
Alignment
The HorizontalParentAlignment.
verticalAlignment
Alignment
The VerticalAlignment.
verticalParentAlignment
Alignment
The VerticalParentAlignment.
parentOffset
Vector2
The ParentOffset.
Properties
HorizontalAlignment
Horizontal alignment of the overlay relative to the Parent edge.
Property Value
Remarks
Specifies which edge of the overlay is used for positioning, regardless of which parent edge it is aligning to. For example, a HorizontalAlignment of Start and a HorizontalParentAlignment of End means that the overlay's left edge will be aligned to the parent's right edge; similarly, if both are set to Start, then the overlay's left edge is aligned to the parent's left edge.
HorizontalParentAlignment
Specifies which edge of the Parent (or screen, if no parent is specified) will be used to align the overlay edge denoted by its HorizontalAlignment.
Property Value
Remarks
For example, a HorizontalAlignment of Start and a HorizontalParentAlignment of End means that the overlay's left edge will be aligned to the parent's right edge; similarly, if both are set to Start, then the overlay's left edge is aligned to the parent's left edge.
Parent
The parent of this overlay, used for positioning. If not specified, then the overlay will be positioned relative to the entire UI viewport.
Property Value
ParentOffset
Additional pixel offset to apply to the overlay's position, after alignments.
Property Value
VerticalAlignment
Vertical alignment of the overlay relative to the Parent edge.
Property Value
Remarks
Specifies which edge of the overlay is used for positioning, regardless of which parent edge it is aligning to. For example, a VerticalAlignment of Start and a VerticalParentAlignment of End means that the overlay's top edge will be aligned to the parent's bottom edge; similarly, if both are set to Start, then the overlay's top edge is aligned to the parent's top edge.
VerticalParentAlignment
Specifies which edge of the Parent (or screen, if no parent is specified) will be used to align the overlay edge denoted by its VerticalAlignment.
Property Value
Remarks
For example, a VerticalAlignment of Start and a VerticalParentAlignment of End means that the overlay's top edge will be aligned to the parent's bottom edge; similarly, if both are set to Start, then the overlay's top edge is aligned to the parent's top edge.
View
The view to be displayed/interacted with as an overlay.
Property Value
Methods
OnClose()
Runs when the overlay is removed from the active stack.
OnClose(Action)
Registers an action to be run when the overlay is closed.
Parameters
onClose
Action
The action to run on close.
Returns
The current Overlay instance.
Remarks
Typically chained to the constructor when creating a new overlay.
Pop()
Removes the front-most overlay.
Returns
Remarks
Applies to the ambient OverlayContext, and is ignored if no context is available.
Push(IOverlay)
Pushes an overlay to the front.
Parameters
overlay
IOverlay
Remarks
If the specified overlay
is already in the stack, then it will be moved from its previous position to the front.
Applies to the ambient OverlayContext, and is ignored if no context is available.
Remove(IOverlay)
Removes a specific overlay from the stack, regardless of its position.
Parameters
overlay
IOverlay
The overlay to remove.
Returns
true
if the overlay
was removed; false
if it was not active.
Remarks
This is most often invoked by an overlay needing to dismiss itself, e.g. an overlay with an "OK" or "Close" button.
Applies to the ambient OverlayContext, and is ignored if no context is available.
Events
Close
Raised when the overlay is removed from the active stack.