# PointerButtons

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerEvent.kt+class:androidx.compose.ui.input.pointer.PointerButtons) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.1.0) Common/AllAndroid/JVM
- Cmn

  ```
  value class PointerButtons
  ```

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons#PointerButtons(kotlin.Int)(packedValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` | Cmn |

| ### Extension functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons.https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons#(androidx.compose.ui.input.pointer.PointerButtons).indexOfFirstPressed()()` Returns the index of first button pressed as used in `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.input.pointer.PointerButtons).isPressed(kotlin.Int)` or `-1` if no button is pressed. | Cmn android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons.https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons#(androidx.compose.ui.input.pointer.PointerButtons).indexOfLastPressed()()` Returns the index of last button pressed as used in `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.input.pointer.PointerButtons).isPressed(kotlin.Int)` or `-1` if no button is pressed. | Cmn android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons.https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons#(androidx.compose.ui.input.pointer.PointerButtons).isPressed(kotlin.Int)(buttonIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns `true` when the button at `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.input.pointer.PointerButtons).isPressed(kotlin.Int)` is pressed and `false` when it isn't pressed. | Cmn android |

| ### Extension properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons.https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons#(androidx.compose.ui.input.pointer.PointerButtons).areAnyPressed()` Returns `true` if any button is pressed or `false` if all buttons are released. | Cmn android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons.https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons#(androidx.compose.ui.input.pointer.PointerButtons).isBackPressed()` `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." | Cmn android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons.https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons#(androidx.compose.ui.input.pointer.PointerButtons).isForwardPressed()` `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." | Cmn android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons.https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons#(androidx.compose.ui.input.pointer.PointerButtons).isPrimaryPressed()` `true` when the primary button (left mouse button) is pressed or `false` when it isn't pressed. | Cmn android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons.https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons#(androidx.compose.ui.input.pointer.PointerButtons).isSecondaryPressed()` `true` when the secondary button (right mouse button) is pressed or `false` when it isn't pressed. | Cmn android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons.https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/PointerButtons#(androidx.compose.ui.input.pointer.PointerButtons).isTertiaryPressed()` `true` when the tertiary button (middle mouse button) is pressed or `false` when it isn't pressed. | Cmn android |

## Public constructors

### PointerButtons

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
PointerButtons(packedValue: Int = 0)
```

## Extension functions

### PointerButtons.indexOfFirstPressed

Cmn android Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerEvent.+function:indexOfFirstPressed)

```
fun PointerButtons.indexOfFirstPressed(): Int
```

Returns the index of first button pressed as used in `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.input.pointer.PointerButtons).isPressed(kotlin.Int)` or `-1` if no button is pressed.

### PointerButtons.indexOfLastPressed

Cmn android Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerEvent.+function:indexOfLastPressed)

```
fun PointerButtons.indexOfLastPressed(): Int
```

Returns the index of last button pressed as used in `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.input.pointer.PointerButtons).isPressed(kotlin.Int)` or `-1` if no button is pressed.

### PointerButtons.isPressed

Cmn android Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerEvent.+function:isPressed)

```
fun PointerButtons.isPressed(buttonIndex: Int): Boolean
```

Returns `true` when the button at `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.input.pointer.PointerButtons).isPressed(kotlin.Int)` is pressed and `false` when it isn't pressed. This method can handle buttons that haven't been assigned a designated purpose like `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.input.pointer.PointerButtons).isPrimaryPressed()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.input.pointer.PointerButtons).isSecondaryPressed()`.

## Extension properties

### PointerButtons.areAnyPressed

Cmn android Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerEvent.+symbol:areAnyPressed)

```
val PointerButtons.areAnyPressed: Boolean
```

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

### PointerButtons.isBackPressed

Cmn android Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerEvent.+symbol:isBackPressed)

```
val PointerButtons.isBackPressed: 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."

### PointerButtons.isForwardPressed

Cmn android Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerEvent.+symbol:isForwardPressed)

```
val PointerButtons.isForwardPressed: 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."

### PointerButtons.isPrimaryPressed

Cmn android Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerEvent.+symbol:isPrimaryPressed)

```
val PointerButtons.isPrimaryPressed: Boolean
```

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

### PointerButtons.isSecondaryPressed

Cmn android Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerEvent.+symbol:isSecondaryPressed)

```
val PointerButtons.isSecondaryPressed: Boolean
```

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

### PointerButtons.isTertiaryPressed

Cmn android Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerEvent.+symbol:isTertiaryPressed)

```
val PointerButtons.isTertiaryPressed: Boolean
```

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