Atlas Engine
API Referencegraphite

Checkbox

Toggleable checkbox with a label and change callback support.

Module: graphite

Toggleable checkbox with a label and change callback support.

Declaration

export class Checkbox extends UIObject { ... }

Extends: UIObject

Constructors

Creates a new checkbox.

constructor();

Creates a new checkbox.

constructor(font: Font, label: string, position: Position2d);

Properties

label

The label.

label: string;

font

The font.

font: Font;

position

The position in world space.

position: Position3d;

fontSize

The font size.

fontSize: number;

padding

The padding.

padding: Size2d;

boxSize

The box size.

boxSize: number;

spacing

The spacing.

spacing: number;

checked

Whether the checkbox is checked.

checked: boolean;

enabled

Whether this feature is enabled.

enabled: boolean;

textColor

The text color.

textColor: Color;

boxBackgroundColor

The box background color.

boxBackgroundColor: Color;

hoverBoxBackgroundColor

The hover box background color.

hoverBoxBackgroundColor: Color;

borderColor

The border color.

borderColor: Color;

activeBorderColor

The active border color.

activeBorderColor: Color;

checkColor

The check color.

checkColor: Color;

Methods

getSize

Returns the current dimensions.

override getSize(): Size2d;

getScreenPosition

Returns the UI element's screen-space position.

override getScreenPosition(): Position2d;

setScreenPosition

Sets the UI element's screen-space position.

override setScreenPosition(position: Position2d): void;

getLabel

Returns label.

getLabel(): string;

isChecked

Reports whether checked.

isChecked(): boolean;

isHovered

Reports whether hovered.

isHovered(): boolean;

isEnabled

Reports whether enabled.

isEnabled(): boolean;

style

Returns the element's style.

style(): UIStyle;

setLabel

Sets label.

setLabel(label: string): Checkbox;

setPadding

Sets padding.

setPadding(padding: Size2d): Checkbox;

setFontSize

Sets font size.

setFontSize(size: number): Checkbox;

setBoxSize

Sets box size.

setBoxSize(size: number): Checkbox;

setSpacing

Sets spacing.

setSpacing(spacing: number): Checkbox;

setStyle

Applies a style to the element.

setStyle(style: UIStyle): Checkbox;

setOnToggle

Registers the toggle callback and returns this checkbox for chaining.

setOnToggle(callback: Checkbox.ToggleCallback): Checkbox;

setChecked

Sets checked.

setChecked(checked: boolean): void;

setEnabled

Sets enabled.

setEnabled(enabled: boolean): void;

toggle

Toggle.

toggle(): void;

On this page