import Async from "typescene-async"; import TextLabelFactory from "../TextLabelFactory"; /** Represents a dropdown or context menu */ export declare class Menu { /** The height (in pixels) of one menu item; used for calculating whether the menu fits on screen vertically, before displaying the menu below or above the mouse cursor or control element */ static ITEM_HEIGHT_PX: number; /** Display a modal context menu; returns a Promise that resolves to the index(base 1)/key of the selected menu item, or is rejected if the user cancels the context menu */ static displayAsContextMenu(event: MouseEvent, options: Menu.Option[]): Async.Promise; /** Display a modal dropdown menu above/below the given element (depending on available screen space); returns a Promise that resolves to the index(base 1)/key of the selected menu item, or is rejected if the user cancels the context menu */ static displayAsDropdown(ref: HTMLElement, options: Menu.Option[]): Async.Promise; /** Prepare a context/dropdown menu with the given list of options */ constructor(options?: Menu.Option[]); /** Menu options to be displayed */ options: Menu.Option[]; /** Display modal menu at given origin; use forceLeft parameter to force origin to be on the left, even if there may not be enough space; returns a Promise that resolves to the index(base 1)/key of the selected menu item, or is rejected if the user cancels the menu */ display(coords: Menu.Coordinates, forceLeft?: boolean): Async.Promise; /** Display modal menu at given origin, returns a Promise */ private _display(coords, forceLeft?, vertPush?, horizPush?, parent?); } export declare namespace Menu { /** Represents a context/dropdown menu option or divider */ interface Option { /** Optional key used to identify this option */ key?: string; /** Menu item label text */ label?: string | TextLabelFactory; /** Menu item icon */ icon?: string; /** Menu item icon displayed on the right hand side */ iconRight?: string; /** Set to true to disable this menu item */ disabled?: boolean; /** Set to true (and leave other options out) to display a divider instead of an option in this position */ divider?: boolean; /** Sub menu displayed when this item is selected */ subMenu?: Menu | Option[] | undefined | null; } } export declare namespace Menu { /** Context/dropdown menu root coordinates */ interface Coordinates { /** X-coordinate */ x: number; /** Y-coordinate */ y: number; } } export default Menu;