summaryrefslogtreecommitdiff
path: root/src/fl_file_dir.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-03-25 16:11:07 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-03-25 16:11:07 +0000
commita343b0d4e40d6dd295cfea1a6bc66940b7edff34 (patch)
tree8694e94efffe3d725471039f6f99a0b46b7ef086 /src/fl_file_dir.cxx
parentce40d4a0e67b79b48471d6328f46817d2e064544 (diff)
Pressing Enter in the file chooser when selecting a directory
will choose that directory if it is currently shown (STR #746) Added a fl_file_chooser_ok_label() function to set the "OK" button label for the fl_file_chooser() and fl_dir_chooser() functions. Added Fl_File_Chooser::ok_label() methods to set the "OK" button label. The fl_ask() function is now deprecated since it does not conform to the FLTK Human Interface Guidelines. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4188 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_file_dir.cxx')
-rw-r--r--src/fl_file_dir.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/fl_file_dir.cxx b/src/fl_file_dir.cxx
index 432a7f83e..401008e10 100644
--- a/src/fl_file_dir.cxx
+++ b/src/fl_file_dir.cxx
@@ -26,23 +26,34 @@
#include "flstring.h"
#include <FL/filename.H>
#include <FL/Fl_File_Chooser.H>
-#include <FL/Fl_File_Chooser.H>
+#include <FL/fl_ask.H>
+
static Fl_File_Chooser *fc = (Fl_File_Chooser *)0;
static void (*current_callback)(const char*) = 0;
+static const char *current_label = fl_ok;
+// Do a file chooser callback...
static void callback(Fl_File_Chooser *, void*) {
if (current_callback && fc->value())
(*current_callback)(fc->value());
}
+// Set the file chooser callback
void fl_file_chooser_callback(void (*cb)(const char*)) {
current_callback = cb;
}
+// Set the "OK" button label
+void fl_file_chooser_ok_label(const char *l) {
+ if (l) current_label = l;
+ else current_label = fl_ok;
+}
+
+
//
// 'fl_file_chooser()' - Show a file chooser dialog and get a filename.
//
@@ -89,6 +100,7 @@ fl_file_chooser(const char *message, // I - Message in titlebar
fc->value(fname);
}
+ fc->ok_label(current_label);
fc->show();
while (fc->shown())