From 8c4c421f74bc38a8cccf26412f802bb1a7d6c29a Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 27 May 2015 22:02:12 +0100 Subject: [PATCH] Added IsAnyItemHovered() public helper. --- imgui.cpp | 8 ++++++-- imgui.h | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 83026cfb5..9bbc60cfb 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2984,10 +2984,14 @@ bool ImGui::IsItemActive() return false; } +bool ImGui::IsAnyItemHovered() +{ + return GImGui->HoveredId != 0 || GImGui->HoveredIdPreviousFrame != 0; +} + bool ImGui::IsAnyItemActive() { - ImGuiState& g = *GImGui; - return g.ActiveId != 0; + return GImGui->ActiveId != 0; } bool ImGui::IsItemVisible() diff --git a/imgui.h b/imgui.h index 0522b0c73..9e280841c 100644 --- a/imgui.h +++ b/imgui.h @@ -333,8 +333,9 @@ namespace ImGui IMGUI_API bool IsItemHovered(); // was the last item hovered by mouse? IMGUI_API bool IsItemHoveredRect(); // was the last item hovered by mouse? even if another item is active while we are hovering this IMGUI_API bool IsItemActive(); // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false) - IMGUI_API bool IsAnyItemActive(); // IMGUI_API bool IsItemVisible(); + IMGUI_API bool IsAnyItemHovered(); // + IMGUI_API bool IsAnyItemActive(); // IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item in screen space IMGUI_API ImVec2 GetItemRectMax(); // " IMGUI_API ImVec2 GetItemRectSize(); // "