diff options
| author | Manolo Gouy <Manolo> | 2011-01-16 18:26:51 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2011-01-16 18:26:51 +0000 |
| commit | e2ddb1715c659dac6b8e751c2b5a772e229ebf57 (patch) | |
| tree | f1e164ebef308e8b6f4bc81102c5c733a15a218d /src/Fl_File_Chooser.cxx | |
| parent | 774880acc5baa5ad24857a184f225a351c637e23 (diff) | |
Fl_File_Chooser: added a "Show hidden files" button. Hidden files aren't shown
by default now. This removes a TODO clause.
Fl_Native_File_Chooser: removed the hack that added the "Show hidden files" button, and
made the "file already exists" warning message localizable.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8282 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_File_Chooser.cxx')
| -rw-r--r-- | src/Fl_File_Chooser.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Fl_File_Chooser.cxx b/src/Fl_File_Chooser.cxx index b71a778a3..d3a43e1cf 100644 --- a/src/Fl_File_Chooser.cxx +++ b/src/Fl_File_Chooser.cxx @@ -88,6 +88,26 @@ void Fl_File_Chooser::cb_previewButton(Fl_Check_Button* o, void* v) { ((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_previewButton_i(o,v); } +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); +} + +void Fl_File_Chooser::show_hidden_cb(Fl_Check_Button* o, void* data) { + Fl_File_Chooser *mychooser = (Fl_File_Chooser *)data; + if (o->value()) { + mychooser->browser()->load(mychooser->directory()); + } else { + mychooser->remove_hidden_files(); + mychooser->browser()->redraw(); + } +} + void Fl_File_Chooser::cb_fileName_i(Fl_File_Input*, void*) { fileNameCB(); } @@ -208,6 +228,15 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char previewButton->callback((Fl_Callback*)cb_previewButton); previewButton->label(preview_label); } // Fl_Check_Button* previewButton + + { show_hidden = new Fl_Check_Button( + previewButton->x() + previewButton->w() + 30, 275, 140, 20, "Show hidden files"); + show_hidden->down_box(FL_DOWN_BOX); + show_hidden->value(0); + show_hidden->callback((Fl_Callback*)show_hidden_cb, this); + show_hidden->label(hidden_label); + } // Fl_Check_Button* show_hidden + { Fl_Box* o = new Fl_Box(115, 275, 365, 20); Fl_Group::current()->resizable(o); } // Fl_Box* o |
