| 19957 | } |
| 19958 | |
| 19959 | static int StackToolFormatLevelInfo(ImGuiStackTool* tool, int n, bool format_for_ui, char* buf, size_t buf_size) |
| 19960 | { |
| 19961 | ImGuiStackLevelInfo* info = &tool->Results[n]; |
| 19962 | ImGuiWindow* window = (info->Desc[0] == 0 && n == 0) ? ImGui::FindWindowByID(info->ID) : NULL; |
| 19963 | if (window) // Source: window name (because the root ID don't call GetID() and so doesn't get hooked) |
| 19964 | return ImFormatString(buf, buf_size, format_for_ui ? "\"%s\" [window]" : "%s", window->Name); |
| 19965 | if (info->QuerySuccess) // Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id) |
| 19966 | return ImFormatString(buf, buf_size, (format_for_ui && info->DataType == ImGuiDataType_String) ? "\"%s\"" : "%s", info->Desc); |
| 19967 | if (tool->StackLevel < tool->Results.Size) // Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers. |
| 19968 | return (*buf = 0); |
| 19969 | #ifdef IMGUI_ENABLE_TEST_ENGINE |
| 19970 | if (const char* label = ImGuiTestEngine_FindItemDebugLabel(GImGui, info->ID)) // Source: ImGuiTestEngine's ItemInfo() |
| 19971 | return ImFormatString(buf, buf_size, format_for_ui ? "??? \"%s\"" : "%s", label); |
| 19972 | #endif |
| 19973 | return ImFormatString(buf, buf_size, "???"); |
| 19974 | } |
| 19975 | |
| 19976 | // Stack Tool: Display UI |
| 19977 | void ImGui::ShowStackToolWindow(bool* p_open) |
no test coverage detected