morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::MenuItem Struct Reference

One entry of a Menu: its label and its handler in one place, so there are no parallel lists. More...

#include <view.hpp>

Public Attributes

Prop< std::string > label
 The caption.
Action onSelect
 Called when the entry is chosen.
std::string icon
 The name of an icon in the theme's icon map; empty shows none. Set once.
std::string keys
 The chord shown beside the label, such as "Ctrl+S"; empty shows none. Set once. It only shows the chord: the binding that handles it is a KeyBinding on a node.
Prop< std::optional< bool > > checked
 Engaged: the entry is checkable and shows this check mark; nullopt: not checkable. Choosing a checkable entry runs onSelect, and the mark changes only when this binding does.
Prop< bool > enabled = true
 Whether the entry can be chosen; a disabled entry's submenu cannot be opened.
std::vector< MenuItem > items
 The submenu's entries; empty: the entry is chosen rather than opened.

Detailed Description

One entry of a Menu: its label and its handler in one place, so there are no parallel lists.

An entry with items opens a submenu and is not itself chosen.

Definition at line 526 of file view.hpp.

Member Data Documentation

◆ label

Prop<std::string> morph::ui::MenuItem::label

The caption.

Definition at line 528 of file view.hpp.

◆ onSelect

Action morph::ui::MenuItem::onSelect

Called when the entry is chosen.

Definition at line 530 of file view.hpp.

◆ icon

std::string morph::ui::MenuItem::icon

The name of an icon in the theme's icon map; empty shows none. Set once.

Definition at line 532 of file view.hpp.

◆ keys

std::string morph::ui::MenuItem::keys

The chord shown beside the label, such as "Ctrl+S"; empty shows none. Set once. It only shows the chord: the binding that handles it is a KeyBinding on a node.

Definition at line 535 of file view.hpp.

◆ checked

Prop<std::optional<bool> > morph::ui::MenuItem::checked

Engaged: the entry is checkable and shows this check mark; nullopt: not checkable. Choosing a checkable entry runs onSelect, and the mark changes only when this binding does.

Definition at line 538 of file view.hpp.

◆ enabled

Prop<bool> morph::ui::MenuItem::enabled = true

Whether the entry can be chosen; a disabled entry's submenu cannot be opened.

Definition at line 540 of file view.hpp.

◆ items

std::vector<MenuItem> morph::ui::MenuItem::items

The submenu's entries; empty: the entry is chosen rather than opened.

Definition at line 542 of file view.hpp.


The documentation for this struct was generated from the following file: