lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
55 lines (54 loc) • 2.23 kB
TypeScript
import { ButtonClickHelper } from '../helpers/ButtonClickHelper.js';
import { Widget } from './Widget.js';
import { WidgetEvent } from '../events/WidgetEvent.js';
import type { Viewport } from '../core/Viewport.js';
import type { Root } from '../core/Root.js';
import type { Rect } from '../helpers/Rect.js';
import type { WidgetAutoXML } from '../xml/WidgetAutoXML.js';
import type { ClickableWidgetProperties } from './ClickableWidgetProperties.js';
import { type Box } from '../state/Box.js';
/**
* A checkbox widget; can be ticked or unticked.
*
* @category Widget
*/
export declare class Checkbox extends Widget {
static autoXML: WidgetAutoXML;
/** Horizontal offset. */
private offsetX;
/** Vertical offset. */
private offsetY;
/** Actual length after resolving layout. */
private actualLength;
/** The helper used for handling pointer clicks and enter presses */
protected clickHelper: ButtonClickHelper;
/** The helper for keeping track of the checkbox value */
readonly variable: Box<boolean>;
/** The callback used for the {@link Checkbox#"variable"} */
private readonly callback;
/** See {@link Checkbox#clickable} */
private _clickable;
/**
* @param variable - The {@link Box} where the value will be stored.
*/
constructor(variable?: Box<boolean>, properties?: Readonly<ClickableWidgetProperties>);
protected handleChange(): void;
attach(root: Root, viewport: Viewport, parent: Widget | null): void;
detach(): void;
protected activate(): void;
protected onThemeUpdated(property?: string | null): void;
/** Is the checkbox checked? */
set checked(checked: boolean);
get checked(): boolean;
protected handleEvent(event: WidgetEvent): Widget | null;
protected handleResolveDimensions(minWidth: number, maxWidth: number, minHeight: number, maxHeight: number): void;
finalizeBounds(): void;
protected handlePainting(_dirtyRects: Array<Rect>): void;
/**
* Is the checkbox clickable? True by default. Used for disabling the
* checkbox without hiding it.
*/
get clickable(): boolean;
set clickable(clickable: boolean);
protected handlePreLayoutUpdate(): void;
}