| 17761 | } |
| 17762 | |
| 17763 | static int StackToolFormatLevelInfo(ImGuiIDStackTool* tool, int n, bool format_for_ui, char* buf, size_t buf_size) |
| 17764 | { |
| 17765 | ImGuiStackLevelInfo* info = &tool->Results[n]; |
| 17766 | ImGuiWindow* window = (info->DescOffset == -1 && n == 0) ? ImGui::FindWindowByID(info->ID) : NULL; |
| 17767 | if (window) // Source: window name (because the root ID don't call GetID() and so doesn't get hooked) |
| 17768 | return ImFormatString(buf, buf_size, format_for_ui ? "\"%s\" [window]" : "%s", ImHashSkipUncontributingPrefix(window->Name)); |
| 17769 | if (info->QuerySuccess) // Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id) |
| 17770 | return ImFormatString(buf, buf_size, (format_for_ui && info->DataType == ImGuiDataType_String) ? "\"%s\"" : "%s", ImHashSkipUncontributingPrefix(&tool->ResultPathsBuf.Buf[info->DescOffset])); |
| 17771 | if (tool->StackLevel < tool->Results.Size) // Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers. |
| 17772 | return (*buf = 0); |
| 17773 | #ifdef IMGUI_ENABLE_TEST_ENGINE |
| 17774 | if (const char* label = ImGuiTestEngine_FindItemDebugLabel(GImGui, info->ID)) // Source: ImGuiTestEngine's ItemInfo() |
| 17775 | return ImFormatString(buf, buf_size, format_for_ui ? "??? \"%s\"" : "%s", ImHashSkipUncontributingPrefix(label)); |
| 17776 | #endif |
| 17777 | return ImFormatString(buf, buf_size, "???"); |
| 17778 | } |
| 17779 | |
| 17780 | // ID Stack Tool: Display UI |
| 17781 | void ImGui::ShowIDStackToolWindow(bool* p_open) |
no test coverage detected