MCPcopy Create free account
hub / github.com/dfranx/ImFileDialog / m_select

Method m_select

ImFileDialog.cpp:574–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572 }
573
574 void FileDialog::m_select(const std::filesystem::path& path, bool isCtrlDown)
575 {
576 bool multiselect = isCtrlDown && m_isMultiselect;
577
578 if (!multiselect) {
579 m_selections.clear();
580 m_selections.push_back(path);
581 } else {
582 auto it = std::find(m_selections.begin(), m_selections.end(), path);
583 if (it != m_selections.end())
584 m_selections.erase(it);
585 else
586 m_selections.push_back(path);
587 }
588
589 if (m_selections.size() == 1) {
590 std::string filename = m_selections[0].filename().u8string();
591 if (filename.size() == 0)
592 filename = m_selections[0].u8string(); // drive
593
594 strcpy(m_inputTextbox, filename.c_str());
595 }
596 else {
597 std::string textboxVal = "";
598 for (const auto& sel : m_selections) {
599 std::string filename = sel.filename().u8string();
600 if (filename.size() == 0)
601 filename = sel.u8string();
602
603 textboxVal += "\"" + filename + "\", ";
604 }
605 strcpy(m_inputTextbox, textboxVal.substr(0, textboxVal.size() - 2).c_str());
606 }
607 }
608
609 bool FileDialog::m_finalize(const std::string& filename)
610 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected