mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Internals: Added FindWindowByID() helper. (#2190)
This commit is contained in:
parent
aa668c410a
commit
6b4443755d
@ -4220,13 +4220,18 @@ static void SetWindowConditionAllowFlags(ImGuiWindow* window, ImGuiCond flags, b
|
|||||||
window->SetWindowCollapsedAllowFlags = enabled ? (window->SetWindowCollapsedAllowFlags | flags) : (window->SetWindowCollapsedAllowFlags & ~flags);
|
window->SetWindowCollapsedAllowFlags = enabled ? (window->SetWindowCollapsedAllowFlags | flags) : (window->SetWindowCollapsedAllowFlags & ~flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiWindow* ImGui::FindWindowByName(const char* name)
|
ImGuiWindow* ImGui::FindWindowByID(ImGuiID id)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiID id = ImHash(name, 0);
|
|
||||||
return (ImGuiWindow*)g.WindowsById.GetVoidPtr(id);
|
return (ImGuiWindow*)g.WindowsById.GetVoidPtr(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGuiWindow* ImGui::FindWindowByName(const char* name)
|
||||||
|
{
|
||||||
|
ImGuiID id = ImHash(name, 0);
|
||||||
|
return FindWindowByID(id);
|
||||||
|
}
|
||||||
|
|
||||||
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags)
|
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
@ -1123,6 +1123,7 @@ namespace ImGui
|
|||||||
// - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
|
// - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
|
||||||
inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }
|
inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }
|
||||||
inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }
|
inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }
|
||||||
|
IMGUI_API ImGuiWindow* FindWindowByID(ImGuiID id);
|
||||||
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
|
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
|
||||||
IMGUI_API void FocusWindow(ImGuiWindow* window);
|
IMGUI_API void FocusWindow(ImGuiWindow* window);
|
||||||
IMGUI_API void FocusPreviousWindowIgnoringOne(ImGuiWindow* ignore_window);
|
IMGUI_API void FocusPreviousWindowIgnoringOne(ImGuiWindow* ignore_window);
|
||||||
|
Loading…
Reference in New Issue
Block a user