import { InteractionEvent } from "pixi.js"; import { DButton, DButtonEvents, DButtonOptions, DThemeButton } from "./d-button"; import { DDialogOpener } from "./d-dialog"; import { DDialogSelectOptions } from "./d-dialog-select"; import { DOnOptions } from "./d-on-options"; /** * A dialog to select values. */ export interface DButtonSelectDialog { value: VALUE | null; open(opener?: DDialogOpener): Promise; } /** * A function to retrieve a selected value from a dialog. */ export type DButtonSelectGetter = (dialog: DIALOG) => VALUE | null; /** * A function to set a selecte value to a dialog. * Called before opening a dialog. */ export type DButtonSelectSetter = (dialog: DIALOG, value: VALUE | null) => void; /** * {@link DButtonSelect} events. */ export interface DButtonSelectEvents extends DButtonEvents { /** * Triggered when a selection is changed. * * @param newValue a newly selected value * @param oldValue a previously selected value * @param emitter an emitter */ change(newValue: VALUE | null, oldValue: VALUE | null, emitter: EMITTER): void; } /** * {@link DButtonSelect} "on" options. */ export interface DButtonSelectOnOptions extends Partial>, DOnOptions { } /** * {@link DButtonSelect} options. */ export interface DButtonSelectOptions = DButtonSelectDialog, THEME extends DThemeButtonSelect = DThemeButtonSelect, EMITTER = any> extends DButtonOptions { /** * A function to retrieve a selected value from a dialog. */ getter?: DButtonSelectGetter; /** * A function to set a selected value to a dialog. * Called before opening a dialog. */ setter?: DButtonSelectSetter; /** * A dialog to select values. */ dialog?: DDialogSelectOptions | DIALOG; on?: DButtonSelectOnOptions; } /** * {@link DButtonSelect} theme. */ export interface DThemeButtonSelect extends DThemeButton { } export declare class DButtonSelect = DButtonSelectDialog, THEME extends DThemeButtonSelect = DThemeButtonSelect, OPTIONS extends DButtonSelectOptions = DButtonSelectOptions> extends DButton { protected _dialog?: DIALOG; protected _dialogGetter: DButtonSelectGetter; protected _dialogSetter: DButtonSelectSetter; constructor(options?: OPTIONS); protected onActivate(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): void; get dialog(): DIALOG; get value(): VALUE | null; set value(value: VALUE | null); protected getType(): string; }