1 //
2 // "$Id$"
3 //
4 // Iconize 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. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18
19 #include <FL/Fl.H>
20 #include <FL/Fl_Window.H>
21 #include <FL/Fl_Button.H>
22 #include <FL/Fl_Box.H>
23 #include <stdlib.h>
24
iconize_cb(Fl_Widget *,void * v)25 void iconize_cb(Fl_Widget *, void *v) {
26 Fl_Window *w = (Fl_Window *)v;
27 w->iconize();
28 }
29
show_cb(Fl_Widget *,void * v)30 void show_cb(Fl_Widget *, void *v) {
31 Fl_Window *w = (Fl_Window *)v;
32 w->show();
33 }
34
hide_cb(Fl_Widget *,void * v)35 void hide_cb(Fl_Widget *, void *v) {
36 Fl_Window *w = (Fl_Window *)v;
37 w->hide();
38 }
39
window_cb(Fl_Widget *,void *)40 void window_cb(Fl_Widget*, void*) {
41 exit(0);
42 }
43
main(int argc,char ** argv)44 int main(int argc, char **argv) {
45
46 Fl_Window mainw(200,200);
47 mainw.end();
48 mainw.show(argc,argv);
49
50 Fl_Window control(120,120);
51
52 Fl_Button hide_button(0,0,120,30,"hide()");
53 hide_button.callback(hide_cb, &mainw);
54
55 Fl_Button iconize_button(0,30,120,30,"iconize()");
56 iconize_button.callback(iconize_cb, &mainw);
57
58 Fl_Button show_button(0,60,120,30,"show()");
59 show_button.callback(show_cb, &mainw);
60
61 Fl_Button show_button2(0,90,120,30,"show this");
62 show_button2.callback(show_cb, &control);
63
64 // Fl_Box box(FL_NO_BOX,0,60,120,30,"Also try running\nwith -i switch");
65
66 control.end();
67 control.show();
68 control.callback(window_cb);
69 return Fl::run();
70 }
71
72 //
73 // End of "$Id$".
74 //
75