You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.0KB

  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.
  12. //
  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.
  17. //
  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.
  22. //
  23. // Please report all bugs and problems on the following page:
  24. //
  25. // http://www.fltk.org/str.php
  26. //
  27. #include <FL/Fl.H>
  28. #include <FL/Fl_Value_Input.H> // necessary for bug in mingw32?
  29. #include <FL/Fl_Double_Window.H>
  30. #include <FL/Fl_Box.H>
  31. #include <FL/Fl_Hor_Value_Slider.H>
  32. #include <FL/Fl_Toggle_Button.H>
  33. #include <FL/Fl_Input.H>
  34. #include <FL/fl_draw.H>
  35. #include <FL/Fl_Output.H>
  36. #include <FL/Fl_Multiline_Output.H>
  37. Fl_Output *text;
  38. Fl_Multiline_Output *text2;
  39. Fl_Input *input;
  40. Fl_Value_Slider *fonts;
  41. Fl_Value_Slider *sizes;
  42. Fl_Double_Window *window;
  43. void font_cb(Fl_Widget *,void *) {
  44. text->textfont(int(fonts->value()));
  45. text->redraw();
  46. text2->textfont(int(fonts->value()));
  47. text2->redraw();
  48. }
  49. void size_cb(Fl_Widget *,void *) {
  50. text->textsize(int(sizes->value()));
  51. text->redraw();
  52. text2->textsize(int(sizes->value()));
  53. text2->redraw();
  54. }
  55. void input_cb(Fl_Widget *,void *) {
  56. text->value(input->value());
  57. text2->value(input->value());
  58. }
  59. int main(int argc, char **argv) {
  60. window = new Fl_Double_Window(400,400);
  61. input = new Fl_Input(50,375,350,25);
  62. input->static_value("The quick brown fox\njumped over\nthe lazy dog.");
  63. input->when(FL_WHEN_CHANGED);
  64. input->callback(input_cb);
  65. sizes = new Fl_Hor_Value_Slider(50,350,350,25,"Size");
  66. sizes->align(FL_ALIGN_LEFT);
  67. sizes->bounds(1,64);
  68. sizes->step(1);
  69. sizes->value(14);
  70. sizes->callback(size_cb);
  71. fonts = new Fl_Hor_Value_Slider(50,325,350,25,"Font");
  72. fonts->align(FL_ALIGN_LEFT);
  73. fonts->bounds(0,15);
  74. fonts->step(1);
  75. fonts->value(0);
  76. fonts->callback(font_cb);
  77. text2 = new Fl_Multiline_Output(100,150,200,100,"Fl_Multiline_Output");
  78. text2->value(input->value());
  79. text2->align(FL_ALIGN_BOTTOM);
  80. text2->tooltip("This is an Fl_Multiline_Output widget.");
  81. window->resizable(text2);
  82. text = new Fl_Output(100,90,200,30,"Fl_Output");
  83. text->value(input->value());
  84. text->align(FL_ALIGN_BOTTOM);
  85. text->tooltip("This is an Fl_Output widget.");
  86. window->end();
  87. window->show(argc,argv);
  88. return Fl::run();
  89. }
  90. //
  91. // End of "$Id: output.cxx 7903 2010-11-28 21:06:39Z matt $".
  92. //