commit f1f2d3313236af8a6b403ad1635d645b43754519 parent d42a1913408c4ee7bef6b85963f686ea16b61c87 Author: Adam <[email protected]> Date: Tue, 19 Nov 2019 08:28:03 -0600 Update ComputerscareLaundrySoup.cpp Add submenu placeholder for channel selection Diffstat:
M | src/ComputerscareLaundrySoup.cpp | | | 39 | +++++++++++++++++++++++++++++++++++++++ |
1 file changed, 39 insertions(+), 0 deletions(-)
diff --git a/src/ComputerscareLaundrySoup.cpp b/src/ComputerscareLaundrySoup.cpp @@ -329,6 +329,35 @@ struct LaundrySmallDisplay : SmallLetterDisplay }; +struct LaundryChannelItem : MenuItem { + ComputerscareLaundrySoup *module; + int channels; + void onAction(const event::Action &e) override { + //module->channels = channels; + } +}; + + +struct LaundryChannelsItem : MenuItem { + ComputerscareLaundrySoup *module; + Menu *createChildMenu() override { + Menu *menu = new Menu; + for (int channels = -1; channels <= 16; channels++) { + MergeChannelItem *item = new MergeChannelItem; + if (channels < 0) + item->text = "Automatic"; + else + item->text = string::f("%d", channels); + item->rightText = CHECKMARK(false/*module->channels == channels*/); + item->module = module; + item->channels = channels; + menu->addChild(item); + } + return menu; + } +}; + + struct ComputerscareLaundrySoupWidget : ModuleWidget { double verticalSpacing = 18.4; @@ -433,7 +462,17 @@ struct ComputerscareLaundrySoupWidget : ModuleWidget { } } } + void appendContextMenu(Menu *menu) override { + ComputerscareLaundrySoup *module = dynamic_cast<ComputerscareLaundrySoup*>(this->laundry); + + menu->addChild(new MenuEntry); + LaundryChannelsItem *channelsItem = new LaundryChannelsItem; + channelsItem->text = "Channels"; + channelsItem->rightText = RIGHT_ARROW; + channelsItem->module = module; + menu->addChild(channelsItem); + } ComputerscareLaundrySoup *laundry; LaundryTF2 *textFieldTemp;