MCPcopy Create free account
hub / github.com/SatDump/SatDump / TreeNodeUpdateNextOpen

Method TreeNodeUpdateNextOpen

src-core/imgui/imgui_widgets.cpp:6101–6145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6099}
6100
6101bool ImGui::TreeNodeUpdateNextOpen(ImGuiID id, ImGuiTreeNodeFlags flags)
6102{
6103 if (flags & ImGuiTreeNodeFlags_Leaf)
6104 return true;
6105
6106 // We only write to the tree storage if the user clicks (or explicitly use the SetNextItemOpen function)
6107 ImGuiContext& g = *GImGui;
6108 ImGuiWindow* window = g.CurrentWindow;
6109 ImGuiStorage* storage = window->DC.StateStorage;
6110
6111 bool is_open;
6112 if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasOpen)
6113 {
6114 if (g.NextItemData.OpenCond & ImGuiCond_Always)
6115 {
6116 is_open = g.NextItemData.OpenVal;
6117 TreeNodeSetOpen(id, is_open);
6118 }
6119 else
6120 {
6121 // We treat ImGuiCond_Once and ImGuiCond_FirstUseEver the same because tree node state are not saved persistently.
6122 const int stored_value = storage->GetInt(id, -1);
6123 if (stored_value == -1)
6124 {
6125 is_open = g.NextItemData.OpenVal;
6126 TreeNodeSetOpen(id, is_open);
6127 }
6128 else
6129 {
6130 is_open = stored_value != 0;
6131 }
6132 }
6133 }
6134 else
6135 {
6136 is_open = storage->GetInt(id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0;
6137 }
6138
6139 // When logging is enabled, we automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior).
6140 // NB- If we are above max depth we still allow manually opened nodes to be logged.
6141 if (g.LogEnabled && !(flags & ImGuiTreeNodeFlags_NoAutoOpenOnLog) && (window->DC.TreeDepth - g.LogDepthRef) < g.LogDepthToExpand)
6142 is_open = true;
6143
6144 return is_open;
6145}
6146
6147bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end)
6148{

Callers

nothing calls this directly

Calls 1

GetIntMethod · 0.80

Tested by

no test coverage detected