summaryrefslogtreecommitdiff
path: root/test/file_chooser.cxx
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2017-10-17 00:28:56 +0000
committerGreg Ercolano <erco@seriss.com>2017-10-17 00:28:56 +0000
commit68f07db58aab37dac7f9eb9445f5632b1b09741a (patch)
tree581d421cc70a971035ed4bd76ecadce4843341b0 /test/file_chooser.cxx
parent93ef00cca6655c7a07aca11c53788d957097ef8f (diff)
Added Fl_Simple_Terminal widget, and mods to test+example programs (STR #3411).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12506 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/file_chooser.cxx')
-rw-r--r--test/file_chooser.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/file_chooser.cxx b/test/file_chooser.cxx
index 12f43f0c1..1a6b0da36 100644
--- a/test/file_chooser.cxx
+++ b/test/file_chooser.cxx
@@ -41,8 +41,12 @@
#include <FL/Fl_PNM_Image.H>
#include <FL/Fl_Light_Button.H>
#include <FL/Fl_Double_Window.H>
+#include <FL/Fl_Simple_Terminal.H>
#include <string.h>
+#define TERMINAL_HEIGHT 120
+#define TERMINAL_GREEN "\033[32m"
+#define TERMINAL_NORMAL "\033[0m"
//
// Globals...
@@ -52,6 +56,7 @@ Fl_Input *filter;
Fl_File_Browser *files;
Fl_File_Chooser *fc;
Fl_Shared_Image *image = 0;
+Fl_Simple_Terminal *tty = 0;
// for choosing extra groups
Fl_Choice *ch_extra;
@@ -101,7 +106,10 @@ main(int argc, // I - Number of command-line arguments
Fl_Shared_Image::add_handler(ps_check);
// Make the main window...
- window = new Fl_Double_Window(400, 215, "File Chooser Test");
+ window = new Fl_Double_Window(400, 215+TERMINAL_HEIGHT, "File Chooser Test");
+
+ tty = new Fl_Simple_Terminal(0,215,window->w(),TERMINAL_HEIGHT);
+ tty->ansi(true);
filter = new Fl_Input(50, 10, 315, 25, "Filter:");
// Process standard arguments and find filter argument if present
@@ -221,11 +229,11 @@ fc_callback(Fl_File_Chooser *fc, // I - File chooser
const char *filename; // Current filename
- printf("fc_callback(fc = %p, data = %p)\n", fc, data);
+ tty->printf("fc_callback(fc = %p, data = %p)\n", fc, data);
filename = fc->value();
- printf(" filename = \"%s\"\n", filename ? filename : "(null)");
+ tty->printf(" filename = \"%s\"\n", filename ? filename : "(null)");
}
@@ -365,6 +373,8 @@ show_callback(void)
if (!fc->value(i))
break;
+ tty->printf("%d/%d) %sPicked: '%s'%s\n", i, count, TERMINAL_GREEN, fc->value(i), TERMINAL_NORMAL);
+
fl_filename_relative(relative, sizeof(relative), fc->value(i));
files->add(relative,