/** @packageDocumentation * @module KeyboardShortcut */ import { FunctionKey, SpecialKey } from "@bentley/ui-abstract"; import { ActionButtonItemDef } from "../shared/ActionButtonItemDef"; import { ItemDefBase } from "../shared/ItemDefBase"; import { ItemProps } from "../shared/ItemProps"; /** Properties for a Keyboard Shortcut * @public */ export interface KeyboardShortcutProps extends ItemProps { /** The key that invokes the shortcut. * This is either an alphanumeric key, a function key or a special key. */ key: string | FunctionKey | SpecialKey; /** The item to execute when this shortcut is invoked. Either 'item' or 'shortcuts' must be specified. */ item?: ActionButtonItemDef; /** Nested array of shortcut props. Either 'item' or 'shortcuts' must be specified. */ shortcuts?: KeyboardShortcutProps[]; /** Indicates whether the Alt key required. Default - false */ isAltKeyRequired?: boolean; /** Indicates whether the Ctrl key required. Default - false */ isCtrlKeyRequired?: boolean; /** Indicates whether the Shift key required. Default - false */ isShiftKeyRequired?: boolean; } /** Keyboard Shortcut used to execute an action * @public */ export declare class KeyboardShortcut extends ItemDefBase { private _key; private _item?; private _shortcuts; private _isAltKeyRequired; private _isCtrlKeyRequired; private _isShiftKeyRequired; private _isFunctionKey; private _isSpecialKey; constructor(props: KeyboardShortcutProps); /** Returns the id for this shortcut */ get id(): string; /** Returns the shortcut container */ get shortcutContainer(): KeyboardShortcutContainer; /** Finds a shortcut with a given key in the shortcut's container */ getShortcut(mapKey: string): KeyboardShortcut | undefined; /** Returns the shortcut's key map key used as the id */ get keyMapKey(): string; /** Returns the [[ActionButtonItemDef]] associated with this shortcut */ get item(): ActionButtonItemDef | undefined; /** Called when the [[ActionButtonItemDef]] associated with this shortcut is invoked */ itemPicked(): void; /** Gets the keyboard key */ get key(): string; /** Gets whether the Alt key required. */ get isAltKeyRequired(): boolean; /** Gets whether the Ctrl key required. */ get isCtrlKeyRequired(): boolean; /** Gets whether the Shift key required. */ get isShiftKeyRequired(): boolean; /** Gets whether this is a Function key. */ get isFunctionKey(): boolean; /** Gets whether this is a Special key. */ get isSpecialKey(): boolean; } /** Keyboard Shortcut Container * @public */ export declare class KeyboardShortcutContainer { private _keyMap; private _keyArray; /** Registers a Keyboard Shortcut associated with a given key in the managed list */ registerKey(keyMapKey: string, inShortcut: KeyboardShortcut): KeyboardShortcut | undefined; /** Finds a Keyboard Shortcut associated with a given key */ findKey(keyMapKey: string): KeyboardShortcut | undefined; /** Determines if any Keyboard Shortcuts are available in this container */ areKeyboardShortcutsAvailable(): boolean; /** Empties any Keyboard Shortcuts from this container */ emptyData(): void; getAvailableKeyboardShortcuts(): KeyboardShortcut[]; /** Generates a key used for storing and finding the Keyboard Shortcuts in this container */ static generateKeyMapKey(keyboardKey: string, isAltKeyRequired: boolean, isCtrlKeyRequired: boolean, isShiftKeyRequired: boolean): string; /** Displays a menu for the Keyboard Shortcuts in this container */ showShortcutsMenu(): void; } /** Keyboard Shortcut Manager * @public */ export declare class KeyboardShortcutManager { private static _shortcuts; /** Initialize the Keyboard Shortcut manager */ static initialize(): void; /** Loads Keyboard Shortcuts into the managed list */ static loadKeyboardShortcuts(shortcutList: KeyboardShortcutProps[]): void; /** Loads a Keyboard Shortcut into the managed list */ static loadKeyboardShortcut(shortcutProps: KeyboardShortcutProps): void; /** Processes a keystroke and invokes a matching Keyboard Shortcut */ static processKey(keyboardKey: string, isAltKeyPressed?: boolean, isCtrlKeyPressed?: boolean, isShiftKeyPressed?: boolean): boolean; /** Returns the managed list of Keyboard Shortcuts */ static get shortcutContainer(): KeyboardShortcutContainer; /** Returns a Keyboard Shortcut from the managed lists */ static getShortcut(keyMapKey: string): KeyboardShortcut | undefined; /** Determines if focus is set to Home */ static get isFocusOnHome(): boolean; /** Sets focus to Home */ static setFocusToHome(): void; /** Displays the Keyboard Shortcuts menu at the cursor */ static displayShortcutsMenu(): void; /** Closes the Keyboard Shortcuts menu */ static closeShortcutsMenu(): void; /** Returns the cursor X position, which is mouseEvent.pageX. */ static get cursorX(): number; /** Returns the cursor Y position, which is mouseEvent.pageY. */ static get cursorY(): number; private static _handleSyncUiEvent; private static _traverseShortcuts; } //# sourceMappingURL=KeyboardShortcut.d.ts.map