mirror of
https://github.com/fltk/fltk.git
synced 2025-12-11 13:53:06 +08:00
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
This commit is contained in:
@@ -58,6 +58,7 @@ That was a blank line above this.
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Int_Input.H>
|
||||
#include <FL/Fl_Choice.H>
|
||||
#include <FL/Fl_Simple_Terminal.H>
|
||||
#include <FL/fl_ask.H>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -74,6 +75,7 @@ Fl_Button *top,
|
||||
Fl_Choice *btype;
|
||||
Fl_Choice *wtype;
|
||||
Fl_Int_Input *field;
|
||||
Fl_Simple_Terminal *tty = 0;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
@@ -95,7 +97,7 @@ WhenItem when_items[] = {
|
||||
};
|
||||
|
||||
void b_cb(Fl_Widget* o, void*) {
|
||||
printf("callback, selection = %d, event_clicks = %d\n",
|
||||
tty->printf("callback, selection = \033[31m%d\033[0m, event_clicks = \033[32m%d\033[0m\n",
|
||||
((Fl_Browser*)o)->value(), Fl::event_clicks());
|
||||
}
|
||||
|
||||
@@ -154,7 +156,7 @@ 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.cxx";
|
||||
Fl_Double_Window window(720,400,fname);
|
||||
Fl_Double_Window window(720,520,fname);
|
||||
browser = new Fl_Select_Browser(0,0,window.w(),350,0);
|
||||
browser->type(FL_MULTI_BROWSER);
|
||||
//browser->type(FL_HOLD_BROWSER);
|
||||
@@ -232,6 +234,11 @@ int main(int argc, char **argv) {
|
||||
wtype->callback(wtype_cb);
|
||||
wtype->value(4); // FL_WHEN_RELEASE_ALWAYS is Fl_Browser's default
|
||||
|
||||
// Small terminal window for callback messages
|
||||
tty = new Fl_Simple_Terminal(0,400,720,120);
|
||||
tty->history_lines(50);
|
||||
tty->ansi(true);
|
||||
|
||||
window.resizable(browser);
|
||||
window.show(argc,argv);
|
||||
return Fl::run();
|
||||
|
||||
Reference in New Issue
Block a user