From 40c0db2e8dbc874de590c69a1d7daddb96c5ea87 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 16 Nov 2023 13:58:47 +0100 Subject: [PATCH] dialog: add Sandboxed_runtime::View::if_hovered Issue #5008 --- repos/gems/include/dialog/sandboxed_runtime.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/repos/gems/include/dialog/sandboxed_runtime.h b/repos/gems/include/dialog/sandboxed_runtime.h index ac2f360a1b..4d6138a8a8 100644 --- a/repos/gems/include/dialog/sandboxed_runtime.h +++ b/repos/gems/include/dialog/sandboxed_runtime.h @@ -367,6 +367,15 @@ class Dialog::Sandboxed_runtime::View : private Views::Element ~View(); void refresh() { _dialog_rom_session.trigger_update(); } + + bool if_hovered(auto const &fn) const + { + bool result = false; + if (_dialog_hovered) + _with_dialog_hover([&] (Xml_node const &location) { + result = fn(Hovered_at { Event::Seq_number { }, location }); }); + return result; + } };