ntk-chtheme: Add new color scheme. Save/restore selection color.
[ntk.git] / test / output.cxx
blob4b869b4cbbe479074ed149c3584edb6f013a66b4
1 //
2 // "$Id: output.cxx 7903 2010-11-28 21:06:39Z matt $"
3 //
4 // Output test program for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
28 #include <FL/Fl.H>
29 #include <FL/Fl_Value_Input.H> // necessary for bug in mingw32?
30 #include <FL/Fl_Double_Window.H>
31 #include <FL/Fl_Box.H>
32 #include <FL/Fl_Hor_Value_Slider.H>
33 #include <FL/Fl_Toggle_Button.H>
34 #include <FL/Fl_Input.H>
35 #include <FL/fl_draw.H>
36 #include <FL/Fl_Output.H>
37 #include <FL/Fl_Multiline_Output.H>
39 Fl_Output *text;
40 Fl_Multiline_Output *text2;
41 Fl_Input *input;
42 Fl_Value_Slider *fonts;
43 Fl_Value_Slider *sizes;
44 Fl_Double_Window *window;
46 void font_cb(Fl_Widget *,void *) {
47 text->textfont(int(fonts->value()));
48 text->redraw();
49 text2->textfont(int(fonts->value()));
50 text2->redraw();
53 void size_cb(Fl_Widget *,void *) {
54 text->textsize(int(sizes->value()));
55 text->redraw();
56 text2->textsize(int(sizes->value()));
57 text2->redraw();
60 void input_cb(Fl_Widget *,void *) {
61 text->value(input->value());
62 text2->value(input->value());
65 int main(int argc, char **argv) {
66 window = new Fl_Double_Window(400,400);
68 input = new Fl_Input(50,375,350,25);
69 input->static_value("The quick brown fox\njumped over\nthe lazy dog.");
70 input->when(FL_WHEN_CHANGED);
71 input->callback(input_cb);
73 sizes = new Fl_Hor_Value_Slider(50,350,350,25,"Size");
74 sizes->align(FL_ALIGN_LEFT);
75 sizes->bounds(1,64);
76 sizes->step(1);
77 sizes->value(14);
78 sizes->callback(size_cb);
80 fonts = new Fl_Hor_Value_Slider(50,325,350,25,"Font");
81 fonts->align(FL_ALIGN_LEFT);
82 fonts->bounds(0,15);
83 fonts->step(1);
84 fonts->value(0);
85 fonts->callback(font_cb);
87 text2 = new Fl_Multiline_Output(100,150,200,100,"Fl_Multiline_Output");
88 text2->value(input->value());
89 text2->align(FL_ALIGN_BOTTOM);
90 text2->tooltip("This is an Fl_Multiline_Output widget.");
91 window->resizable(text2);
93 text = new Fl_Output(100,90,200,30,"Fl_Output");
94 text->value(input->value());
95 text->align(FL_ALIGN_BOTTOM);
96 text->tooltip("This is an Fl_Output widget.");
98 window->end();
99 window->show(argc,argv);
100 return Fl::run();
104 // End of "$Id: output.cxx 7903 2010-11-28 21:06:39Z matt $".