feat: FullscreenDialog also support long pressed ENTER (#2506)
Resolves #2500
This commit is contained in:
@@ -51,6 +51,7 @@ FullScreenDialog::FullScreenDialog(
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
bringToTop();
|
bringToTop();
|
||||||
|
lv_obj_add_event_cb(lvobj, FullScreenDialog::long_pressed, LV_EVENT_LONG_PRESSED, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullScreenDialog::paint(BitmapBuffer * dc)
|
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()
|
void FullScreenDialog::onClicked()
|
||||||
{
|
{
|
||||||
if (confirmHandler) confirmHandler();
|
if (confirmHandler) confirmHandler();
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ class FullScreenDialog : public Window
|
|||||||
bool running = false;
|
bool running = false;
|
||||||
std::function<bool(void)> closeCondition;
|
std::function<bool(void)> closeCondition;
|
||||||
std::function<void(void)> confirmHandler;
|
std::function<void(void)> confirmHandler;
|
||||||
|
|
||||||
|
static void long_pressed(lv_event_t* e);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _FULLSCREEN_DIALOG_H_
|
#endif // _FULLSCREEN_DIALOG_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user