Skip to content

Class ClickEventArgs

Definition

Namespace: StardewUI.Events
Assembly: StardewUI.dll

Event arguments for a controller or mouse click.

public class ClickEventArgs : StardewUI.Events.PointerEventArgs, 
    StardewUI.Layout.IOffsettable<StardewUI.Events.ClickEventArgs>

Inheritance
ObjectEventArgsBubbleEventArgsPointerEventArgs ⇦ ClickEventArgs

Implements
IOffsettable<ClickEventArgs>

Members

Constructors

Name Description
ClickEventArgs(Vector2, SButton) Event arguments for a controller or mouse click.

Properties

Name Description
Button The specific button that triggered the click.
Handled Whether or not the view receiving the event handled the event. Set to true to prevent bubbling.
(Inherited from BubbleEventArgs)
Position The position, relative to the view receiving the event, of the pointer when the event occurred.
(Inherited from PointerEventArgs)

Methods

Name Description
IsPrimaryButton() Gets whether the pressed Button is the default for primary actions.
IsSecondaryButton() Gets whether the pressed Button is the default for secondary (context) actions.
Offset(Vector2) Creates a clone of this instance with an offset applied to its position.

Details

Constructors

ClickEventArgs(Vector2, SButton)

Event arguments for a controller or mouse click.

public ClickEventArgs(Microsoft.Xna.Framework.Vector2 position, StardewModdingAPI.SButton button);
Parameters

position   Vector2

button   SButton
The specific button that triggered the click.


Properties

Button

The specific button that triggered the click.

public StardewModdingAPI.SButton Button { get; }
Property Value

SButton


Methods

IsPrimaryButton()

Gets whether the pressed Button is the default for primary actions.

public bool IsPrimaryButton();
Returns

Boolean

true if the pressed Button is either MouseLeft or the configured gamepad action button; otherwise, false.


IsSecondaryButton()

Gets whether the pressed Button is the default for secondary (context) actions.

public bool IsSecondaryButton();
Returns

Boolean

true if the pressed Button is either MouseRight or the configured gamepad tool-use button; otherwise, false.


Offset(Vector2)

Creates a clone of this instance with an offset applied to its position.

public StardewUI.Events.ClickEventArgs Offset(Microsoft.Xna.Framework.Vector2 distance);
Parameters

distance   Vector2
The offset distance.

Returns

ClickEventArgs