diff options
| author | Manolo Gouy <Manolo> | 2011-06-06 16:11:22 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2011-06-06 16:11:22 +0000 |
| commit | 7feb5a9dfeeae416cb86e7019ffda697c94c8f90 (patch) | |
| tree | 5a8bcdb60c1ca0e55c9f660cd2e7955463a13082 /src/Fl_File_Chooser2.cxx | |
| parent | 922352799211caa32187bdd92af26a0527d3b304 (diff) | |
Added "Show hidden files" check button to the file chooser panel.
This had been previously done in r.8282 and r.8286 without accounting for
the existence of the Fl_File_Chooser.fl file. With this commit, files
Fl_File_Chooser.{cxx, H} are properly generated by Fl_File_Chooser.fl
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8785 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_File_Chooser2.cxx')
| -rw-r--r-- | src/Fl_File_Chooser2.cxx | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 7b9105e00..37a788145 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -347,6 +347,7 @@ #include <FL/fl_ask.H> #include <FL/x.H> #include <FL/Fl_Shared_Image.H> +#include <FL/fl_draw.H> #include <stdio.h> #include <stdlib.h> @@ -1151,7 +1152,7 @@ Fl_File_Chooser::rescan() // Build the file list... fileList->load(directory_, sort); #ifndef WIN32 - if (!show_hidden->value()) remove_hidden_files(); + if (!showHiddenButton->value()) remove_hidden_files(); #endif // Update the preview box... update_preview(); @@ -1178,7 +1179,7 @@ void Fl_File_Chooser::rescan_keep_filename() // Build the file list... fileList->load(directory_, sort); #ifndef WIN32 - if (!show_hidden->value()) remove_hidden_files(); + if (!showHiddenButton->value()) remove_hidden_files(); #endif // Update the preview box... update_preview(); @@ -1576,8 +1577,42 @@ Fl_File_Chooser::value(const char *filename) break; } } + +void Fl_File_Chooser::show() +{ + window->hotspot(fileList); + window->show(); + Fl::flush(); + fl_cursor(FL_CURSOR_WAIT); + rescan_keep_filename(); + fl_cursor(FL_CURSOR_DEFAULT); + fileName->take_focus(); +#ifdef WIN32 + showHiddenButton->hide(); +#endif +} +void Fl_File_Chooser::showHidden(int value) +{ + if (value) { + fileList->load(directory()); + } else { + remove_hidden_files(); + fileList->redraw(); + } +} + +void Fl_File_Chooser::remove_hidden_files() +{ + int count = fileList->size(); + for(int num = count; num >= 1; num--) { + const char *p = fileList->text(num); + if (*p == '.' && strcmp(p, "../") != 0) fileList->remove(num); + } + fileList->topline(1); +} + // // 'compare_dirnames()' - Compare two directory names. // |
