2 // "$Id: resizebox.cxx 7903 2010-11-28 21:06:39Z matt $"
4 // Resize box test program for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2010 by Bill Spitzak and others.
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
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
28 #define W1 (big ? 60 : 40)
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
;
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");
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
);
59 box
->label("re\nsiz\nab\nle");
60 else box
->label("resizable");
62 window
->resizable(box
);
66 int main(int argc
, char **argv
) {
67 window
= new Fl_Double_Window(W3
,W3
);
68 window
->box(FL_NO_BOX
);
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);
75 n
= new Fl_Box(FL_FRAME_BOX
,B
,4*W1
+5*B
,4*W1
+3*B
,W1
,0);
77 n
= new Fl_Box(FL_FRAME_BOX
,4*W1
+5*B
,B
,W1
,5*W1
+4*B
,0);
79 n
= new Fl_Box(FL_FRAME_BOX
,W1
+B
+B
,W1
+B
+B
,2*W1
+B
,2*W1
+B
,0);
82 Fl_Button
*b
= new Fl_Radio_Button(W1
+B
+50,W1
+B
+30,20,20,"@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");
95 window
->size_range(W3
,W3
);
96 window
->show(argc
,argv
);
101 // End of "$Id: resizebox.cxx 7903 2010-11-28 21:06:39Z matt $".