| 18207 | } |
| 18208 | |
| 18209 | static int DebugItemPathQuery_FormatLevelInfo(ImGuiDebugItemPathQuery* query, int n, bool format_for_ui, char* buf, size_t buf_size) |
| 18210 | { |
| 18211 | ImGuiStackLevelInfo* info = &query->Results[n]; |
| 18212 | ImGuiWindow* window = (info->DescOffset == -1 && n == 0) ? ImGui::FindWindowByID(info->ID) : NULL; |
| 18213 | if (window) // Source: window name (because the root ID don't call GetID() and so doesn't get hooked) |
| 18214 | return ImFormatString(buf, buf_size, format_for_ui ? "\"%s\" [window]" : "%s", ImHashSkipUncontributingPrefix(window->Name)); |
| 18215 | if (info->QuerySuccess) // Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id) |
| 18216 | return ImFormatString(buf, buf_size, (format_for_ui && info->DataType == ImGuiDataType_String) ? "\"%s\"" : "%s", ImHashSkipUncontributingPrefix(&query->ResultsDescBuf.Buf[info->DescOffset])); |
| 18217 | if (query->Step < query->Results.Size) // Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers. |
| 18218 | return (*buf = 0); |
| 18219 | #ifdef IMGUI_ENABLE_TEST_ENGINE |
| 18220 | if (const char* label = ImGuiTestEngine_FindItemDebugLabel(GImGui, info->ID)) // Source: ImGuiTestEngine's ItemInfo() |
| 18221 | return ImFormatString(buf, buf_size, format_for_ui ? "??? \"%s\"" : "%s", ImHashSkipUncontributingPrefix(label)); |
| 18222 | #endif |
| 18223 | return ImFormatString(buf, buf_size, "???"); |
| 18224 | } |
| 18225 | |
| 18226 | static const char* DebugItemPathQuery_GetResultAsPath(ImGuiDebugItemPathQuery* query, bool hex_encode_non_ascii_chars) |
| 18227 | { |
no test coverage detected