MCPcopy Create free account
hub / github.com/Wemino/EchoPatch / ShowIDStackToolWindow

Method ShowIDStackToolWindow

include/imgui/imgui.cpp:18154–18218  ·  view source on GitHub ↗

ID Stack Tool: Display UI

Source from the content-addressed store, hash-verified

18152
18153// ID Stack Tool: Display UI
18154void ImGui::ShowIDStackToolWindow(bool* p_open)
18155{
18156 ImGuiContext& g = *GImGui;
18157 if ((g.NextWindowData.HasFlags & ImGuiNextWindowDataFlags_HasSize) == 0)
18158 SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 8.0f), ImGuiCond_FirstUseEver);
18159 if (!Begin("Dear ImGui ID Stack Tool", p_open) || GetCurrentWindow()->BeginCount > 1)
18160 {
18161 End();
18162 return;
18163 }
18164
18165 ImGuiDebugItemPathQuery* query = &g.DebugItemPathQuery;
18166 ImGuiIDStackTool* tool = &g.DebugIDStackTool;
18167 tool->LastActiveFrame = g.FrameCount;
18168 const char* result_path = DebugItemPathQuery_GetResultAsPath(query, tool->OptHexEncodeNonAsciiChars);
18169 Text("0x%08X", query->MainID);
18170 SameLine();
18171 MetricsHelpMarker("Hover an item with the mouse to display elements of the ID Stack leading to the item's final ID.\nEach level of the stack correspond to a PushID() call.\nAll levels of the stack are hashed together to make the final ID of a widget (ID displayed at the bottom level of the stack).\nRead FAQ entry about the ID stack for details.");
18172
18173 // Ctrl+C to copy path
18174 const float time_since_copy = (float)g.Time - tool->CopyToClipboardLastTime;
18175 PushStyleVarY(ImGuiStyleVar_FramePadding, 0.0f);
18176 Checkbox("Hex-encode non-ASCII", &tool->OptHexEncodeNonAsciiChars);
18177 SameLine();
18178 Checkbox("Ctrl+C: copy path", &tool->OptCopyToClipboardOnCtrlC);
18179 PopStyleVar();
18180 SameLine();
18181 TextColored((time_since_copy >= 0.0f && time_since_copy < 0.75f && ImFmod(time_since_copy, 0.25f) < 0.25f * 0.5f) ? ImVec4(1.f, 1.f, 0.3f, 1.f) : ImVec4(), "*COPIED*");
18182 if (tool->OptCopyToClipboardOnCtrlC && Shortcut(ImGuiMod_Ctrl | ImGuiKey_C, ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteOverFocused))
18183 {
18184 tool->CopyToClipboardLastTime = (float)g.Time;
18185 SetClipboardText(result_path);
18186 }
18187
18188 Text("- Path \"%s\"", query->Complete ? result_path : "");
18189#ifdef IMGUI_ENABLE_TEST_ENGINE
18190 Text("- Label \"%s\"", query->MainID ? ImGuiTestEngine_FindItemDebugLabel(&g, query->MainID) : "");
18191#endif
18192 Separator();
18193
18194 // Display decorated stack
18195 if (query->Results.Size > 0 && BeginTable("##table", 3, ImGuiTableFlags_Borders))
18196 {
18197 const float id_width = CalcTextSize("0xDDDDDDDD").x;
18198 TableSetupColumn("Seed", ImGuiTableColumnFlags_WidthFixed, id_width);
18199 TableSetupColumn("PushID", ImGuiTableColumnFlags_WidthStretch);
18200 TableSetupColumn("Result", ImGuiTableColumnFlags_WidthFixed, id_width);
18201 TableHeadersRow();
18202 for (int n = 0; n < query->Results.Size; n++)
18203 {
18204 ImGuiStackLevelInfo* info = &query->Results[n];
18205 TableNextColumn();
18206 Text("0x%08X", (n > 0) ? query->Results[n - 1].ID : 0);
18207 TableNextColumn();
18208 DebugItemPathQuery_FormatLevelInfo(query, n, true, g.TempBuffer.Data, g.TempBuffer.Size);
18209 TextUnformatted(g.TempBuffer.Data);
18210 TableNextColumn();
18211 Text("0x%08X", info->ID);

Callers

nothing calls this directly

Calls 6

ImVec2Function · 0.85
GetCurrentWindowFunction · 0.85
MetricsHelpMarkerFunction · 0.85
ImVec4Class · 0.85

Tested by

no test coverage detected