MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / TreeNodeUpdateNextOpen

Method TreeNodeUpdateNextOpen

3rdparty/imgui/src/imgui_widgets.cpp:6798–6843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6796}
6797
6798bool ImGui::TreeNodeUpdateNextOpen(ImGuiID storage_id, ImGuiTreeNodeFlags flags)
6799{
6800 // Leaf node always open a new tree/id scope. If you never use it, add ImGuiTreeNodeFlags_NoTreePushOnOpen.
6801 if (flags & ImGuiTreeNodeFlags_Leaf)
6802 return true;
6803
6804 // We only write to the tree storage if the user clicks, or explicitly use the SetNextItemOpen function
6805 ImGuiContext& g = *GImGui;
6806 ImGuiWindow* window = g.CurrentWindow;
6807 ImGuiStorage* storage = window->DC.StateStorage;
6808
6809 bool is_open;
6810 if (g.NextItemData.HasFlags & ImGuiNextItemDataFlags_HasOpen)
6811 {
6812 if (g.NextItemData.OpenCond & ImGuiCond_Always)
6813 {
6814 is_open = g.NextItemData.OpenVal;
6815 TreeNodeSetOpen(storage_id, is_open);
6816 }
6817 else
6818 {
6819 // We treat ImGuiCond_Once and ImGuiCond_FirstUseEver the same because tree node state are not saved persistently.
6820 const int stored_value = storage->GetInt(storage_id, -1);
6821 if (stored_value == -1)
6822 {
6823 is_open = g.NextItemData.OpenVal;
6824 TreeNodeSetOpen(storage_id, is_open);
6825 }
6826 else
6827 {
6828 is_open = stored_value != 0;
6829 }
6830 }
6831 }
6832 else
6833 {
6834 is_open = storage->GetInt(storage_id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0;
6835 }
6836
6837 // When logging is enabled, we automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior).
6838 // NB- If we are above max depth we still allow manually opened nodes to be logged.
6839 if (g.LogEnabled && !(flags & ImGuiTreeNodeFlags_NoAutoOpenOnLog) && (window->DC.TreeDepth - g.LogDepthRef) < g.LogDepthToExpand)
6840 is_open = true;
6841
6842 return is_open;
6843}
6844
6845// Store ImGuiTreeNodeStackData for just submitted node.
6846// Currently only supports 32 level deep and we are fine with (1 << Depth) overflowing into a zero, easy to increase.

Callers

nothing calls this directly

Calls 1

GetIntMethod · 0.80

Tested by

no test coverage detected