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

Method DrawDirectoryCreation

ImGuiFileDialog.cpp:2563–2601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2561}
2562
2563void IGFD::FileManager::DrawDirectoryCreation(const FileDialogInternal& vFileDialogInternal) {
2564 if (vFileDialogInternal.getDialogConfig().flags & ImGuiFileDialogFlags_DisableCreateDirectoryButton) return;
2565
2566 if (IMGUI_BUTTON(createDirButtonString)) {
2567 if (!m_CreateDirectoryMode) {
2568 m_CreateDirectoryMode = true;
2569 IGFD::Utils::ResetBuffer(directoryNameBuffer);
2570 }
2571 }
2572 if (ImGui::IsItemHovered()) ImGui::SetTooltip(buttonCreateDirString);
2573
2574 if (m_CreateDirectoryMode) {
2575 ImGui::SameLine();
2576
2577 ImGui::PushItemWidth(100.0f);
2578 ImGui::InputText("##DirectoryFileName", directoryNameBuffer, MAX_FILE_DIALOG_NAME_BUFFER);
2579 ImGui::PopItemWidth();
2580
2581 ImGui::SameLine();
2582
2583 if (IMGUI_BUTTON(okButtonString)) {
2584 std::string newDir = std::string(directoryNameBuffer);
2585 if (CreateDir(newDir)) {
2586 SetCurrentPath(m_CurrentPath + IGFD::Utils::GetPathSeparator() + newDir);
2587 OpenCurrentPath(vFileDialogInternal);
2588 }
2589
2590 m_CreateDirectoryMode = false;
2591 }
2592
2593 ImGui::SameLine();
2594
2595 if (IMGUI_BUTTON(cancelButtonString)) {
2596 m_CreateDirectoryMode = false;
2597 }
2598 }
2599
2600 ImGui::SameLine();
2601}
2602
2603void IGFD::FileManager::DrawPathComposer(const FileDialogInternal& vFileDialogInternal) {
2604 if (IMGUI_BUTTON(resetButtonString)) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected