Add a waitHandler to Menu

This commit is contained in:
Bertrand Songis
2020-07-07 12:57:32 +02:00
parent 349a02c841
commit 8235a1d97d
+14
View File
@@ -160,6 +160,11 @@ class Menu: public ModalWindow {
content->body.setCancelHandler(handler); content->body.setCancelHandler(handler);
} }
void setWaitHandler(std::function<void()> handler)
{
waitHandler = std::move(handler);
}
void setToolbar(Window * window) void setToolbar(Window * window)
{ {
toolbar = window; toolbar = window;
@@ -190,9 +195,18 @@ class Menu: public ModalWindow {
void onEvent(event_t event) override; void onEvent(event_t event) override;
#endif #endif
void checkEvents() override
{
ModalWindow::checkEvents();
if (waitHandler) {
waitHandler();
}
}
protected: protected:
MenuWindowContent * content; MenuWindowContent * content;
Window * toolbar = nullptr; Window * toolbar = nullptr;
std::function<void()> waitHandler;
void updatePosition(); void updatePosition();
}; };