diff options
author | crupest <crupest@outlook.com> | 2021-12-14 16:59:30 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-12-14 16:59:30 +0800 |
commit | 72abeb9c86d768a5c6a9a2d28dab037b145b7390 (patch) | |
tree | f40f2c90c7e466537945519354842382e84d0595 /src | |
parent | 13f76127fe0e3371b8748ceb38485b6237f69aeb (diff) | |
download | cru-72abeb9c86d768a5c6a9a2d28dab037b145b7390.tar.gz cru-72abeb9c86d768a5c6a9a2d28dab037b145b7390.tar.bz2 cru-72abeb9c86d768a5c6a9a2d28dab037b145b7390.zip |
...
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/components/Menu.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ui/components/Menu.cpp b/src/ui/components/Menu.cpp index 60364f13..681b44b7 100644 --- a/src/ui/components/Menu.cpp +++ b/src/ui/components/Menu.cpp @@ -79,7 +79,10 @@ void Menu::ClearItems() { void Menu::AddTextItem(String text, gsl::index index, std::function<void()> on_click) { MenuItem* item = new MenuItem(std::move(text)); - item->SetOnClick(std::move(on_click)); + item->SetOnClick([this, index, on_click = std::move(on_click)] { + on_click(); + if (on_item_click_) on_item_click_(index); + }); AddItem(item, index); } @@ -89,6 +92,8 @@ PopupMenu::PopupMenu(controls::Control* attached_control) menu_ = new Menu(); + menu_->SetOnItemClick([this](Index _) { this->Close(); }); + popup_->AddChild(menu_->GetRootControl(), 0); } |