Skip to content

ui::ContextMenuItem

Header: winui/render/ContextMenuHost.hpp.

One entry of a system context menu shown through ContextMenuHost::show(): a text item or a separator. The menu is flat, with no submenus, icons or check marks.

Example:

const std::vector<ui::ContextMenuItem> items{
    {"receive"},
    {"recipe"},
    ui::ContextMenuItem::separator(),
    {"Add to dictionary"},
    {"Paste", /*enabled=*/false},
};

text

std::string text

UTF-8 label; ignored for a separator.

enabled

bool enabled = true

A disabled item shows grayed and can't be picked.

is_separator

bool is_separator = false

A divider line instead of an item.

separator

static ContextMenuItem separator()

A separator entry (disabled, no text).