import { InteractionEvent, InteractionManager } from "pixi.js"; import { DButtonBaseWhen } from "./d-button-base-when"; import { DButtonGroup } from "./d-button-group"; import { DImageBase, DImageBaseEvents, DImageBaseOptions, DThemeImageBase } from "./d-image-base"; import { DOnOptions } from "./d-on-options"; import { DBaseStateSet } from "./d-base-state-set"; /** * {@link DButtonBase} events. */ export interface DButtonBaseEvents extends DImageBaseEvents { /** * Triggered when the button is activated. * * @param emitter an emitter */ active(emitter: EMITTER): void; /** * Triggered when the button is inactivated. * * @param emitter an emitter */ inactive(emitter: EMITTER): void; /** * Triggered when the button is pressed. * * @param emitter an emitter */ press(emitter: EMITTER): void; /** * Triggered when the button is released. * * @param emitter an emitter */ unpress(emitter: EMITTER): void; } /** * {@link DButtonBase} "on" options. */ export interface DButtonBaseOnOptions extends Partial>, DOnOptions { } /** * {@link DButtonBase} options. */ export interface DButtonBaseOptions = DThemeButtonBase, EMITTER = any> extends DImageBaseOptions { /** * True to turn a toggle mode on. */ toggle?: boolean; /** * A button group. */ group?: DButtonGroup; /** * An option when to activate a button. */ when?: DButtonBaseWhen | keyof typeof DButtonBaseWhen; /** * Mappings of event names and handlers. */ on?: DButtonBaseOnOptions; } /** * {@link DButtonBase} theme. */ export interface DThemeButtonBase extends DThemeImageBase { /** * Returns true to turn a toggle mode on. */ isToggle(): boolean; /** * Returns when to activate a button. */ getWhen(): DButtonBaseWhen; } /** * A base class for button classes. * See {@link DButtonBaseEvents} for event details. */ export declare class DButtonBase = DThemeButtonBase, OPTIONS extends DButtonBaseOptions = DButtonBaseOptions> extends DImageBase { protected _isToggle?: boolean; protected _isGrouped?: boolean; protected _when?: DButtonBaseWhen; protected init(options?: OPTIONS): void; protected onShortcut(e: KeyboardEvent): void; get isToggle(): boolean; get isGrouped(): boolean; set isGrouped(isGrouped: boolean); protected initOnPress(): void; protected getType(): string; protected onClick(e: InteractionEvent): void; protected onDblClick(e: MouseEvent | TouchEvent, interactionManager: InteractionManager): boolean; activate(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): void; protected onActivate(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): void; protected onInactivate(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): void; toggle(): void; protected onToggleStart(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): void; protected onToggleEnd(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): void; protected onActivateKeyDown(e: KeyboardEvent): void; protected onActivateKeyUp(e: KeyboardEvent): void; protected onKeyDown(e: KeyboardEvent): boolean; protected onKeyUp(e: KeyboardEvent): boolean; protected onStateChange(newState: DBaseStateSet, oldState: DBaseStateSet): void; protected onPress(): void; protected onUnpress(): void; destroy(): void; }