popup.d.ts
130 lines
| 3.8 KiB
| video/mp2t
|
TypeScriptLexer
cin
|
r2 | import _WidgetBase = require("./_WidgetBase"); | ||
import { PlacePosition, PlaceLocation } from "./place"; | ||||
interface PopupOpenArgs { | ||||
/** | ||||
* widget to display | ||||
*/ | ||||
popup?: _WidgetBase; | ||||
/** | ||||
* the button etc. that is displaying this popup | ||||
*/ | ||||
parent?: _WidgetBase; | ||||
/** | ||||
* DOM node (typically a button); place popup relative to this node. (Specify this *or* "x" and "y" parameters.) | ||||
*/ | ||||
around?: HTMLElement; | ||||
/** | ||||
* Absolute horizontal position (in pixels) to place node at. (Specify this *or* "around" parameter.) | ||||
*/ | ||||
x?: number; | ||||
/** | ||||
* Absolute vertical position (in pixels) to place node at. (Specify this *or* "around" parameter.) | ||||
*/ | ||||
y?: number; | ||||
/** | ||||
* When the around parameter is specified, orient should be a list of positions to try | ||||
*/ | ||||
orient?: string | string[] | { BL?: string; TR?: string; TL?: string; BR?: string; }; | ||||
/** | ||||
* callback when user has canceled the popup by: | ||||
* | ||||
* 1. hitting ESC or | ||||
* 2. by using the popup widget's proprietary cancel mechanism (like a cancel button in a dialog); | ||||
* i.e. whenever popupWidget.onCancel() is called, args.onCancel is called | ||||
*/ | ||||
onCancel?: () => void; | ||||
/** | ||||
* callback whenever this popup is closed | ||||
*/ | ||||
onClose?: () => void; | ||||
/** | ||||
* callback when user "executed" on the popup/sub-popup by selecting a menu choice, etc. (top menu only) | ||||
*/ | ||||
onExecute?: () => void; | ||||
/** | ||||
* adding a buffer around the opening position. This is only useful when around is not set. | ||||
*/ | ||||
padding?: PlacePosition; | ||||
/** | ||||
* The max height for the popup. Any popup taller than this will have scrollbars. | ||||
* Set to Infinity for no max height. Default is to limit height to available space in viewport, | ||||
* above or below the aroundNode or specified x/y position. | ||||
*/ | ||||
maxHeight?: number; | ||||
} | ||||
interface PopupManager { | ||||
/** | ||||
* Stack of currently popped up widgets. | ||||
* (someone opened _stack[0], and then it opened _stack[1], etc.) | ||||
*/ | ||||
_stack: _WidgetBase[]; | ||||
/** | ||||
* Z-index of the first popup. (If first popup opens other | ||||
* popups they get a higher z-index.) | ||||
*/ | ||||
_beginZIndex: number; | ||||
_idGen: number; | ||||
/** | ||||
* If screen has been scrolled, reposition all the popups in the stack. | ||||
* Then set timer to check again later. | ||||
*/ | ||||
_repositionAll(): void; | ||||
/** | ||||
* Initialization for widgets that will be used as popups. | ||||
* Puts widget inside a wrapper DIV (if not already in one), | ||||
* and returns pointer to that wrapper DIV. | ||||
*/ | ||||
_createWrapper(widget: _WidgetBase): HTMLDivElement; | ||||
/** | ||||
* Moves the popup widget off-screen. | ||||
* Do not use this method to hide popups when not in use, because | ||||
* that will create an accessibility issue: the offscreen popup is | ||||
* still in the tabbing order. | ||||
*/ | ||||
moveOffScreen(widget: _WidgetBase): HTMLDivElement; | ||||
/** | ||||
* Hide this popup widget (until it is ready to be shown). | ||||
* Initialization for widgets that will be used as popups | ||||
* | ||||
* Also puts widget inside a wrapper DIV (if not already in one) | ||||
* | ||||
* If popup widget needs to layout it should | ||||
* do so when it is made visible, and popup._onShow() is called. | ||||
*/ | ||||
hide(widget: _WidgetBase): void; | ||||
/** | ||||
* Compute the closest ancestor popup that's *not* a child of another popup. | ||||
* Ex: For a TooltipDialog with a button that spawns a tree of menus, find the popup of the button. | ||||
*/ | ||||
getTopPopup(): _WidgetBase; | ||||
/** | ||||
* Popup the widget at the specified position | ||||
*/ | ||||
open(args: PopupOpenArgs): PlaceLocation; | ||||
/** | ||||
* Close specified popup and any popups that it parented. | ||||
* If no popup is specified, closes all popups. | ||||
*/ | ||||
close(popup?: _WidgetBase): void; | ||||
} | ||||