dialog: handle EXIT key

This commit is contained in:
Raphael Coeffic
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent f8612a0dbe
commit e97cff4dcb
2 changed files with 11 additions and 0 deletions
+10
View File
@@ -57,3 +57,13 @@ Dialog::Dialog(Window* parent, std::string title, const rect_t& rect) :
bringToTop();
if (!title.empty()) content->setTitle(std::move(title));
}
void Dialog::onEvent(event_t event)
{
#if defined(HARDWARE_KEYS)
if (event == EVT_KEY_LONG(KEY_EXIT) || event == EVT_KEY_BREAK(KEY_EXIT)) {
killEvents(event);
deleteLater();
}
#endif
}
+1
View File
@@ -48,5 +48,6 @@ class Dialog : public ModalWindow
Dialog(Window* parent, std::string title, const rect_t& rect);
protected:
void onEvent(event_t event) override;
DialogWindowContent* content;
};