Canvas Toolkit
← Class index

CListWidget

Widgets · extends CScrollArea

Implements the list widget widget.

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

Declared members

static readonly ItemHeight = 28;
static readonly HorizontalPadding = 8;
readonly itemActivated: CSignal<[CListWidgetItem]>;
readonly currentRowChanged: CSignal<[number]>;

Signal emitted when current row changes.

readonly itemClicked: CSignal<[CListWidgetItem]>;

Public item clicked member.

readonly itemSelectionChanged: CSignal<[]>;

Signal emitted when item selection changes.

constructor(parent?: CWidget | null);

Creates a new instance.

viewMode(): CListViewMode;
setViewMode(mode: CListViewMode): void;
gridSize(): CSize;
setGridSize(size: CSize): void;
iconSize(): CSize;
setIconSize(size: CSize): void;
spacing(): number;
setSpacing(spacing: number): void;
visualItemRect(item: CListWidgetItem): CRect;
destroy(): void;
contentKeyPressEvent(event: CKeyEvent): void;

Forwards keyboard input from the content widget to the owning list.

setGeometry(x: number, y: number, width: number, height: number): void;

Sets the geometry and updates the scrollable item area.

resize(width: number, height: number): void;

Resizes the widget and updates the scrollable item area.

addItem(item: string | CListWidgetItem): void;

Adds item.

insertItem(index: number, item: string | CListWidgetItem): void;

Inserts item.

takeItem(index: number): CListWidgetItem | null;

Removes and returns item.

clear(): void;

Clears the current contents.

count(): number;

Provides count behavior.

item(row: number): CListWidgetItem | null;

Provides item behavior.

row(item: CListWidgetItem): number;

Provides row behavior.

currentRow(): number;

Returns the current row.

currentItem(): CListWidgetItem | null;

Returns the current item.

setCurrentRow(row: number): void;

Sets the current row.

selectionMode(): CSelectionMode;

Provides selection mode behavior.

setSelectionMode(mode: CSelectionMode): void;

Sets the selection mode.

isItemSelected(row: number): boolean;

Returns whether the item selected condition is active.

setItemSelected(row: number, selected: boolean): void;

Sets the item selected.

selectedRows(): number[];

Returns the selected rows.

selectedItems(): CListWidgetItem[];

Returns the selected items.

clearSelection(): void;

Clears selection.

rowAt(y: number, x?: number): number;

Provides row at behavior. Content coordinates; IconMode also requires x to identify a column.

setHoveredRow(row: number): void;

Sets the hovered row.

activateRow(row: number, modifiers: number): void;

Provides activate row behavior.

paintItems(painter: CPainter): void;

Provides paint items behavior.

protected keyPressEvent(event: CKeyEvent): void;

Handles the key press event.