Skip to main content

Class: SoftKeyMenuSystem

Defined in: src/garminsdk/softkey/SoftKeyMenuSystem.ts:16

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

Defined in: src/garminsdk/softkey/SoftKeyMenuSystem.ts:40

Creates an instance of SoftKeyMenuSystem.

Parameters

ParameterTypeDescription
busEventBusThe event bus to use with this instance.
hEventMap(hEvent) => 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

Properties

bus

readonly bus: EventBus

Defined in: src/garminsdk/softkey/SoftKeyMenuSystem.ts:40

The event bus to use with this instance.


currentMenu

readonly currentMenu: Subscribable<null | SoftKeyMenu>

Defined in: src/garminsdk/softkey/SoftKeyMenuSystem.ts:32

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

Methods

back()

back(): void

Defined in: src/garminsdk/softkey/SoftKeyMenuSystem.ts:112

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


clear()

clear(): void

Defined in: src/garminsdk/softkey/SoftKeyMenuSystem.ts:120

Clears this system's menu stack of all menus.

Returns

void


getMenu()

getMenu(menuName): undefined | SoftKeyMenu

Defined in: src/garminsdk/softkey/SoftKeyMenuSystem.ts:69

Gets the softkey menu registered under a given name.

Parameters

ParameterTypeDescription
menuNamestringThe name of the menu.

Returns

undefined | SoftKeyMenu

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


pushMenu()

pushMenu(name): void

Defined in: src/garminsdk/softkey/SoftKeyMenuSystem.ts:78

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

Parameters

ParameterTypeDescription
namestringThe name of the menu to push.

Returns

void

Throws

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


registerMenu()

registerMenu(name, factory): void

Defined in: src/garminsdk/softkey/SoftKeyMenuSystem.ts:55

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

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

Returns

void


replaceMenu()

replaceMenu(name): void

Defined in: src/garminsdk/softkey/SoftKeyMenuSystem.ts:95

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

ParameterTypeDescription
namestringThe name of the replacement menu.

Returns

void

Throws

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