MCPcopy Create free account
hub / github.com/dfranx/SHADERed / m_renderFileDialog

Method m_renderFileDialog

libs/misc/ImFileDialog.cpp:1279–1395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1277 }
1278 }
1279 void FileDialog::m_renderFileDialog()
1280 {
1281 /***** TOP BAR *****/
1282 bool noBackHistory = m_backHistory.empty(), noForwardHistory = m_forwardHistory.empty();
1283
1284 ImGui::PushStyleColor(ImGuiCol_Button, 0);
1285 if (noBackHistory) ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
1286 if (ImGui::ArrowButtonEx("##back", ImGuiDir_Left, ImVec2(GUI_ELEMENT_SIZE, GUI_ELEMENT_SIZE), m_backHistory.empty() * ImGuiButtonFlags_Disabled)) {
1287 std::filesystem::path newPath = m_backHistory.top();
1288 m_backHistory.pop();
1289 m_forwardHistory.push(m_currentDirectory);
1290
1291 m_setDirectory(newPath, false);
1292 }
1293 if (noBackHistory) ImGui::PopStyleVar();
1294 ImGui::SameLine();
1295
1296 if (noForwardHistory) ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
1297 if (ImGui::ArrowButtonEx("##forward", ImGuiDir_Right, ImVec2(GUI_ELEMENT_SIZE, GUI_ELEMENT_SIZE), m_forwardHistory.empty() * ImGuiButtonFlags_Disabled)) {
1298 std::filesystem::path newPath = m_forwardHistory.top();
1299 m_forwardHistory.pop();
1300 m_backHistory.push(m_currentDirectory);
1301
1302 m_setDirectory(newPath, false);
1303 }
1304 if (noForwardHistory) ImGui::PopStyleVar();
1305 ImGui::SameLine();
1306
1307 if (ImGui::ArrowButtonEx("##up", ImGuiDir_Up, ImVec2(GUI_ELEMENT_SIZE, GUI_ELEMENT_SIZE))) {
1308 if (m_currentDirectory.has_parent_path())
1309 m_setDirectory(m_currentDirectory.parent_path());
1310 }
1311
1312 std::filesystem::path curDirCopy = m_currentDirectory;
1313 if (PathBox("##pathbox", curDirCopy, m_pathBuffer, ImVec2(-250, GUI_ELEMENT_SIZE)))
1314 m_setDirectory(curDirCopy);
1315 ImGui::SameLine();
1316
1317 if (FavoriteButton("##dirfav", std::count(m_favorites.begin(), m_favorites.end(), m_currentDirectory.u8string()))) {
1318 if (std::count(m_favorites.begin(), m_favorites.end(), m_currentDirectory.u8string()))
1319 RemoveFavorite(m_currentDirectory.u8string());
1320 else
1321 AddFavorite(m_currentDirectory.u8string());
1322 }
1323 ImGui::SameLine();
1324 ImGui::PopStyleColor();
1325
1326 if (ImGui::InputTextEx("##searchTB", "Search", m_searchBuffer, 128, ImVec2(-FLT_MIN, GUI_ELEMENT_SIZE), 0)) // TODO: no hardcoded literals
1327 m_setDirectory(m_currentDirectory, false); // refresh
1328
1329
1330
1331 /***** CONTENT *****/
1332 float bottomBarHeight = (GImGui->FontSize + ImGui::GetStyle().FramePadding.y * 2.0f + ImGui::GetStyle().ItemSpacing.y * 2.0f) * 2;
1333 if (ImGui::BeginTable("##table", 2, ImGuiTableFlags_Resizable, ImVec2(0, -bottomBarHeight))) {
1334 ImGui::TableSetupColumn("##tree", ImGuiTableColumnFlags_WidthFixed, 125.0f);
1335 ImGui::TableSetupColumn("##content", ImGuiTableColumnFlags_WidthStretch);
1336 ImGui::TableNextRow();

Callers

nothing calls this directly

Calls 7

PathBoxFunction · 0.85
FavoriteButtonFunction · 0.85
topMethod · 0.80
countFunction · 0.50
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected