CWidget
Implements the widget widget.
import { CWidget } from "canvas-toolkit-lib";Declared members
constructor(parent?: CWidget | null);Creates a new instance.
static setTabOrder(first: CWidget, second: CWidget): void;Places second immediately after first in the keyboard focus order. Call pairs in sequence to build a chain. Widgets must belong to the same parent hierarchy; identical widgets or different roots are ignored. Hidden, disabled and non-Tab-focusable widgets keep their position but are skipped during navigation. This does not change the current focus.
parent(): CWidget | null;Provides parent behavior.
children(): readonly CWidget[];Provides children behavior.
setParent(parent: CWidget | null): void;Sets the parent.
geometry(): CRect;Provides geometry behavior.
rect(): CRect;Provides rect behavior.
x(): number;Provides x behavior.
y(): number;Provides y behavior.
width(): number;Provides width behavior.
height(): number;Provides height behavior.
setGeometry(x: number, y: number, width: number, height: number): void;Sets the geometry.
move(x: number, y: number): void;Provides move behavior.
resize(width: number, height: number): void;Provides resize behavior.
setVisible(visible: boolean): void;Sets the visible.
protected visibilityChangeEvent(): void;Called when this widget or an ancestor changes visibility or parent.
protected childrenAreVisible(): boolean;Controls effective child visibility without changing each child's explicit show/hide state.
protected notifyChildrenVisibilityChanged(): void;Notify descendants after a change to childrenAreVisible().
setEnabled(enabled: boolean): void;Sets this widget's own enabled state. A disabled ancestor disables its descendants.
isVisible(): boolean;Returns whether the visible condition is active.
font(): CFont;Provides font behavior.
fontMetrics(): CFontMetrics;Provides font metrics behavior.
setFont(font: CFont, propagate?: boolean): void;Sets the font.
palette(): CPalette;Returns an independent copy of the effective palette. Widgets without a local palette inherit from their nearest explicit ancestor or application.
hasExplicitPalette(): boolean;Whether setPalette() has installed a local override, even if its colors happen to equal the inherited palette.
setPalette(palette: CPalette, propagate?: boolean): void;Installs a local palette snapshot. Inheriting descendants follow it; descendants with explicit palettes keep theirs. Passing propagate=true explicitly replaces palettes on all widget descendants, as before.
resetPalette(propagate?: boolean): void;Removes the local override and resumes inheritance. With propagate=true, removes explicit overrides from all widget descendants as well.
style(): CStyle;Provides style behavior.
setCursor(cursor: CCursorShape): void;Sets the cursor.
cursor(): CCursorShape;Provides cursor behavior.
show(): void;Shows the widget.
hide(): void;Hides the widget.
acceptsClickFocus(): boolean;Provides accepts click focus behavior.
acceptsTabFocus(): boolean;Provides accepts tab focus behavior.
focusPolicy(): CFocusPolicy;Provides focus policy behavior.
setFocusPolicy(policy: CFocusPolicy): void;Sets the policy and propagates it to an assigned focus proxy.
focusProxy(): CWidget | null;Returns the direct focus proxy, or null.
setFocusProxy(proxy: CWidget | null): void;Redirects focus to another widget in the same parent hierarchy. Throws RangeError for self references, cycles, destroyed targets or targets in a different hierarchy. Null removes the redirection.
focusTarget(): CWidget;@internal Returns the final widget in the proxy chain.
canReceiveFocus(): boolean;@internal Whether programmatic focus can reach the final proxy target.
destroy(): void;Releases resources owned by the widget.
setInputBlocker(blocker: CWidget | null): void;@internal Installs a direct-child input shield, rendered above normal children.
inputBlocker(): CWidget | null;Returns the shield blocking input to this widget, excluding the shield's own subtree.
isEnabled(): boolean;Returns whether this widget and its ancestors are enabled.
hasFocus(): boolean;Returns whether this object has focus.
setFocus(): void;Sets the focus.
clearFocus(): void;Clears focus.
render(painter: CPainter): void;Renders the widget.
contentsRect(): CRect;Returns the widget's contents rectangle.
protected childOffset(): CPoint;Handles child offset behavior.
widgetAt(x: number, y: number): CWidget | null;Provides widget at behavior.
layout(): CLayout | null;Provides layout behavior.
setLayout(layout: CLayout): void;Sets the layout.
sizePolicy(): CSizePolicy;Returns a copy; apply changes with setSizePolicy().
setSizePolicy(policy: CSizePolicy): void;setSizePolicy(horizontal: CSizePolicyType, vertical: CSizePolicyType): void;minimumSize(): CSize;Returns the minimum size.
minimumWidth(): number;Returns the minimum width.
maximumWidth(): number;Returns the maximum width.
minimumHeight(): number;Returns the minimum height.
maximumHeight(): number;Returns the maximum height.
maximumSize(): CSize;Returns the maximum size.
setMinimumSize(width: number, height: number): void;Sets the minimum size.
setMaximumSize(width: number, height: number): void;Sets the maximum size.
setFixedSize(width: number, height: number): void;Sets the fixed size.
hasHeightForWidth(): boolean;Whether the preferred height depends on the available width.
revealTabFocus(_widget: CWidget): void;@internal Allows containers to reveal a descendant reached by Tab.
acceptsExternalFiles(): boolean;@internal
externalFileDragChanged(_active: boolean): void;@internal
dropExternalFiles(_files: readonly File[]): void;@internal
touchScrollAreaFor(_child: CWidget): CScrollArea | false | null;@internal Returns a touch pan owner, false to stop the search, or null to continue.
heightForWidth(width: number): number;Preferred height at the supplied width, or -1 when independent.
updateGeometry(): void;Notifies enclosing layouts after a change to preferred geometry.
sizeHint(): CSize;Returns the preferred size of the widget.
setToolTip(toolTip: string): void;Sets the tool tip.
toolTip(): string;Provides tool tip behavior.
acceptDrops(): boolean;Provides accept drops behavior.
setAcceptDrops(accept: boolean): void;Sets the accept drops.
update(): void;Provides update behavior.
event(event: CEvent): boolean;Provides event behavior.
mapFromCanvas(x: number, y: number): CPoint;Provides map from canvas behavior.
mapToCanvas(x: number, y: number): CPoint;Provides map to canvas behavior.
protected paintEvent(_painter: CPainter): void;Handles the paint event.
protected mousePressEvent(event: CMouseEvent): void;Handles the mouse press event.
protected mouseReleaseEvent(event: CMouseEvent): void;Handles the mouse release event.
protected mouseDoubleClickEvent(event: CMouseEvent): void;Handles the mouse double-click event.
protected mouseMoveEvent(event: CMouseEvent): void;Handles the mouse move event.
protected mouseEnterEvent(event: CMouseEvent): void;Handles the mouse enter event.
protected mouseLeaveEvent(event: CMouseEvent): void;Handles the mouse leave event.
protected focusInEvent(event: CFocusEvent): void;Handles the focus in event.
protected focusOutEvent(event: CFocusEvent): void;Handles the focus out event.
protected keyPressEvent(event: CKeyEvent): void;Handles the key press event.
protected keyReleaseEvent(event: CKeyEvent): void;Handles the key release event.
protected wheelEvent(event: CWheelEvent): void;Handles the wheel event.
protected contextMenuEvent(event: CContextMenuEvent): void;Handles the context menu event.
protected childVisibilityChanged(_child: CWidget): void;Handles child visibility changed behavior.
protected dragEnterEvent(event: CDragEnterEvent): void;Handles the drag enter event.
protected dragMoveEvent(event: CDragMoveEvent): void;Handles the drag move event.
protected dragLeaveEvent(event: CDragLeaveEvent): void;Handles the drag leave event.
protected dropEvent(event: CDropEvent): void;Handles the drop event.