|
@@ -6226,7 +6226,7 @@ bool ImGui::TreeNode(const char* label)
|
|
|
if (window->SkipItems)
|
|
|
return false;
|
|
|
ImGuiID id = window->GetID(label);
|
|
|
- return TreeNodeBehavior(id, id, ImGuiTreeNodeFlags_None, label, NULL);
|
|
|
+ return TreeNodeBehavior(id, ImGuiTreeNodeFlags_None, label, NULL);
|
|
|
}
|
|
|
|
|
|
bool ImGui::TreeNodeV(const char* str_id, const char* fmt, va_list args)
|
|
@@ -6245,7 +6245,7 @@ bool ImGui::TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags)
|
|
|
if (window->SkipItems)
|
|
|
return false;
|
|
|
ImGuiID id = window->GetID(label);
|
|
|
- return TreeNodeBehavior(id, id, flags, label, NULL);
|
|
|
+ return TreeNodeBehavior(id, flags, label, NULL);
|
|
|
}
|
|
|
|
|
|
bool ImGui::TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...)
|
|
@@ -6275,7 +6275,7 @@ bool ImGui::TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char
|
|
|
ImGuiID id = window->GetID(str_id);
|
|
|
const char* label, *label_end;
|
|
|
ImFormatStringToTempBufferV(&label, &label_end, fmt, args);
|
|
|
- return TreeNodeBehavior(id, id, flags, label, label_end);
|
|
|
+ return TreeNodeBehavior(id, flags, label, label_end);
|
|
|
}
|
|
|
|
|
|
bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args)
|
|
@@ -6287,7 +6287,7 @@ bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char
|
|
|
ImGuiID id = window->GetID(ptr_id);
|
|
|
const char* label, *label_end;
|
|
|
ImFormatStringToTempBufferV(&label, &label_end, fmt, args);
|
|
|
- return TreeNodeBehavior(id, id, flags, label, label_end);
|
|
|
+ return TreeNodeBehavior(id, flags, label, label_end);
|
|
|
}
|
|
|
|
|
|
bool ImGui::TreeNodeGetOpen(ImGuiID storage_id)
|
|
@@ -6367,7 +6367,7 @@ static void TreeNodeStoreStackData(ImGuiTreeNodeFlags flags)
|
|
|
}
|
|
|
|
|
|
// When using public API, currently 'id == storage_id' is always true, but we separate the values to facilitate advanced user code doing storage queries outside of UI loop.
|
|
|
-bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiID storage_id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end)
|
|
|
+bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end)
|
|
|
{
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
|
if (window->SkipItems)
|
|
@@ -6410,6 +6410,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiID storage_id, ImGuiTreeNodeFlags
|
|
|
interact_bb.Max.x = frame_bb.Min.x + text_width + (label_size.x > 0.0f ? style.ItemSpacing.x * 2.0f : 0.0f);
|
|
|
|
|
|
// Compute open and multi-select states before ItemAdd() as it clear NextItem data.
|
|
|
+ ImGuiID storage_id = (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasStorageID) ? g.NextItemData.StorageId : id;
|
|
|
bool is_open = TreeNodeUpdateNextOpen(storage_id, flags);
|
|
|
|
|
|
bool is_visible;
|
|
@@ -6694,6 +6695,16 @@ void ImGui::SetNextItemOpen(bool is_open, ImGuiCond cond)
|
|
|
g.NextItemData.OpenCond = (ImU8)(cond ? cond : ImGuiCond_Always);
|
|
|
}
|
|
|
|
|
|
+// Set next TreeNode/CollapsingHeader storage id.
|
|
|
+void ImGui::SetNextItemStorageID(ImGuiID storage_id)
|
|
|
+{
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ if (g.CurrentWindow->SkipItems)
|
|
|
+ return;
|
|
|
+ g.NextItemData.Flags |= ImGuiNextItemDataFlags_HasStorageID;
|
|
|
+ g.NextItemData.StorageId = storage_id;
|
|
|
+}
|
|
|
+
|
|
|
// CollapsingHeader returns true when opened but do not indent nor push into the ID stack (because of the ImGuiTreeNodeFlags_NoTreePushOnOpen flag).
|
|
|
// This is basically the same as calling TreeNodeEx(label, ImGuiTreeNodeFlags_CollapsingHeader). You can remove the _NoTreePushOnOpen flag if you want behavior closer to normal TreeNode().
|
|
|
bool ImGui::CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags)
|
|
@@ -6702,7 +6713,7 @@ bool ImGui::CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags)
|
|
|
if (window->SkipItems)
|
|
|
return false;
|
|
|
ImGuiID id = window->GetID(label);
|
|
|
- return TreeNodeBehavior(id, id, flags | ImGuiTreeNodeFlags_CollapsingHeader, label);
|
|
|
+ return TreeNodeBehavior(id, flags | ImGuiTreeNodeFlags_CollapsingHeader, label);
|
|
|
}
|
|
|
|
|
|
// p_visible == NULL : regular collapsing header
|
|
@@ -6722,7 +6733,7 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_visible, ImGuiTreeNodeFl
|
|
|
flags |= ImGuiTreeNodeFlags_CollapsingHeader;
|
|
|
if (p_visible)
|
|
|
flags |= ImGuiTreeNodeFlags_AllowOverlap | (ImGuiTreeNodeFlags)ImGuiTreeNodeFlags_ClipLabelForTrailingButton;
|
|
|
- bool is_open = TreeNodeBehavior(id, id, flags, label);
|
|
|
+ bool is_open = TreeNodeBehavior(id, flags, label);
|
|
|
if (p_visible != NULL)
|
|
|
{
|
|
|
// Create a small overlapping close button
|