From 7cff580bcb1fb56635fa73130cf56b007b624617 Mon Sep 17 00:00:00 2001 From: gered Date: Tue, 11 Apr 2023 22:12:55 -0400 Subject: [PATCH] helper trait for imgui helper functions only one for now. i am assuming i will want more in the future. --- ggdt_imgui/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ggdt_imgui/src/lib.rs b/ggdt_imgui/src/lib.rs index b4fb4b6..368d21f 100644 --- a/ggdt_imgui/src/lib.rs +++ b/ggdt_imgui/src/lib.rs @@ -48,3 +48,14 @@ impl SystemEventHandler for ImGui { self.platform.handle_event(&mut self.context, event) } } + +pub trait UiSupport { + fn is_mouse_over_any(&self) -> bool; +} + +impl UiSupport for imgui::Ui { + fn is_mouse_over_any(&self) -> bool { + self.is_window_focused_with_flags(imgui::WindowFocusedFlags::ANY_WINDOW) + || self.is_window_hovered_with_flags(imgui::WindowHoveredFlags::ANY_WINDOW) + } +}