{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

PointerButtons

value public final class PointerButtons


Contains the state of pointer buttons (e.g. mouse and stylus buttons).

Summary

Public constructors

Extension functions

final boolean

Returns true if any button is pressed or false if all buttons are released.

final int

Returns the index of first button pressed as used in isPressed or -1 if no button is pressed.

final int

Returns the index of last button pressed as used in isPressed or -1 if no button is pressed.

final boolean

true when the back button (mouse back button) is pressed or false when it isn't pressed or there is no mouse button assigned to "back."

final boolean

true when the forward button (mouse forward button) is pressed or false when it isn't pressed or there is no button assigned to "forward."

final boolean
PointerEventKt.isPressed(
    @NonNull PointerButtons receiver,
    int buttonIndex
)

Returns true when the button at buttonIndex is pressed and false when it isn't pressed.

final boolean

true when the primary button (left mouse button) is pressed or false when it isn't pressed.

final boolean

true when the secondary button (right mouse button) is pressed or false when it isn't pressed.

final boolean

true when the tertiary button (middle mouse button) is pressed or false when it isn't pressed.

Public constructors

PointerButtons

public PointerButtons(@NonNull NativePointerButtons packedValue)

Extension functions

PointerEventKt.getAreAnyPressed

public final boolean PointerEventKt.getAreAnyPressed(@NonNull PointerButtons receiver)

Returns true if any button is pressed or false if all buttons are released.

PointerEventKt.indexOfFirstPressed

public final int PointerEventKt.indexOfFirstPressed(@NonNull PointerButtons receiver)

Returns the index of first button pressed as used in isPressed or -1 if no button is pressed.

PointerEventKt.indexOfLastPressed

public final int PointerEventKt.indexOfLastPressed(@NonNull PointerButtons receiver)

Returns the index of last button pressed as used in isPressed or -1 if no button is pressed.

PointerEventKt.isBackPressed

public final boolean PointerEventKt.isBackPressed(@NonNull PointerButtons receiver)

true when the back button (mouse back button) is pressed or false when it isn't pressed or there is no mouse button assigned to "back."

PointerEventKt.isForwardPressed

public final boolean PointerEventKt.isForwardPressed(@NonNull PointerButtons receiver)

true when the forward button (mouse forward button) is pressed or false when it isn't pressed or there is no button assigned to "forward."

PointerEventKt.isPressed

public final boolean PointerEventKt.isPressed(
    @NonNull PointerButtons receiver,
    int buttonIndex
)

Returns true when the button at buttonIndex is pressed and false when it isn't pressed. This method can handle buttons that haven't been assigned a designated purpose like isPrimaryPressed and isSecondaryPressed.

PointerEventKt.isPrimaryPressed

public final boolean PointerEventKt.isPrimaryPressed(@NonNull PointerButtons receiver)

true when the primary button (left mouse button) is pressed or false when it isn't pressed.

PointerEventKt.isSecondaryPressed

public final boolean PointerEventKt.isSecondaryPressed(@NonNull PointerButtons receiver)

true when the secondary button (right mouse button) is pressed or false when it isn't pressed.

PointerEventKt.isTertiaryPressed

public final boolean PointerEventKt.isTertiaryPressed(@NonNull PointerButtons receiver)

true when the tertiary button (middle mouse button) is pressed or false when it isn't pressed.