Canvas Toolkit
← Class index

CMenu

Widgets · extends CPopupWidget

Implements the menu widget.

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

Declared members

static readonly ItemHeight = 28;
static readonly SeparatorHeight = 9;
static readonly HorizontalPadding = 12;
static readonly CheckColumnWidth = 20;
static readonly ShortcutSpacing = 24;
readonly closed: CSignal<[]>;

Public closed member.

constructor();

Creates a new instance.

addAction(action: CAction): CAction;

Adds action.

addMenu(text: string, menu: CMenu): CMenu;

Adds menu.

addSeparator(): void;

Adds separator.

clear(): void;

Clears the current contents.

destroy(): void;
setFont(font: CFont, propagate?: boolean): void;
count(): number;

Provides count behavior.

actionAt(index: number): CAction | null;

Provides action at behavior.

menuAt(index: number): CMenu | null;

Provides menu at behavior.

setMenuBar(menuBar: CMenuBar | null): void;

Sets the menu bar.

open(): void;

Provides open behavior.

close(): void;

Provides close behavior.

currentIndex(): number;

Returns the current index.

selectFirstItem(): void;

Provides select first item behavior.

focusOpenSubMenu(): boolean;

Provides focus open sub menu behavior.

exec(pos: CPoint): void;

Provides exec behavior.

protected mouseMoveEvent(event: CMouseEvent): void;

Handles the mouse move event.

protected mouseLeaveEvent(event: CMouseEvent): void;

Handles the mouse leave event.

protected mousePressEvent(event: CMouseEvent): void;

Handles the mouse press event.

protected keyPressEvent(event: CKeyEvent): void;

Handles the key press event.

protected paintEvent(painter: CPainter): void;

Handles the paint event.