Clean up some inconsistencies in themes.
[ntk.git] / test / resizebox.cxx
blob8b4417cca0e9419f85c8b8c81a68d27649e80ac9
1 //
2 // "$Id: resizebox.cxx 7903 2010-11-28 21:06:39Z matt $"
3 //
4 // Resize box 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 #define W1 (big ? 60 : 40)
29 #define B 0
30 #define W3 (5*W1+6*B)
32 #include <FL/Fl.H>
33 #include <FL/Fl_Double_Window.H>
34 #include <FL/Fl_Box.H>
35 #include <FL/Fl_Radio_Button.H>
36 #include <FL/fl_draw.H>
37 #include <FL/fl_message.H>
39 Fl_Double_Window *window;
40 Fl_Box *box;
42 int big = 0;
44 void b_cb(Fl_Widget *,long w) {
45 if (window->w() != W3 || window->h() != W3) {
46 fl_message("Put window back to minimum size before changing");
47 return;
49 window->init_sizes();
50 switch (w) {
51 case 0: box->hide(); window->box(FL_FLAT_BOX); window->resizable(0); return;
52 case 8: box->resize(W1+B,W1,2*W1,B); break;
53 case 2: box->resize(W1+B,W1+B+2*W1,2*W1,B); break;
54 case 4: box->resize(W1+B,W1,B,2*W1); break;
55 case 6: box->resize(W1+B+2*W1,W1+B,B,2*W1); break;
57 window->box(FL_NO_BOX);
58 if (w == 6 || w == 4)
59 box->label("re\nsiz\nab\nle");
60 else box->label("resizable");
61 box->show();
62 window->resizable(box);
63 window->redraw();
66 int main(int argc, char **argv) {
67 window = new Fl_Double_Window(W3,W3);
68 window->box(FL_NO_BOX);
69 Fl_Box *n;
70 for (int x = 0; x<4; x++) for (int y = 0; y<4; y++) {
71 if ((x==1 || x==2) && (y==1 || y==2)) continue;
72 n = new Fl_Box(FL_FRAME_BOX,x*(B+W1)+B,y*(B+W1)+B,W1,W1,0);
73 n->color(x+y+8);
75 n = new Fl_Box(FL_FRAME_BOX,B,4*W1+5*B,4*W1+3*B,W1,0);
76 n->color(12);
77 n = new Fl_Box(FL_FRAME_BOX,4*W1+5*B,B,W1,5*W1+4*B,0);
78 n->color(13);
79 n = new Fl_Box(FL_FRAME_BOX,W1+B+B,W1+B+B,2*W1+B,2*W1+B,0);
80 n->color(8);
82 Fl_Button *b = new Fl_Radio_Button(W1+B+50,W1+B+30,20,20,"@6>");
83 b->callback(b_cb,6);
84 (new Fl_Radio_Button(W1+B+30,W1+B+10,20,20,"@8>"))->callback(b_cb,8);
85 (new Fl_Radio_Button(W1+B+10,W1+B+30,20,20,"@4>"))->callback(b_cb,4);
86 (new Fl_Radio_Button(W1+B+30,W1+B+50,20,20,"@2>"))->callback(b_cb,2);
87 (new Fl_Radio_Button(W1+B+30,W1+B+30,20,20,"off"))->callback(b_cb,0);
89 box = new Fl_Box(FL_FLAT_BOX,0,0,0,0,"resizable");
90 box->color(FL_DARK2);
91 b->set();
92 b->do_callback();
93 window->end();
95 window->size_range(W3,W3);
96 window->show(argc,argv);
97 return Fl::run();
101 // End of "$Id: resizebox.cxx 7903 2010-11-28 21:06:39Z matt $".