diff --git a/imgui.cpp b/imgui.cpp index 20610e6ac..e856846ad 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1974,6 +1974,12 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window) } } +ImGuiID ImGui::GetActiveID() +{ + ImGuiContext& g = *GImGui; + return g.ActiveId; +} + // Assume that SetFocusID() is called in the context where its NavLayer is the current window nav layer. void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window) { @@ -2000,6 +2006,12 @@ void ImGui::SetHoveredID(ImGuiID id) g.HoveredIdAllowOverlap = false; } +ImGuiID ImGui::GetHoveredID() +{ + ImGuiContext& g = *GImGui; + return g.HoveredId ? g.HoveredId : g.HoveredIdPreviousFrame; +} + void ImGui::KeepAliveID(ImGuiID id) { ImGuiContext& g = *GImGui; diff --git a/imgui_internal.h b/imgui_internal.h index 2528b2ec9..7f9ee7a1d 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -865,9 +865,11 @@ namespace ImGui IMGUI_API void EndFrame(); // Ends the ImGui frame. Automatically called by Render()! you most likely don't need to ever call that yourself directly. If you don't need to render you can call EndFrame() but you'll have wasted CPU already. If you don't need to render, don't create any windows instead! IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window); + IMGUI_API ImGuiID GetActiveID(); IMGUI_API void SetFocusID(ImGuiID id, ImGuiWindow* window); IMGUI_API void ClearActiveID(); IMGUI_API void SetHoveredID(ImGuiID id); + IMGUI_API ImGuiID GetHoveredID(); IMGUI_API void KeepAliveID(ImGuiID id); IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f);