import { Point, Rectangle } from "pixi.js"; import { DAnimation } from "./d-animation"; import { DApplicationLayerLike } from "./d-application-layer-like"; import { DBase, DBaseEvents, DBaseOptions, DThemeBase } from "./d-base"; import { DControllerFocus, DFocusable } from "./d-controller-focus"; import { DDialogAlign } from "./d-dialog-align"; import { DDialogCloseOn } from "./d-dialog-close-on"; import { DDialogGesture, DDialogGestureOptions } from "./d-dialog-gesture"; import { DDialogGestureMode } from "./d-dialog-gesture-mode"; import { DDialogMode } from "./d-dialog-mode"; import { DOnOptions } from "./d-on-options"; import { DPadding } from "./d-padding"; import { UtilOverlay } from "./util/util-overlay"; import { DApplicationTarget } from "./d-application-like"; /** * {@link DDialog} events. */ export interface DDialogEvents extends DBaseEvents { /** * Triggered when a dialog is opened. * * @param emitter this */ open(emitter: EMITTER): void; /** * Triggered when a dialog is closed. * * @param emitter this */ close(emitter: EMITTER): void; } /** * {@link DDialog} `on` options. */ export interface DDialogOnOptions extends Partial>, DOnOptions { } /** * {@link DDialog} options. */ export interface DDialogOptions extends DBaseOptions { closeOn?: DDialogCloseOn | Array | keyof typeof DDialogCloseOn; animation?: DAnimation; /** * A dialog mode. */ mode?: DDialogMode | keyof typeof DDialogMode; alwaysOnTop?: boolean; sticky?: boolean; gesture?: boolean | DDialogGestureOptions; align?: DDialogAlign | null | keyof typeof DDialogAlign; /** * Mappings of event names and handlers. */ on?: DDialogOnOptions; } /** * {@link DDialog} theme. */ export interface DThemeDialog extends DThemeBase { getMode(): DDialogMode; closeOn(mode: DDialogMode): DDialogCloseOn; isSticky(mode: DDialogMode): boolean; isAlwaysOnTop(): boolean; isGestureEnabled(mode: DDialogMode): boolean; getGestureMode(mode: DDialogMode): DDialogGestureMode; getOffsetX(mode: DDialogMode): number; getOffsetY(mode: DDialogMode): number; getAlign(mode: DDialogMode): DDialogAlign | null; newAnimation(mode: DDialogMode): DAnimation | null; } export interface DDialogOpener extends DApplicationTarget { getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle; } /** * A dialog class. * * If multiple application instances are there, better to set the constructor * option `parent` to an `application.stage` so that the dialog picks a right * application. `DDialog` searches applications in a following order: * * * To begin, `DDialog` tries to find applications which it belongs to. * * If `DDialog` can't find applications, then `DDialog` tries to find applications which openers belong to. * * If openers are not given, `DDialog` assumes the last created application at the very moment `DDialog` is instantiated is the one it belongs to. */ export declare class DDialog = DDialogOptions> extends DBase { protected static WORK_BOUNDS?: Rectangle; protected _promise?: Promise; protected _resolve?: (value: VALUE | PromiseLike) => void; protected _reject?: (reason?: any) => void; protected _animation?: DAnimation | null; protected _closeOn: DDialogCloseOn; protected _focused?: DFocusable | null; protected _overlay: UtilOverlay; protected _mode: DDialogMode; protected _alwaysOnTop: boolean; protected _onParentChildAddedBound?: () => void; protected _sticky: boolean; protected _onPrerenderBound: () => void; protected _align: DDialogAlign | null; protected _opener?: DDialogOpener | null; protected _gesture: DDialogGesture; protected _layer: DApplicationLayerLike | null; protected init(options?: OPTIONS): void; protected toCloseOn(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogCloseOn; protected toAlign(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogAlign | null; get mode(): DDialogMode; get align(): DDialogAlign | null; set algin(align: DDialogAlign | null); get alwaysOnTop(): boolean; set alwaysOnTop(alwaysOnTop: boolean); get gesture(): DDialogGesture; get layer(): DApplicationLayerLike | null; protected toGestureOptions(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogGestureOptions; onParentResize(parentWidth: number, parentHeight: number, parentPadding: DPadding): void; protected getAnimation(): DAnimation | null; protected onAnimationEnd(isReverse: boolean): void; protected findFirstFocusable(focusController: DControllerFocus): DFocusable | null; /** * Opens a dialog. * * @param opener An opener of a dialog. * The dialog position is determined based on a position and a size of the opener. * If the opener is undefined, the dialog is placed at the center of the screen. * * @returns a value of this dialog */ open(opener?: DDialogOpener): Promise; protected onChildFocus(focused: DBase): void; protected onFocus(): void; protected bringToFront(): void; protected onPrerender(): void; protected onOpen(): void; isOpened(): boolean; close(): void; protected doResolve(value: VALUE | PromiseLike): void; protected doReject(reason?: any): void; protected onClose(): void; protected onKeyDown(e: KeyboardEvent): boolean; protected onCloseOn(): void; protected containsGlobalPoint(point: Point): boolean; protected getType(): string; }