|
RADLib
RADical C++ application framework
|
State model for a conventional menu bar. More...
#include <RADWidgets.h>
Inheritance diagram for RADUi::MenuBarModel:
Collaboration diagram for RADUi::MenuBarModel:Public Member Functions | |
| const std::vector< Menu > & | menus () const |
| Returns all top-level menus. More... | |
| void | setMenus (std::vector< Menu > menus) |
| Replaces the complete menu structure. More... | |
| std::optional< size_t > | activeMenuIndex () const |
| Returns the active/open top-level menu index, if any. More... | |
| void | openMenu (size_t index) |
| Opens a top-level menu by index. More... | |
| void | toggleMenu (size_t index) |
| Opens index or closes it if already active. More... | |
| void | close () |
| Closes the active menu. More... | |
| bool | triggerItem (size_t menuIndex, size_t itemIndex) |
| Triggers an item by menu and item index. More... | |
| bool | setItemChecked (const std::string &id, bool checked) |
| Updates a checkable item by stable id. More... | |
Public Member Functions inherited from RADCore::RADObject | |
| RADObject () | |
| Creates a RADObject bound to the current thread. More... | |
| virtual | ~RADObject () |
| Disconnects tracked event links and releases lifetime token. More... | |
| void | registerLink (const ConnectionRecord &record) |
| Registers a connection for cleanup when this object is destroyed. More... | |
| std::thread::id | threadId () const |
| Returns the thread id this object is currently associated with. More... | |
| EventLoop * | associatedEventLoop () const |
| Returns the associated event loop, if any. More... | |
| ThreadAffinity | threadAffinity () const |
| Returns both thread id and associated loop atomically. More... | |
| std::weak_ptr< void > | lifetimeToken () const |
| Returns a weak token used to drop queued callbacks after destruction. More... | |
| void | moveToThread (std::thread::id tId, EventLoop *loop=nullptr) |
| Moves the object's affinity to tId and optional loop. More... | |
Public Attributes | |
| RADCore::Event< void() > | changed |
| Raised when menu contents or active menu state changes. More... | |
| RADCore::Event< void(std::string) > | itemTriggered |
| Raised with MenuItem::id when an item is triggered. More... | |
State model for a conventional menu bar.
| std::optional<size_t> RADUi::MenuBarModel::activeMenuIndex | ( | ) | const |
Returns the active/open top-level menu index, if any.
| void RADUi::MenuBarModel::close | ( | ) |
Closes the active menu.
| const std::vector<Menu>& RADUi::MenuBarModel::menus | ( | ) | const |
Returns all top-level menus.
| void RADUi::MenuBarModel::openMenu | ( | size_t | index | ) |
Opens a top-level menu by index.
| bool RADUi::MenuBarModel::setItemChecked | ( | const std::string & | id, |
| bool | checked | ||
| ) |
Updates a checkable item by stable id.
| void RADUi::MenuBarModel::setMenus | ( | std::vector< Menu > | menus | ) |
Replaces the complete menu structure.
| void RADUi::MenuBarModel::toggleMenu | ( | size_t | index | ) |
Opens index or closes it if already active.
| bool RADUi::MenuBarModel::triggerItem | ( | size_t | menuIndex, |
| size_t | itemIndex | ||
| ) |
Triggers an item by menu and item index.
| RADCore::Event<void () > RADUi::MenuBarModel::changed |
Raised when menu contents or active menu state changes.
| RADCore::Event<void (std::string) > RADUi::MenuBarModel::itemTriggered |
Raised with MenuItem::id when an item is triggered.