Canvas Toolkit
← Class index

CLabel

Widgets · extends CFrame

Implements the label widget.

import { CLabel } from "canvas-toolkit-lib";

Declared members

readonly linkActivated: CSignal<[string]>;
constructor(parent?: CWidget | null);

Creates a new instance.

text(): string;

Provides text behavior.

setText(text: string): void;

Sets the text.

openExternalLinks(): boolean;
setOpenExternalLinks(enabled: boolean): void;

Also opens http(s), mailto and tel links in the browser. Defaults to false. Link markup is a limited <a href="...">caption</a> subset, not arbitrary HTML. linkActivated is emitted regardless of this setting, including internal URLs.

linkAt(x: number, y: number): string | null;

Returns the link at widget-local coordinates, or null outside link glyphs.

setGeometry(x: number, y: number, width: number, height: number): void;
cursor(): CCursorShape;
protected mouseReleaseEvent(event: CMouseEvent): void;
protected mouseMoveEvent(event: CMouseEvent): void;
protected mouseLeaveEvent(event: CMouseEvent): void;
protected keyPressEvent(event: CKeyEvent): void;
protected focusOutEvent(event: CFocusEvent): void;
setEnabled(enabled: boolean): void;
protected visibilityChangeEvent(): void;
buddy(): CWidget | null;

Returns the widget associated with this label.

setBuddy(buddy: CWidget | null): void;

Associates an input widget; null restores literal ampersand text.

displayText(): string;

Visible text, with mnemonic markers removed when a buddy is set.

mnemonicIndex(): number;

UTF-16 index of the character to underline, or -1.

mnemonic(): string;

Character activated by Alt, or an empty string when there is none.

activateBuddy(): boolean;

Focuses the buddy if both widgets are available in the active scope.

protected mousePressEvent(event: CMouseEvent): void;
destroy(): void;
alignment(): CAlignment;

Provides alignment behavior.

setAlignment(alignment: CAlignment): void;

Sets the alignment.

pixmap(): CPixmap | null;

Provides pixmap behavior.

setPixmap(pixmap: CPixmap | null): void;

Sets the pixmap.

wordWrap(): boolean;
setWordWrap(enabled: boolean): void;
hasHeightForWidth(): boolean;
heightForWidth(width: number): number;
sizeHint(): CSize;

Returns the preferred size of the widget.

protected paintEvent(painter: CPainter): void;

Handles the paint event.