Demo: use ImGui version of TreeNodeGetOpen/TreeNodeSetOpen + comments.

This commit is contained in:
ocornut
2026-02-18 16:47:30 +01:00
parent 635a5c0a12
commit 0653a0d42a
2 changed files with 17 additions and 20 deletions

View File

@@ -6726,6 +6726,8 @@ bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char
return TreeNodeBehavior(id, flags, label, label_end);
}
// The reason those two functions are not yet in public API is because I would like to design a more feature-full and generic API for this.
// They are otherwise function (cc: #3823, #9251, #7553, #6754, #5423, #2958, #2079, #1947, #1131, #722)
bool ImGui::TreeNodeGetOpen(ImGuiID storage_id)
{
ImGuiContext& g = *GImGui;
@@ -6733,11 +6735,11 @@ bool ImGui::TreeNodeGetOpen(ImGuiID storage_id)
return storage->GetInt(storage_id, 0) != 0;
}
void ImGui::TreeNodeSetOpen(ImGuiID storage_id, bool open)
void ImGui::TreeNodeSetOpen(ImGuiID storage_id, bool is_open)
{
ImGuiContext& g = *GImGui;
ImGuiStorage* storage = g.CurrentWindow->DC.StateStorage;
storage->SetInt(storage_id, open ? 1 : 0);
storage->SetInt(storage_id, is_open ? 1 : 0);
}
bool ImGui::TreeNodeUpdateNextOpen(ImGuiID storage_id, ImGuiTreeNodeFlags flags)