Internals, CollapsingHeader, TabItem: Standardized using a #CLOSE id prefix for TabItem and ColllapsingHeader (same as window)

This commit is contained in:
ocornut
2020-09-22 15:49:47 +02:00
parent 27d0c3afa9
commit 29836412e1
3 changed files with 18 additions and 2 deletions

View File

@ -6742,6 +6742,20 @@ void ImGui::PushOverrideID(ImGuiID id)
window->IDStack.push_back(id);
}
// Helper to avoid a common series of PushOverrideID -> GetID() -> PopID() call
// (note that when using this pattern, TestEngine's "Stack Tool" will tend to not display the intermediate stack level.
// for that to work we would need to do PushOverrideID() -> ItemAdd() -> PopID() which would alter widget code a little more)
ImGuiID ImGui::GetIDWithSeed(const char* str, const char* str_end, ImGuiID seed)
{
ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
ImGui::KeepAliveID(id);
#ifdef IMGUI_ENABLE_TEST_ENGINE
ImGuiContext& g = *GImGui;
IMGUI_TEST_ENGINE_ID_INFO2(id, ImGuiDataType_String, str, str_end);
#endif
return id;
}
void ImGui::PopID()
{
ImGuiWindow* window = GImGui->CurrentWindow;