Skip to main content

Class: SoftKeyMenuSystem

A system that manages Garmin softkey menus.

Individual softkey menus are registered with the menu system under a unique string name. After a menu is registered, it can be pushed onto the system's menu stack. The top-most menu in the stack is considered the current menu. Menu navigation is achieved using operations on the stack:

  • push: navigates to a new menu while preserving history.
  • replace: navigates to a new menu without preserving history.
  • pop: return to the previous menu stored in history.
  • clear: removes the current menu and clears all history.

Constructors

constructor

new SoftKeyMenuSystem(bus, hEventMap): SoftKeyMenuSystem

Creates an instance of SoftKeyMenuSystem.

Parameters

NameTypeDescription
busEventBusThe event bus to use with this instance.
hEventMap(hEvent: string) => undefined | numberA function which maps H events to softkey indexes. The function should return the index of the pressed softkey for softkey press H events, and undefined for all other H events.

Returns

SoftKeyMenuSystem

Defined in

src/garminsdk/softkey/SoftKeyMenuSystem.ts:40

Properties

bus

Readonly bus: EventBus

The event bus to use with this instance.

Defined in

src/garminsdk/softkey/SoftKeyMenuSystem.ts:40


currentMenu

Readonly currentMenu: Subscribable<null | SoftKeyMenu>

The current menu, or null if there is no current menu.

Defined in

src/garminsdk/softkey/SoftKeyMenuSystem.ts:32

Methods

back

back(): void

Removes this system's current menu from the menu stack and makes the next highest menu on the stack the new current menu.

Returns

void

Defined in

src/garminsdk/softkey/SoftKeyMenuSystem.ts:112


clear

clear(): void

Clears this system's menu stack of all menus.

Returns

void

Defined in

src/garminsdk/softkey/SoftKeyMenuSystem.ts:120


getMenu

getMenu(menuName): undefined | SoftKeyMenu

Gets the softkey menu registered under a given name.

Parameters

NameTypeDescription
menuNamestringThe name of the menu.

Returns

undefined | SoftKeyMenu

The softkey menu registered under the specified name, or undefined if there is no such menu.

Defined in

src/garminsdk/softkey/SoftKeyMenuSystem.ts:69


pushMenu

pushMenu(name): void

Pushes a menu onto this system's menu stack. The pushed menu will become the new current menu.

Parameters

NameTypeDescription
namestringThe name of the menu to push.

Returns

void

Throws

Error if this system has no menu registered under the given name.

Defined in

src/garminsdk/softkey/SoftKeyMenuSystem.ts:78


registerMenu

registerMenu(name, factory): void

Registers a softkey menu with this menu system under a given name. If an existing menu is registered under the same name, it will be replaced by the new menu.

Parameters

NameTypeDescription
namestringThe name under which to register the menu.
factory(menuSystem: SoftKeyMenuSystem) => SoftKeyMenuA function which creates the menu to register.

Returns

void

Defined in

src/garminsdk/softkey/SoftKeyMenuSystem.ts:55


replaceMenu

replaceMenu(name): void

Replaces the current menu with another menu. The current menu will be removed from the stack and the replacement menu will become the new current menu.

Parameters

NameTypeDescription
namestringThe name of the replacement menu.

Returns

void

Throws

Error if this system has no menu registered under the given name.

Defined in

src/garminsdk/softkey/SoftKeyMenuSystem.ts:95