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.

91 lines
3.2KB

  1. //
  2. // "$Id: wizard-simple.cxx 8183 2011-01-04 17:31:56Z AlbrechtS $"
  3. //
  4. // Simple Fl_Wizard widget example.
  5. // Originally from erco's cheat sheet 06/05/2010, permission by author.
  6. //
  7. // Copyright 2010 Greg Ercolano.
  8. // Copyright 1998-2010 by Bill Spitzak and others.
  9. //
  10. // This library is free software; you can redistribute it and/or
  11. // modify it under the terms of the GNU Library General Public
  12. // License as published by the Free Software Foundation; either
  13. // version 2 of the License, or (at your option) any later version.
  14. //
  15. // This library is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. // Library General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU Library General Public
  21. // License along with this library; if not, write to the Free Software
  22. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  23. // USA.
  24. //
  25. // Please report all bugs and problems on the following page:
  26. //
  27. // http://www.fltk.org/str.php
  28. //
  29. #include <stdlib.h>
  30. #include <FL/Fl.H>
  31. #include <FL/Fl_Window.H>
  32. #include <FL/Fl_Group.H>
  33. #include <FL/Fl_Wizard.H>
  34. #include <FL/Fl_Button.H>
  35. #include <FL/Fl_Multiline_Output.H>
  36. //
  37. // Simple 'wizard' using fltk's new Fl_Wizard widget
  38. //
  39. Fl_Window *G_win = 0;
  40. Fl_Wizard *G_wiz = 0;
  41. void back_cb(Fl_Widget*,void*) { G_wiz->prev(); }
  42. void next_cb(Fl_Widget*,void*) { G_wiz->next(); }
  43. void done_cb(Fl_Widget*,void*) { exit(0); }
  44. int main(int argc, char **argv) {
  45. G_win = new Fl_Window(400,300,"Example Wizard");
  46. G_wiz = new Fl_Wizard(0,0,400,300);
  47. // Wizard: page 1
  48. {
  49. Fl_Group *g = new Fl_Group(0,0,400,300);
  50. Fl_Button *next = new Fl_Button(290,265,100,25,"Next @->"); next->callback(next_cb);
  51. Fl_Multiline_Output *out = new Fl_Multiline_Output(10,30,400-20,300-80,"Welcome");
  52. out->labelsize(20);
  53. out->align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
  54. out->value("This is First page");
  55. g->end();
  56. }
  57. // Wizard: page 2
  58. {
  59. Fl_Group *g = new Fl_Group(0,0,400,300);
  60. Fl_Button *next = new Fl_Button(290,265,100,25,"Next @->"); next->callback(next_cb);
  61. Fl_Button *back = new Fl_Button(180,265,100,25,"@<- Back"); back->callback(back_cb);
  62. Fl_Multiline_Output *out = new Fl_Multiline_Output(10,30,400-20,300-80,"Terms And Conditions");
  63. out->labelsize(20);
  64. out->align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
  65. out->value("This is the Second page");
  66. g->end();
  67. }
  68. // Wizard: page 3
  69. {
  70. Fl_Group *g = new Fl_Group(0,0,400,300);
  71. Fl_Button *done = new Fl_Button(290,265,100,25,"Finish"); done->callback(done_cb);
  72. Fl_Button *back = new Fl_Button(180,265,100,25,"@<- Back"); back->callback(back_cb);
  73. Fl_Multiline_Output *out = new Fl_Multiline_Output(10,30,400-20,300-80,"Finish");
  74. out->labelsize(20);
  75. out->align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
  76. out->value("This is the Last page");
  77. g->end();
  78. }
  79. G_wiz->end();
  80. G_win->end();
  81. G_win->show(argc, argv);
  82. return Fl::run();
  83. }
  84. //
  85. // End of "$Id: wizard-simple.cxx 8183 2011-01-04 17:31:56Z AlbrechtS $".
  86. //