mirror of https://github.com/fltk/fltk
FLUID: fixing test/valuator.fl and test/tree.fl
Using Fl_Terminal widget instead of subclassing from Fl_Group
This commit is contained in:
parent
4cf758f9c4
commit
fc03d304e7
|
@ -843,10 +843,10 @@ public:
|
|||
static Fl_Text_Editor_Type Fl_Text_Editor_type;
|
||||
|
||||
|
||||
// ---- Simple Terminal ----
|
||||
// ---- Terminal ----
|
||||
|
||||
/**
|
||||
\brief Manage a simple terminal widget.
|
||||
\brief Manage a terminal widget.
|
||||
*/
|
||||
class Fl_Terminal_Type : public Fl_Group_Type
|
||||
{
|
||||
|
@ -856,19 +856,23 @@ public:
|
|||
// Older .fl files with Fl_Simple_Terminal will create a Fl_Terminal instead.
|
||||
const char *alt_type_name() FL_OVERRIDE { return "Fl_Simple_Terminal"; }
|
||||
Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE {
|
||||
Fl_Widget *myo = 0L;
|
||||
if (batch_mode) {
|
||||
// The Fl_Terminal constructor attaches a buffer which in turn
|
||||
// opens a connection to the display. In batch mode, we create the
|
||||
// superclass Fl_Text_Display to avoid that.
|
||||
myo = new Fl_Text_Display(x,y,w,h);
|
||||
} else {
|
||||
Fl_Terminal *term = new Fl_Terminal(x, y, w, h);
|
||||
term->append("> ls -als");
|
||||
myo = term;
|
||||
Fl_Terminal *term = new Fl_Terminal(x, y, w, h);
|
||||
if (!batch_mode) {
|
||||
//term->append("> ls -als"); // TODO: text color does not show
|
||||
}
|
||||
return myo;
|
||||
return term;
|
||||
}
|
||||
// int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE {
|
||||
// Fl_Terminal *myo = (Fl_Terminal*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
||||
// switch (w) {
|
||||
// case 4:
|
||||
// case 0: f = (Fl_Font)myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
||||
// case 1: myo->textfont(f); myo->append("\033[2J\033[H> ls -als"); break;
|
||||
// case 2: myo->textsize(s); myo->append("\033[2J\033[H> ls -als"); break;
|
||||
// case 3: myo->textcolor(c); myo->append("\033[2J\033[H> ls -als"); break;
|
||||
// }
|
||||
// return 1;
|
||||
// }
|
||||
Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Terminal_Type();}
|
||||
int is_parent() const FL_OVERRIDE { return 0; }
|
||||
ID id() const FL_OVERRIDE { return ID_Terminal; }
|
||||
|
|
11
test/tree.fl
11
test/tree.fl
|
@ -38,9 +38,6 @@ decl {\#include <FL/Fl_Color_Chooser.H>} {public global
|
|||
decl {\#include <FL/Fl_Text_Display.H>} {public global
|
||||
}
|
||||
|
||||
decl {\#include <FL/Fl_Terminal.H>} {public global
|
||||
}
|
||||
|
||||
decl {int G_cb_counter = 0;} {
|
||||
comment {// Global callback event counter} private local
|
||||
}
|
||||
|
@ -780,7 +777,7 @@ Fl::visible_focus(onoff);}
|
|||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label {Test Operations} open selected
|
||||
label {Test Operations} open
|
||||
tooltip {These controls only affect the defaults for new items that are created. These test the Fl_Tree_Prefs methods.} xywh {350 435 330 125} box GTK_DOWN_BOX color 47 labelsize 12
|
||||
} {
|
||||
Fl_Group showitem_box {
|
||||
|
@ -1746,10 +1743,8 @@ helpwin->show();}
|
|||
Fl_Box resizer_box {
|
||||
xywh {0 263 15 14}
|
||||
}
|
||||
Fl_Box tty {
|
||||
label label
|
||||
xywh {16 571 1014 149} box DOWN_BOX color 0
|
||||
class Fl_Terminal
|
||||
Fl_Terminal tty {selected
|
||||
xywh {16 571 1014 149} box DOWN_BOX
|
||||
}
|
||||
}
|
||||
code {// Initialize Tree
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
version 1.0400
|
||||
header_name {.h}
|
||||
code_name {.cxx}
|
||||
decl {\#include <FL/Fl_Terminal.H>} {public global
|
||||
}
|
||||
|
||||
Function {} {open
|
||||
} {
|
||||
Fl_Window {} {
|
||||
|
@ -231,10 +228,9 @@ Function {} {open
|
|||
label {Some widgets have color(FL_GREEN) and color2(FL_RED) to show the areas these effect.}
|
||||
xywh {460 385 110 115} box BORDER_FRAME color 0 selection_color 0 labelsize 11 align 128
|
||||
}
|
||||
Fl_Box tty {selected
|
||||
xywh {10 513 560 117} box DOWN_BOX color 0
|
||||
Fl_Terminal tty {selected
|
||||
xywh {10 513 560 117} box DOWN_BOX
|
||||
code0 {o->ansi(true);}
|
||||
class Fl_Terminal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue