MCPcopy Create free account
hub / github.com/VCVRack/Rack / createSubmenuItem

Function createSubmenuItem

include/helpers.hpp:337–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335*/
336template <class TMenuItem = ui::MenuItem>
337TMenuItem* createSubmenuItem(std::string text, std::string rightText, std::function<void(ui::Menu* menu)> createMenu, bool disabled = false) {
338 struct Item : TMenuItem {
339 std::function<void(ui::Menu* menu)> createMenu;
340
341 ui::Menu* createChildMenu() override {
342 ui::Menu* menu = new ui::Menu;
343 createMenu(menu);
344 return menu;
345 }
346 };
347
348 Item* item = createMenuItem<Item>(text, rightText + (rightText.empty() ? "" : " ") + RIGHT_ARROW);
349 item->createMenu = createMenu;
350 item->disabled = disabled;
351 return item;
352}
353
354
355/** Creates a MenuItem that when hovered, opens a submenu with several MenuItems indexed by an integer.

Callers 7

appendContextMenuMethod · 0.85
appendPresetItemsFunction · 0.85
createContextMenuMethod · 0.85
onActionMethod · 0.85
onActionMethod · 0.85
onActionMethod · 0.85
onActionMethod · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected