<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGMouseButton",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@E@CGMouseButton"
  },
  "title" : "CGMouseButton"
}
-->

# CGMouseButton

Constants that specify buttons on a one, two, or three-button mouse.

```
enum CGMouseButton
```

## Overview

Quartz supports up to 32 mouse buttons. The first three buttons are specified using these three constants. Additional buttons are specified in USB order using the integers 3 to 31.

These constants are used:

- In the function [`init(mouseEventSource:mouseType:mouseCursorPosition:mouseButton:)`](/documentation/CoreGraphics/CGEvent/init(mouseEventSource:mouseType:mouseCursorPosition:mouseButton:)) to specify the button that’s changing state.
- In the function [`buttonState(_:button:)`](/documentation/CoreGraphics/CGEventSource/buttonState(_:button:)) to specify the button that’s being tested.
- To specify the value of the `kCGMouseEventButtonNumber` event field when modifying an event.

## Topics

### Constants

[`CGMouseButton.left`](/documentation/CoreGraphics/CGMouseButton/left)

[`CGMouseButton.right`](/documentation/CoreGraphics/CGMouseButton/right)

[`CGMouseButton.center`](/documentation/CoreGraphics/CGMouseButton/center)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)