1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-24 07:40:22 +01:00

Reluctantly exposed GetActiveID(), GetHoveredID() in imgui_internal because the demo code will need it.

This commit is contained in:
omar 2017-10-13 16:48:14 +02:00
parent 53780a4fcc
commit c42baf392a
2 changed files with 14 additions and 0 deletions

View File

@ -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;

View File

@ -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);