Skip to content

Commit d86a172

Browse files
committed
[ADD] ! add a way for select a file and close dialog by double click on a file. (#56)
1 parent 2a30cbb commit d86a172

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

ImGuiFileDialog.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,8 @@ namespace IGFD
962962
m_CurrentPath_Decomposition.clear();
963963
}
964964

965-
m_IsOk = false; // reset dialog result
965+
m_IsOk = false; // reset dialog result
966+
m_WantToQuit = false; // reset var used for start the dialog quit process from anywhere
966967

967968
ResetEvents();
968969

@@ -1160,6 +1161,11 @@ namespace IGFD
11601161

11611162
m_FooterHeight = ImGui::GetCursorPosY() - posY;
11621163

1164+
if (m_WantToQuit && m_IsOk)
1165+
{
1166+
res = true;
1167+
}
1168+
11631169
return res;
11641170
}
11651171
#ifdef USE_BOOKMARK
@@ -1373,6 +1379,7 @@ namespace IGFD
13731379
}
13741380
}
13751381
#endif // USE_CUSTOM_SORTING_ICON
1382+
13761383
if (!m_FilteredFileList.empty())
13771384
{
13781385
m_FileListClipper.Begin((int)m_FilteredFileList.size(), ImGui::GetTextLineHeightWithSpacing());
@@ -1514,6 +1521,12 @@ namespace IGFD
15141521
else
15151522
{
15161523
SelectFileName(vInfos);
1524+
1525+
if (ImGui::IsMouseDoubleClicked(0))
1526+
{
1527+
m_WantToQuit = true;
1528+
m_IsOk = true;
1529+
}
15171530
}
15181531
}
15191532

ImGuiFileDialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ namespace IGFD
618618
std::string m_HeaderFileDate; // detail view column date + time
619619
bool m_SortingDirection[4] = { true, true, true, true }; // detail view // true => Descending, false => Ascending
620620
SortingFieldEnum m_SortingField = SortingFieldEnum::FIELD_FILENAME; // detail view sorting column
621+
bool m_WantToQuit = false; // set to true for start the quit process of the dialog, specific behavior for select a file by double click for the moment
621622

622623
std::string dlg_key;
623624
std::string dlg_title;

0 commit comments

Comments
 (0)