feat: FullscreenDialog also support long pressed ENTER (#2506)

Resolves #2500
This commit is contained in:
Raphael Coeffic
2022-10-11 10:29:43 +10:00
committed by GitHub
parent bae5102762
commit bece340186
2 changed files with 14 additions and 0 deletions
@@ -51,6 +51,7 @@ FullScreenDialog::FullScreenDialog(
// #endif
bringToTop();
lv_obj_add_event_cb(lvobj, FullScreenDialog::long_pressed, LV_EVENT_LONG_PRESSED, nullptr);
}
void FullScreenDialog::paint(BitmapBuffer * dc)
@@ -110,6 +111,17 @@ void FullScreenDialog::paint(BitmapBuffer * dc)
}
}
void FullScreenDialog::long_pressed(lv_event_t* e)
{
auto obj = lv_event_get_target(e);
auto fs = (FullScreenDialog*)lv_obj_get_user_data(obj);
if (fs) {
fs->onClicked();
lv_indev_wait_release(lv_indev_get_act());
}
}
void FullScreenDialog::onClicked()
{
if (confirmHandler) confirmHandler();
@@ -77,6 +77,8 @@ class FullScreenDialog : public Window
bool running = false;
std::function<bool(void)> closeCondition;
std::function<void(void)> confirmHandler;
static void long_pressed(lv_event_t* e);
};
#endif // _FULLSCREEN_DIALOG_H_