#cp.app.menu
Represents an app's menu bar, providing multi-lingual access to find and trigger menu items.
#API Overview
Constants - Useful values which cannot be changed
Constructors - API calls which return an object, typically one that offers API methods
Fields - Variables which can only be accessed from an object returned by a constructor
Methods - API calls which can only be made on an object returned by a constructor
- addMenuFinder
- app
- doFindMenuUI
- doIsEnabled
- doSelectMenu
- findMenuUI
- getMenuTitles
- isChecked
- isEnabled
- selectMenu
- visitMenuItems
#API Documentation
#Constants
Signature | cp.app.menu.NIB_FILE -> string |
Type | Constant |
Description | Main NIB File. |
Notes | None |
Source | src/extensions/cp/app/menu.lua line 59 |
Signature | cp.app.menu.ROLE -> string |
Type | Constant |
Description | The menu role |
Notes | None |
Source | src/extensions/cp/app/menu.lua line 49 |
Signature | cp.app.menu.STORYBOARD_NAME -> string |
Type | Constant |
Description | Main Storyboard name. |
Notes | None |
Source | src/extensions/cp/app/menu.lua line 69 |
#Constructors
Signature | cp.app.menu(app) -> menu |
Type | Constructor |
Description | Constructs a new menu for the specified App. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/app/menu.lua line 403 |
#Fields
Signature | cp.app.menu.showing <cp.prop: boolean; read-only; live> |
Type | Field |
Description | Tells you if the app's Menu Bar is visible. |
Notes | None |
Source | src/extensions/cp/app/menu.lua line 434 |
Signature | cp.app.menu.UI <cp.prop:hs.axuielement; read-only; live> |
Type | Field |
Description | Returns the axuielement representing the menu. |
Notes | None |
Source | src/extensions/cp/app/menu.lua line 423 |
#Methods
Signature | cp.app.menu:addMenuFinder(finder) -> nothing |
Type | Method |
Description | Registers an AXMenuItem finder function. The finder's job is to take an individual 'find' step and return either the matching child, or nil if it can't be found. It is used by the addMenuFinder function. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/app/menu.lua line 637 |
Signature | cp.app.menu:app() -> cp.app |
Type | Method |
Description | Returns the cp.app instance this belongs to. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/app/menu.lua line 441 |
Signature | cp.app.menu:doFindMenuUI(path[, options]) -> cp.rx.go.Statement <hs.axuielement> |
Type | Method |
Description | Returns a Statement that when executed will emit each of the menu items along the path. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/app/menu.lua line 685 |
Signature | cp.app.menu:doIsEnabled(path, options) -> cp.rx.go.Statement |
Type | Method |
Description | A Statement that returns true if the item at the end of the path is enabled. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/app/menu.lua line 620 |
Signature | cp.app.menu:doSelectMenu(path, options) -> cp.rx.go.Statement <boolean> |
Type | Method |
Description | Selects a Menu Item based on the provided menu path. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/app/menu.lua line 483 |
Signature | cp.app.menu:findMenuUI(path[, options]) -> Menu UI, table |
Type | Method |
Description | Finds a specific Menu UI element for the provided path. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/app/menu.lua line 821 |
Signature | cp.app.menu:getMenuTitles([locales]) -> table |
Type | Method |
Description | Returns a table with the available menus, items and sub-menu, in the specified locales (if available). If no locales are specified, the app's current locale is loaded. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/app/menu.lua line 454 |
Signature | cp.app.menu:isChecked(path[, options]) -> boolean |
Type | Method |
Description | Is a menu item checked? |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/app/menu.lua line 582 |
Signature | cp.app.menu:isEnabled(path[, options]) -> boolean |
Type | Method |
Description | Is a menu item enabled? |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/app/menu.lua line 601 |
Signature | cp.app.menu:selectMenu(path[, options]) -> boolean |
Type | Method |
Description | Selects a Menu Item based on the list of menu titles in English. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/app/menu.lua line 526 |
Signature | cp.app.menu:visitMenuItems(visitFn[, options]]) -> nil |
Type | Method |
Description | Walks the menu tree, calling the visitFn on all the 'item' values - that is, AXMenuItem s that don't have any sub-menus. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/app/menu.lua line 977 |