1998-10-20 17:25:25 +04:00
|
|
|
//
|
|
|
|
// Output test program for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2010-11-29 00:06:39 +03:00
|
|
|
// Copyright 1998-2010 by Bill Spitzak and others.
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/COPYING.php
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2005-04-16 04:13:17 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/bugs.php
|
1998-10-20 17:25:25 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
#include <FL/Fl.H>
|
|
|
|
#include <FL/Fl_Value_Input.H> // necessary for bug in mingw32?
|
2009-04-21 13:09:37 +04:00
|
|
|
#include <FL/Fl_Double_Window.H>
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <FL/Fl_Box.H>
|
|
|
|
#include <FL/Fl_Hor_Value_Slider.H>
|
|
|
|
#include <FL/Fl_Toggle_Button.H>
|
|
|
|
#include <FL/Fl_Input.H>
|
|
|
|
#include <FL/fl_draw.H>
|
|
|
|
#include <FL/Fl_Output.H>
|
|
|
|
#include <FL/Fl_Multiline_Output.H>
|
|
|
|
|
|
|
|
Fl_Output *text;
|
|
|
|
Fl_Multiline_Output *text2;
|
|
|
|
Fl_Input *input;
|
|
|
|
Fl_Value_Slider *fonts;
|
|
|
|
Fl_Value_Slider *sizes;
|
2009-04-21 13:09:37 +04:00
|
|
|
Fl_Double_Window *window;
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
void font_cb(Fl_Widget *,void *) {
|
|
|
|
text->textfont(int(fonts->value()));
|
|
|
|
text->redraw();
|
|
|
|
text2->textfont(int(fonts->value()));
|
|
|
|
text2->redraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
void size_cb(Fl_Widget *,void *) {
|
|
|
|
text->textsize(int(sizes->value()));
|
|
|
|
text->redraw();
|
|
|
|
text2->textsize(int(sizes->value()));
|
|
|
|
text2->redraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
void input_cb(Fl_Widget *,void *) {
|
|
|
|
text->value(input->value());
|
|
|
|
text2->value(input->value());
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2009-04-21 13:09:37 +04:00
|
|
|
window = new Fl_Double_Window(400,400);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2008-12-21 18:38:52 +03:00
|
|
|
input = new Fl_Input(50,375,350,25);
|
1998-10-06 22:21:25 +04:00
|
|
|
input->static_value("The quick brown fox\njumped over\nthe lazy dog.");
|
|
|
|
input->when(FL_WHEN_CHANGED);
|
|
|
|
input->callback(input_cb);
|
|
|
|
|
2008-12-21 18:38:52 +03:00
|
|
|
sizes = new Fl_Hor_Value_Slider(50,350,350,25,"Size");
|
1998-10-06 22:21:25 +04:00
|
|
|
sizes->align(FL_ALIGN_LEFT);
|
|
|
|
sizes->bounds(1,64);
|
|
|
|
sizes->step(1);
|
|
|
|
sizes->value(14);
|
|
|
|
sizes->callback(size_cb);
|
|
|
|
|
2008-12-21 18:38:52 +03:00
|
|
|
fonts = new Fl_Hor_Value_Slider(50,325,350,25,"Font");
|
1998-10-06 22:21:25 +04:00
|
|
|
fonts->align(FL_ALIGN_LEFT);
|
|
|
|
fonts->bounds(0,15);
|
|
|
|
fonts->step(1);
|
|
|
|
fonts->value(0);
|
|
|
|
fonts->callback(font_cb);
|
|
|
|
|
|
|
|
text2 = new Fl_Multiline_Output(100,150,200,100,"Fl_Multiline_Output");
|
|
|
|
text2->value(input->value());
|
|
|
|
text2->align(FL_ALIGN_BOTTOM);
|
2002-08-20 20:15:29 +04:00
|
|
|
text2->tooltip("This is an Fl_Multiline_Output widget.");
|
1998-10-06 22:21:25 +04:00
|
|
|
window->resizable(text2);
|
|
|
|
|
2008-12-21 18:38:52 +03:00
|
|
|
text = new Fl_Output(100,90,200,30,"Fl_Output");
|
1998-10-06 22:21:25 +04:00
|
|
|
text->value(input->value());
|
|
|
|
text->align(FL_ALIGN_BOTTOM);
|
2002-08-20 20:15:29 +04:00
|
|
|
text->tooltip("This is an Fl_Output widget.");
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2008-12-21 18:38:52 +03:00
|
|
|
window->end();
|
1998-10-06 22:21:25 +04:00
|
|
|
window->show(argc,argv);
|
|
|
|
return Fl::run();
|
|
|
|
}
|