Fix cairo region leak in restore_clip().
[ntk.git] / examples / tabs-simple.cxx
blob63d97167314c3cf5b2887ceb8b78f3de4e3d77a8
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.
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.
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.
25 // Please report all bugs and problems on the following page:
27 // http://www.fltk.org/str.php
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>
35 // Simple tabs example
36 // _____ _____
37 // __/ Aaa \/ Bbb \______________________
38 // | _______ |
39 // | |_______| |
40 // | _______ |
41 // | |_______| |
42 // | _______ |
43 // | |_______| |
44 // |______________________________________|
46 int main(int argc, char *argv[]) {
47 Fl::scheme("gtk+");
48 Fl_Window *win = new Fl_Window(500,200,"Tabs Example");
50 // Create the tab widget
51 Fl_Tabs *tabs = new Fl_Tabs(10,10,500-20,200-20);
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.
57 Fl_Group *aaa = new Fl_Group(10,35,500-20,200-45,"Aaa");
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);
65 aaa->end();
67 // ADD THE "Bbb" TAB
68 // Same details as above.
70 Fl_Group *bbb = new Fl_Group(10,35,500-10,200-35,"Bbb");
72 // Put some different buttons into the group, which will be shown
73 // when the tab is selected.
74 Fl_Button *b1 = new Fl_Button( 50,60,90,25,"Button B1"); b1->color(88+1);
75 Fl_Button *b2 = new Fl_Button(150,60,90,25,"Button B2"); b2->color(88+3);
76 Fl_Button *b3 = new Fl_Button(250,60,90,25,"Button B3"); b3->color(88+5);
77 Fl_Button *b4 = new Fl_Button( 50,90,90,25,"Button B4"); b4->color(88+2);
78 Fl_Button *b5 = new Fl_Button(150,90,90,25,"Button B5"); b5->color(88+4);
79 Fl_Button *b6 = new Fl_Button(250,90,90,25,"Button B6"); b6->color(88+6);
81 bbb->end();
83 tabs->end();
85 win->end();
86 win->show(argc, argv);
87 return(Fl::run());
91 // End of "$Id: tabs-simple.cxx 8183 2011-01-04 17:31:56Z AlbrechtS $".