UNPKG

lazy-widgets

Version:

Typescript retained mode GUI for the HTML canvas API

54 lines (53 loc) 2.02 kB
import { Theme } from '../theme/Theme.js'; import { Button } from './Button.js'; import { ClickableWidgetProperties } from './ClickableWidgetProperties.js'; import type { Widget, WidgetProperties } from './Widget.js'; import type { Rect } from '../helpers/Rect.js'; import type { WidgetAutoXML } from '../xml/WidgetAutoXML.js'; /** * Optional FilledButton constructor properties. * * @category Widget */ export interface FilledButtonProperties extends WidgetProperties { /** Sets {@link FilledButton#forced}. */ forced?: boolean; } /** * A {@link Button} which overrides the canvas colour, meaning that it has a * filled background. * * Can be constrained to a specific type of children. * * This button version can also be "forced down"; the button becomes similar to * being pressed, visually. Useful for implementing widgets such as * {@link ShiftKey}. * * @category Widget */ export declare class FilledButton<W extends Widget = Widget> extends Button<W> { static autoXML: WidgetAutoXML; /** Theme property used for overriding the canvas colour. */ private backgroundProperty; /** Is the button currently forced down? */ forced: boolean; /** The inherited theme for the child */ private childTheme; constructor(child: W, properties?: Readonly<FilledButtonProperties & ClickableWidgetProperties>); protected activate(): void; /** * Update the background fill. * * Sets {@link FilledButton#backgroundProperty} depending on * {@link FilledButton#forced} and {@link ButtonClickHelper#clickState}, * sets {@link FilledButton#childTheme}.{@link Theme#canvasFill} and marks * the widget as dirty. */ private updateBackground; private getBackgroundFill; set inheritedTheme(theme: Theme | undefined); get inheritedTheme(): Theme | undefined; protected onThemeUpdated(property?: string | null): void; protected handlePreLayoutUpdate(): void; protected handlePainting(dirtyRects: Array<Rect>): void; }