| 4068 | } |
| 4069 | |
| 4070 | void IGFD::FileDialog::m_DisplayPathPopup(ImVec2 vSize) { |
| 4071 | ImVec2 size = ImVec2(vSize.x * 0.5f, vSize.y * 0.5f); |
| 4072 | if (ImGui::BeginPopup("IGFD_Path_Popup")) { |
| 4073 | auto& fdi = m_FileDialogInternal.fileManager; |
| 4074 | |
| 4075 | ImGui::PushID(this); |
| 4076 | |
| 4077 | static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY | ImGuiTableFlags_NoHostExtendY; |
| 4078 | auto listViewID = ImGui::GetID("##FileDialog_pathTable"); |
| 4079 | if (ImGui::BeginTableEx("##FileDialog_pathTable", listViewID, 1, flags, size, 0.0f)) //-V112 |
| 4080 | { |
| 4081 | ImGui::TableSetupScrollFreeze(0, 1); // Make header always visible |
| 4082 | ImGui::TableSetupColumn(tableHeaderFileNameString, ImGuiTableColumnFlags_WidthStretch | (defaultSortOrderFilename ? ImGuiTableColumnFlags_PreferSortAscending : ImGuiTableColumnFlags_PreferSortDescending), -1, 0); |
| 4083 | |
| 4084 | ImGui::TableHeadersRow(); |
| 4085 | |
| 4086 | if (!fdi.IsPathFilteredListEmpty()) { |
| 4087 | std::string _str; |
| 4088 | ImFont* _font = nullptr; |
| 4089 | bool _showColor = false; |
| 4090 | |
| 4091 | m_PathListClipper.Begin((int)fdi.GetPathFilteredListSize(), ImGui::GetTextLineHeightWithSpacing()); |
| 4092 | while (m_PathListClipper.Step()) { |
| 4093 | for (int i = m_PathListClipper.DisplayStart; i < m_PathListClipper.DisplayEnd; i++) { |
| 4094 | if (i < 0) continue; |
| 4095 | |
| 4096 | auto pInfos = fdi.GetFilteredPathAt((size_t)i); |
| 4097 | if (!pInfos.use_count()) continue; |
| 4098 | |
| 4099 | m_BeginFileColorIconStyle(pInfos, _showColor, _str, &_font); |
| 4100 | |
| 4101 | bool selected = fdi.IsFileNameSelected(pInfos->fileNameExt); // found |
| 4102 | |
| 4103 | ImGui::TableNextRow(); |
| 4104 | |
| 4105 | if (ImGui::TableNextColumn()) // file name |
| 4106 | { |
| 4107 | if (ImGui::Selectable(pInfos->fileNameExt.c_str(), &selected, static_cast<int>(ImGuiSelectableFlags_SpanAllColumns) | static_cast<int>(ImGuiSelectableFlags_SpanAvailWidth))) { |
| 4108 | fdi.SetCurrentPath(fdi.ComposeNewPath(fdi.GetCurrentPopupComposedPath())); |
| 4109 | fdi.pathClicked = fdi.SelectDirectory(pInfos); |
| 4110 | ImGui::CloseCurrentPopup(); |
| 4111 | } |
| 4112 | } |
| 4113 | |
| 4114 | m_EndFileColorIconStyle(_showColor, _font); |
| 4115 | } |
| 4116 | } |
| 4117 | m_PathListClipper.End(); |
| 4118 | } |
| 4119 | |
| 4120 | ImGui::EndTable(); |
| 4121 | } |
| 4122 | |
| 4123 | ImGui::PopID(); |
| 4124 | |
| 4125 | ImGui::EndPopup(); |
| 4126 | } |
| 4127 | } |
nothing calls this directly
no test coverage detected