summaryrefslogtreecommitdiff
path: root/test/browser.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1998-10-06 18:21:25 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1998-10-06 18:21:25 +0000
commitf9039b2ae21988783feae9b362818e7923e82d14 (patch)
tree6d6fe3679d73448758f9794e7d4d4f6b22a4adad /test/browser.cxx
parent67e89232f9ba067825a158734a09e0fa21aacbe3 (diff)
Initial revision
git-svn-id: file:///fltk/svn/fltk/trunk@2 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/browser.cxx')
-rw-r--r--test/browser.cxx71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/browser.cxx b/test/browser.cxx
new file mode 100644
index 000000000..3a1510185
--- /dev/null
+++ b/test/browser.cxx
@@ -0,0 +1,71 @@
+/*
+This is a test of how the browser draws lines.
+This is a second line.
+This is a third.
+
+That was a blank line above this.
+
+@r@_Right justify
+@c@_Center justify
+@_Left justify
+
+@bBold text
+@iItalic text
+@b@iBold Italic
+@fFixed width
+@f@bBold Fixed
+@f@iItalic Fixed
+@f@i@bBold Italic Fixed
+@lLarge
+@l@bLarge bold
+@sSmall
+@s@bSmall bold
+@s@iSmall italic
+@s@i@bSmall italic bold
+@uunderscore
+@C1RED
+@C2Green
+@C4Blue
+
+ You should try different browser types:
+ Fl_Browser
+ Fl_Select_Browser
+ Fl_Hold_Browser
+ Fl_Multi_Browser
+*/
+
+#include <FL/Fl.H>
+#include <FL/Fl_Select_Browser.H>
+#include <FL/Fl_Double_Window.H>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+void b_cb(Fl_Widget* o, void*) {
+ printf("callback, selection = %d, event_clicks = %d\n",
+ ((Fl_Browser*)o)->value(), Fl::event_clicks());
+}
+
+int main(int argc, char **argv) {
+ int i;
+ if (!Fl::args(argc,argv,i)) Fl::fatal(Fl::help);
+ const char* fname = (i < argc) ? argv[i] : "browser.C";
+ Fl_Window window(400,400,fname);
+ window.box(FL_NO_BOX); // because it is filled with browser
+ Fl_Select_Browser browser(0,0,400,400,0);
+ browser.type(FL_MULTI_BROWSER);
+ browser.callback(b_cb);
+ // browser.scrollbar_right();
+ //browser.has_scrollbar(Fl_Browser::BOTH_ALWAYS);
+ if (!browser.load(fname)) {
+ printf("Can't load %s, %s\n", fname, strerror(errno));
+ exit(1);
+ }
+ browser.position(0);
+ window.resizable(&browser);
+ window.show(argc,argv);
+ return Fl::run();
+}
+
+