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.

93 lines
3.2KB

  1. //
  2. // "$Id: tabs-simple.cxx 8183 2011-01-04 17:31:56Z AlbrechtS $"
  3. //
  4. // Simple Fl_Tabs 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 <FL/Fl.H>
  30. #include <FL/Fl_Window.H>
  31. #include <FL/Fl_Tabs.H>
  32. #include <FL/Fl_Group.H>
  33. #include <FL/Fl_Button.H>
  34. //
  35. // Simple tabs example
  36. // _____ _____
  37. // __/ Aaa \/ Bbb \______________________
  38. // | _______ |
  39. // | |_______| |
  40. // | _______ |
  41. // | |_______| |
  42. // | _______ |
  43. // | |_______| |
  44. // |______________________________________|
  45. //
  46. int main(int argc, char *argv[]) {
  47. Fl::scheme("gtk+");
  48. Fl_Window *win = new Fl_Window(500,200,"Tabs Example");
  49. {
  50. // Create the tab widget
  51. Fl_Tabs *tabs = new Fl_Tabs(10,10,500-20,200-20);
  52. {
  53. // ADD THE "Aaa" TAB
  54. // We do this by adding a child group to the tab widget.
  55. // The child group's label defined the label of the tab.
  56. //
  57. Fl_Group *aaa = new Fl_Group(10,35,500-20,200-45,"Aaa");
  58. {
  59. // Put some different buttons into the group, which will be shown
  60. // when the tab is selected.
  61. Fl_Button *b1 = new Fl_Button(50, 60,90,25,"Button A1"); b1->color(88+1);
  62. Fl_Button *b2 = new Fl_Button(50, 90,90,25,"Button A2"); b2->color(88+2);
  63. Fl_Button *b3 = new Fl_Button(50,120,90,25,"Button A3"); b3->color(88+3);
  64. }
  65. aaa->end();
  66. // ADD THE "Bbb" TAB
  67. // Same details as above.
  68. //
  69. Fl_Group *bbb = new Fl_Group(10,35,500-10,200-35,"Bbb");
  70. {
  71. // Put some different buttons into the group, which will be shown
  72. // when the tab is selected.
  73. Fl_Button *b1 = new Fl_Button( 50,60,90,25,"Button B1"); b1->color(88+1);
  74. Fl_Button *b2 = new Fl_Button(150,60,90,25,"Button B2"); b2->color(88+3);
  75. Fl_Button *b3 = new Fl_Button(250,60,90,25,"Button B3"); b3->color(88+5);
  76. Fl_Button *b4 = new Fl_Button( 50,90,90,25,"Button B4"); b4->color(88+2);
  77. Fl_Button *b5 = new Fl_Button(150,90,90,25,"Button B5"); b5->color(88+4);
  78. Fl_Button *b6 = new Fl_Button(250,90,90,25,"Button B6"); b6->color(88+6);
  79. }
  80. bbb->end();
  81. }
  82. tabs->end();
  83. }
  84. win->end();
  85. win->show(argc, argv);
  86. return(Fl::run());
  87. }
  88. //
  89. // End of "$Id: tabs-simple.cxx 8183 2011-01-04 17:31:56Z AlbrechtS $".
  90. //