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): SoftKeyMenuSystem

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

Creates an instance of SoftKeyMenuSystem.

Parameters​

ParameterTypeDescription
busEventBusThe event bus to use with this instance.

Returns​

SoftKeyMenuSystem

Properties​

bus​

readonly bus: EventBus

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

The event bus to use with this instance.


currentMenu​

readonly currentMenu: Subscribable<SoftKeyMenu | null>

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:104

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:112

Clears this system's menu stack of all menus.

Returns​

void


getMenu()​

getMenu(menuName): SoftKeyMenu | undefined

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

Gets the softkey menu registered under a given name.

Parameters​

ParameterTypeDescription
menuNamestringThe name of the menu.

Returns​

SoftKeyMenu | undefined

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


onSoftKeyPressed()​

onSoftKeyPressed(index): void

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

Handles a softkey press.

Parameters​

ParameterTypeDescription
indexnumberThe index of the pressed softkey.

Returns​

void


pushMenu()​

pushMenu(name): void

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

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:47

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:87

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.