Canvas Toolkit
← Class index

CListView

Widgets · extends CAbstractItemView

Implements the list view widget.

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

Declared members

static readonly ItemHeight = 24;
readonly activated: CSignal<[CModelIndex]>;

Emitted by Enter or double click in IconMode. F2 remains the editing trigger.

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;
setIconProvider(provider: ((index: CModelIndex) => CIcon | null) | null): void;

Supplies icons without imposing a new data-role API on the model.

indexAt(point: CPoint): CModelIndex;

Returns the index at a content-widget coordinate; gaps return an invalid index.

visualRect(index: CModelIndex): CRect;

Returns the item rectangle in content-widget coordinates.

viewport(): CWidget;

Returns the viewport widget.

widget(): CWidget;

Returns the list content widget.

horizontalScrollBar(): CScrollBar;

Returns the horizontal scroll bar.

verticalScrollBar(): CScrollBar;

Returns the vertical scroll bar.

scrollX(): number;

Returns the horizontal scroll position.

scrollY(): number;

Returns the vertical scroll position.

setScrollX(x: number): void;

Sets the horizontal scroll position.

setScrollY(y: number): void;

Sets the vertical scroll position.

scrollTo(x: number, y: number): void;

Scrolls to the supplied content position.

sizeHint(): CSize;

Returns the preferred size of the widget.

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

Sets the geometry.

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

Resizes the view.

paintItems(painter: CPainter): void;

Paints the list items.

contentMousePressEvent(event: CMouseEvent): void;

Handles a mouse press in the list content.

contentMouseDoubleClickEvent(event: CMouseEvent): void;

Starts editing the item under a double click.

contentKeyPressEvent(event: CKeyEvent): void;

Handles keyboard navigation and editing in the list content.

protected editorParent(): CWidget;

Returns the widget used as editor parent.

protected modelChanged(_oldModel: CAbstractItemModel | null, _newModel: CAbstractItemModel | null): void;

Updates list state after the model changes.

protected modelDataChanged(): void;

Repaints list items after model data changes.

protected modelReset(): void;

Updates list geometry after a model reset.

protected modelRowsInserted(): void;

Updates list geometry after rows are inserted or removed.

protected modelRowsRemoved(): void;
protected currentIndexChanged(index: CModelIndex): void;

Scrolls to and repaints a newly selected current index.

protected editorClosed(): void;

Restores focus to the list content after editing.