UNPKG

lazy-widgets

Version:

Typescript retained mode GUI for the HTML canvas API

39 lines (38 loc) 1.51 kB
import { ButtonClickHelper } from '../helpers/ButtonClickHelper.js'; import { BaseContainer } from './BaseContainer.js'; import { WidgetEvent } from '../events/WidgetEvent.js'; import type { Widget } from './Widget.js'; import type { ClickableWidgetProperties } from './ClickableWidgetProperties.js'; import type { WidgetAutoXML } from '../xml/WidgetAutoXML.js'; /** * A {@link BaseContainer} which can be {@link ClickHelper | clicked} as a * button. Since the button grabs all events, no events are propagated to the * child. * * Can be constrained to a specific type of children. * * @category Widget */ export declare class Button<W extends Widget = Widget> extends BaseContainer<W> { static autoXML: WidgetAutoXML; /** The helper used for handling pointer clicks and enter presses */ protected clickHelper: ButtonClickHelper; /** See {@link Button#clickable} */ private _clickable; constructor(child: W, properties?: Readonly<ClickableWidgetProperties>); /** * Click the button. If the button is {@link Button#clickable}, then a * {@link ClickEvent} will be fired. */ click(): void; protected activate(): void; protected deactivate(): void; protected handleEvent(event: WidgetEvent): Widget | null; protected handlePreLayoutUpdate(): void; /** * Is the button clickable? True by default. Used for disabling the button * without hiding it. */ get clickable(): boolean; set clickable(clickable: boolean); }