Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Latest commit

 

History

History
138 lines (114 loc) · 9.85 KB

cp.ui.DisclosureTriangle.md

File metadata and controls

138 lines (114 loc) · 9.85 KB

docs » cp.ui.DisclosureTriangle


Disclosure Triangle UI Module.

This represents an hs._asm.axuielement with a AXDisclosureTriangle role. It allows checking and modifying the opened status like so:

myButton:opened() == true			-- happens to be opened already
myButton:opened(false) == false	-- update to unopened.
myButton.opened:toggle() == true	-- toggled back to being opened.

You can also call instances of DisclosureTriangle as a function, which will return the opened status:

myButton() == true			-- still true
myButton(false) == false	-- now false

API Overview

API Documentation

Functions

Signature cp.ui.DisclosureTriangle.matches(element) -> boolean
Type Function
Description Checks if the provided hs._asm.axuielement is a DisclosureTriangle.
Parameters
  • element - The axuielement to check.
Returns
  • true if it's a match, or false if not.

Constructors

Signature cp.ui.DisclosureTriangle(parent, uiFinder) -> cp.ui.DisclosureTriangle
Type Constructor
Description Creates a new DisclosureTriangle.
Parameters
  • parent - The parent object.
  • uiFinder - A function which will return the hs._asm.axuielement when available.
Returns
  • The new DisclosureTriangle.

Fields

Signature cp.ui.DisclosureTriangle.opened <cp.prop: boolean>
Type Field
Description Indicates if the disclosure triangle is currently opened.
Signature cp.ui.DisclosureTriangle.title <cp.prop: string; read-only>
Type Field
Description The button title, if available.

Methods

Signature cp.ui.DisclosureTriangle:click() -> self
Type Method
Description Performs a single mouse click on the triangle.
Parameters
  • None
Returns
  • The DisclosureTriangle instance.
Signature cp.ui.DisclosureTriangle:doClose() -> cp.rx.go.Statement
Type Method
Description Returns a Statement that will ensure the DisclosureTriangle is unopened.
Signature cp.ui.DisclosureTriangle:doOpen() -> cp.rx.go.Statement
Type Method
Description Returns a Statement that will ensure the DisclosureTriangle is opened.
Signature cp.ui.DisclosureTriangle:doPress() -> cp.rx.go.Statement
Type Method
Description Returns a Statement that will press the button when executed, if available at the time.
Parameters
  • None
Returns
  • The Statement which will press the button when executed.
Signature cp.ui.DisclosureTriangle:loadLayout(layout) -> nil
Type Method
Description Applies the settings in the provided layout table.
Parameters
  • layout - The table containing layout settings. Usually created by the saveLayout method.
Returns
  • nil
Signature cp.ui.DisclosureTriangle:press() -> self
Type Method
Description Attempts to press the button. May fail if the UI is not available.
Parameters
  • None
Returns

The DisclosureTriangle instance.

Signature cp.ui.DisclosureTriangle:saveLayout() -> table
Type Method
Description Returns a table containing the layout settings.
Parameters
  • None
Returns
  • A settings table.
Signature cp.ui.DisclosureTriangle:toggle() -> self
Type Method
Description Toggles the opened status of the button.
Parameters
  • None
Returns
  • The DisclosureTriangle instance.