aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/components
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-12-14 16:59:30 +0800
committercrupest <crupest@outlook.com>2021-12-14 16:59:30 +0800
commit72abeb9c86d768a5c6a9a2d28dab037b145b7390 (patch)
treef40f2c90c7e466537945519354842382e84d0595 /include/cru/ui/components
parent13f76127fe0e3371b8748ceb38485b6237f69aeb (diff)
downloadcru-72abeb9c86d768a5c6a9a2d28dab037b145b7390.tar.gz
cru-72abeb9c86d768a5c6a9a2d28dab037b145b7390.tar.bz2
cru-72abeb9c86d768a5c6a9a2d28dab037b145b7390.zip
...
Diffstat (limited to 'include/cru/ui/components')
-rw-r--r--include/cru/ui/components/Menu.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/cru/ui/components/Menu.hpp b/include/cru/ui/components/Menu.hpp
index a72c0313..b0075574 100644
--- a/include/cru/ui/components/Menu.hpp
+++ b/include/cru/ui/components/Menu.hpp
@@ -60,12 +60,17 @@ class Menu : public Component {
void AddTextItem(String text, std::function<void()> on_click) {
AddTextItem(std::move(text), GetItemCount(), std::move(on_click));
}
- void AddTextItem(String text, gsl::index index,
- std::function<void()> on_click);
+ void AddTextItem(String text, Index index, std::function<void()> on_click);
+
+ void SetOnItemClick(std::function<void(Index)> on_item_click) {
+ on_item_click_ = std::move(on_item_click);
+ }
private:
controls::FlexLayout* container_;
std::vector<Component*> items_;
+
+ std::function<void(Index)> on_item_click_;
};
class PopupMenu : public Component {