MCPcopy Create free account
hub / github.com/aiekick/ImGuiFileDialog / m_DisplayPathPopup

Method m_DisplayPathPopup

ImGuiFileDialog.cpp:4005–4062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4003}
4004
4005void IGFD::FileDialog::m_DisplayPathPopup(ImVec2 vSize) {
4006 ImVec2 size = ImVec2(vSize.x * 0.5f, vSize.y * 0.5f);
4007 if (ImGui::BeginPopup("IGFD_Path_Popup")) {
4008 auto& fdi = m_FileDialogInternal.fileManager;
4009
4010 ImGui::PushID(this);
4011
4012 static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY | ImGuiTableFlags_NoHostExtendY;
4013 auto listViewID = ImGui::GetID("##FileDialog_pathTable");
4014 if (ImGui::BeginTableEx("##FileDialog_pathTable", listViewID, 1, flags, size, 0.0f)) //-V112
4015 {
4016 ImGui::TableSetupScrollFreeze(0, 1); // Make header always visible
4017 ImGui::TableSetupColumn(tableHeaderFileNameString, ImGuiTableColumnFlags_WidthStretch | (defaultSortOrderFilename ? ImGuiTableColumnFlags_PreferSortAscending : ImGuiTableColumnFlags_PreferSortDescending), -1, 0);
4018
4019 ImGui::TableHeadersRow();
4020
4021 if (!fdi.IsPathFilteredListEmpty()) {
4022 std::string _str;
4023 ImFont* _font = nullptr;
4024 bool _showColor = false;
4025
4026 m_PathListClipper.Begin((int)fdi.GetPathFilteredListSize(), ImGui::GetTextLineHeightWithSpacing());
4027 while (m_PathListClipper.Step()) {
4028 for (int i = m_PathListClipper.DisplayStart; i < m_PathListClipper.DisplayEnd; i++) {
4029 if (i < 0) continue;
4030
4031 auto pInfos = fdi.GetFilteredPathAt((size_t)i);
4032 if (!pInfos.use_count()) continue;
4033
4034 m_BeginFileColorIconStyle(pInfos, _showColor, _str, &_font);
4035
4036 bool selected = fdi.IsFileNameSelected(pInfos->fileNameExt); // found
4037
4038 ImGui::TableNextRow();
4039
4040 if (ImGui::TableNextColumn()) // file name
4041 {
4042 if (ImGui::Selectable(pInfos->fileNameExt.c_str(), &selected, static_cast<int>(ImGuiSelectableFlags_SpanAllColumns) | static_cast<int>(ImGuiSelectableFlags_SpanAvailWidth))) {
4043 fdi.SetCurrentPath(fdi.ComposeNewPath(fdi.GetCurrentPopupComposedPath()));
4044 fdi.pathClicked = fdi.SelectDirectory(pInfos);
4045 ImGui::CloseCurrentPopup();
4046 }
4047 }
4048
4049 m_EndFileColorIconStyle(_showColor, _font);
4050 }
4051 }
4052 m_PathListClipper.End();
4053 }
4054
4055 ImGui::EndTable();
4056 }
4057
4058 ImGui::PopID();
4059
4060 ImGui::EndPopup();
4061 }
4062}

Callers

nothing calls this directly

Calls 8

GetFilteredPathAtMethod · 0.80
IsFileNameSelectedMethod · 0.80
SetCurrentPathMethod · 0.80
ComposeNewPathMethod · 0.80
SelectDirectoryMethod · 0.80

Tested by

no test coverage detected