Added IsAnyItemHovered() public helper.

This commit is contained in:
ocornut 2015-05-27 22:02:12 +01:00
parent 70f2ff0e5a
commit 8c4c421f74
2 changed files with 8 additions and 3 deletions

View File

@ -2984,10 +2984,14 @@ bool ImGui::IsItemActive()
return false; return false;
} }
bool ImGui::IsAnyItemHovered()
{
return GImGui->HoveredId != 0 || GImGui->HoveredIdPreviousFrame != 0;
}
bool ImGui::IsAnyItemActive() bool ImGui::IsAnyItemActive()
{ {
ImGuiState& g = *GImGui; return GImGui->ActiveId != 0;
return g.ActiveId != 0;
} }
bool ImGui::IsItemVisible() bool ImGui::IsItemVisible()

View File

@ -333,8 +333,9 @@ namespace ImGui
IMGUI_API bool IsItemHovered(); // was the last item hovered by mouse? 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 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 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 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 GetItemRectMin(); // get bounding rect of last item in screen space
IMGUI_API ImVec2 GetItemRectMax(); // " IMGUI_API ImVec2 GetItemRectMax(); // "
IMGUI_API ImVec2 GetItemRectSize(); // " IMGUI_API ImVec2 GetItemRectSize(); // "