@@ -4105,7 +4105,22 @@ bool IGFD::FileDialog::m_DrawFooter() {
41054105 return res;
41064106}
41074107
4108- void IGFD::FileDialog::m_SelectableItem (int vidx, std::shared_ptr<FileInfos> vInfos, bool vSelected, const char * vFmt, ...) {
4108+ bool IGFD::FileDialog::m_Selectable (int vRowIdx, const char * vLabel, bool vSelected, ImGuiSelectableFlags vFlags, const ImVec2& vSizeArg) {
4109+ bool res = false ;
4110+ #ifdef USE_EXPLORATION_BY_KEYS
4111+ bool flashed = m_BeginFlashItem ((size_t )vRowIdx);
4112+ res = m_FlashableSelectable (vLabel, vSelected, vFlags, flashed, vSizeArg);
4113+ if (flashed) {
4114+ m_EndFlashItem ();
4115+ }
4116+ #else // USE_EXPLORATION_BY_KEYS
4117+ (void )vRowIdx; // remove a warnings for unused var
4118+ res = ImGui::Selectable (vLabel, vSelected, vFlags, vSizeArg);
4119+ #endif // USE_EXPLORATION_BY_KEYS
4120+ return res;
4121+ }
4122+
4123+ void IGFD::FileDialog::m_SelectableItem (int vRowIdx, std::shared_ptr<FileInfos> vInfos, bool vSelected, const char * vFmt, ...) {
41094124 if (!vInfos.use_count ()) return ;
41104125
41114126 auto & fdi = m_FileDialogInternal.fileManager ;
@@ -4123,18 +4138,7 @@ void IGFD::FileDialog::m_SelectableItem(int vidx, std::shared_ptr<FileInfos> vIn
41234138 h = DisplayMode_ThumbailsList_ImageHeight;
41244139 }
41254140#endif // USE_THUMBNAILS
4126- #ifdef USE_EXPLORATION_BY_KEYS
4127- bool flashed = m_BeginFlashItem ((size_t )vidx);
4128- bool res = m_FlashableSelectable (fdi.variadicBuffer , vSelected, selectableFlags, flashed, ImVec2 (-1 .0f , h));
4129- if (flashed) {
4130- m_EndFlashItem ();
4131- }
4132- #else // USE_EXPLORATION_BY_KEYS
4133- (void )vidx; // remove a warnings for unused var
4134-
4135- bool res = ImGui::Selectable (fdi.variadicBuffer , vSelected, selectableFlags, ImVec2 (-1 .0f , h));
4136- #endif // USE_EXPLORATION_BY_KEYS
4137- if (res) {
4141+ if (m_Selectable (vRowIdx, fdi.variadicBuffer , vSelected, selectableFlags, ImVec2 (-1 .0f , h))) {
41384142 if (vInfos->fileType .isDir ()) {
41394143 // nav system, selectable cause open directory or select directory
41404144 if (ImGui::GetIO ().ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) {
@@ -4203,6 +4207,10 @@ void IGFD::FileDialog::m_EndFileColorIconStyle(const bool vShowColor, ImFont* vF
42034207 if (vShowColor) ImGui::PopStyleColor ();
42044208}
42054209
4210+ void IGFD::FileDialog::m_drawColumnText (int /* vColIdx*/ , const char * vLabel, bool /* vSelected*/ , bool /* vHovered*/ ) {
4211+ ImGui::Text (" %s" , vLabel);
4212+ }
4213+
42064214void IGFD::FileDialog::m_DrawFileListView (ImVec2 vSize) {
42074215 auto & fdi = m_FileDialogInternal.fileManager ;
42084216
@@ -4310,6 +4318,7 @@ void IGFD::FileDialog::m_DrawFileListView(ImVec2 vSize) {
43104318 bool _showColor = false ;
43114319
43124320 int column_id = 0 ;
4321+ bool _rowHovered = false ;
43134322 m_FileListClipper.Begin ((int )fdi.GetFilteredListSize (), ImGui::GetTextLineHeightWithSpacing ());
43144323 while (m_FileListClipper.Step ()) {
43154324 for (int i = m_FileListClipper.DisplayStart ; i < m_FileListClipper.DisplayEnd ; i++) {
@@ -4325,30 +4334,31 @@ void IGFD::FileDialog::m_DrawFileListView(ImVec2 vSize) {
43254334 ImGui::TableNextRow ();
43264335
43274336 column_id = 0 ;
4337+ _rowHovered = false ;
43284338 if (ImGui::TableNextColumn ()) { // file name
43294339 if (!infos_ptr->deviceInfos .empty ()) {
43304340 _str += " " + infos_ptr->deviceInfos ;
43314341 }
43324342 m_SelectableItem (i, infos_ptr, selected, _str.c_str ());
4343+ _rowHovered = ImGui::IsItemHovered ();
43334344 m_DisplayFileInfosTooltip (i, column_id++, infos_ptr);
43344345 }
43354346 if (ImGui::TableNextColumn ()) { // file type
4336- ImGui::Text ( " %s " , infos_ptr->fileExtLevels [0 ].c_str ());
4347+ m_drawColumnText (column_id , infos_ptr->fileExtLevels [0 ].c_str (), selected, _rowHovered );
43374348 m_DisplayFileInfosTooltip (i, column_id++, infos_ptr);
43384349 }
43394350 if (ImGui::TableNextColumn ()) { // file size
43404351 if (!infos_ptr->fileType .isDir ()) {
4341- ImGui::Text ( " %s " , infos_ptr->formatedFileSize .c_str ());
4352+ m_drawColumnText (column_id , infos_ptr->formatedFileSize .c_str (), selected, _rowHovered );
43424353 } else {
43434354 ImGui::TextUnformatted (" " );
43444355 }
43454356 m_DisplayFileInfosTooltip (i, column_id++, infos_ptr);
43464357 }
43474358 if (ImGui::TableNextColumn ()) { // file date + time
4348- ImGui::Text ( " %s " , infos_ptr->fileModifDate .c_str ());
4359+ m_drawColumnText (column_id , infos_ptr->fileModifDate .c_str (), selected, _rowHovered );
43494360 m_DisplayFileInfosTooltip (i, column_id++, infos_ptr);
43504361 }
4351-
43524362 m_EndFileColorIconStyle (_showColor, _font);
43534363 }
43544364 }
0 commit comments