summaryrefslogtreecommitdiff
path: root/src/fl_file_dir.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-05-01 12:41:21 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-05-01 12:41:21 +0000
commit94a9fb879f3bb31785ddca44c6bbaba5283da136 (patch)
tree6be38779406339f510975a43d8bb967ac3a4960d /src/fl_file_dir.cxx
parent3a33fc7d818cb336bad2cc81a1dc821f6b75f5d0 (diff)
Fix backspace "bug" in file chooser - now treat delete and backspace the
same, eliminating any filename completion value. Added relative argument to fl_file_chooser() and fl_dir_chooser(); both default to 0 (return absolute paths) Give focus to the filename field in the chooser when show() is called. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2157 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_file_dir.cxx')
-rw-r--r--src/fl_file_dir.cxx38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/fl_file_dir.cxx b/src/fl_file_dir.cxx
index c1d0f6d4f..089d1d3ce 100644
--- a/src/fl_file_dir.cxx
+++ b/src/fl_file_dir.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_file_dir.cxx,v 1.1.2.9 2002/04/28 08:42:33 easysw Exp $"
+// "$Id: fl_file_dir.cxx,v 1.1.2.10 2002/05/01 12:41:21 easysw Exp $"
//
// File chooser widget for the Fast Light Tool Kit (FLTK).
//
@@ -43,9 +43,16 @@ void fl_file_chooser_callback(void (*cb)(const char*)) {
}
-char* fl_file_chooser(const char* message, const char* pat, const char* fname)
-{
- static char retname[1024];
+//
+// 'fl_file_chooser()' - Show a file chooser dialog and get a filename.
+//
+
+char * // O - Filename or NULL
+fl_file_chooser(const char *message, // I - Message in titlebar
+ const char *pat, // I - Filename pattern
+ const char *fname, // I - Initial filename selection
+ int relative) { // I - 0 for absolute path
+ static char retname[1024]; // Returned filename
if (!fc) {
if (!fname || !*fname) fname = ".";
@@ -88,17 +95,25 @@ char* fl_file_chooser(const char* message, const char* pat, const char* fname)
while (fc->shown())
Fl::wait();
- if (fc->value()) {
+ if (fc->value() && relative) {
fl_filename_relative(retname, sizeof(retname), fc->value());
return retname;
- } else return 0;
+ } else if (fc->value()) return fc->value();
+ else return 0;
}
-char* fl_dir_chooser(const char* message, const char* fname)
+//
+// 'fl_dir_chooser()' - Show a file chooser dialog and get a directory.
+//
+
+char * // O - Directory or NULL
+fl_dir_chooser(const char *message, // I - Message for titlebar
+ const char *fname, // I - Initial directory name
+ int relative) // I - 0 for absolute
{
- static char retname[1024];
+ static char retname[1024]; // Returned directory name
if (!fname || !*fname) fname = ".";
@@ -118,14 +133,15 @@ char* fl_dir_chooser(const char* message, const char* fname)
while (fc->shown())
Fl::wait();
- if (fc->value()) {
+ if (fc->value() && relative) {
fl_filename_relative(retname, sizeof(retname), fc->value());
return retname;
- } else return 0;
+ } else if (fc->value) return fc->value();
+ else return 0;
}
//
-// End of "$Id: fl_file_dir.cxx,v 1.1.2.9 2002/04/28 08:42:33 easysw Exp $".
+// End of "$Id: fl_file_dir.cxx,v 1.1.2.10 2002/05/01 12:41:21 easysw Exp $".
//