1 /*
2  *  This file is part of XForms.
3  *
4  *  XForms is free software; you can redistribute it and/or modify it
5  *  under the terms of the GNU Lesser General Public License as
6  *  published by the Free Software Foundation; either version 2.1, or
7  *  (at your option) any later version.
8  *
9  *  XForms is distributed in the hope that it will be useful, but
10  *  WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  *  Lesser General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Lesser General Public
15  *  License along with XForms; see the file COPYING.  If not, write to
16  *  the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
17  *  MA 02111-1307, USA.
18  */
19 
20 
21 /* This demo shows the use of a slider as radio object */
22 
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26 
27 #include "include/forms.h"
28 
29 
30 /***************************************
31  ***************************************/
32 
33 int
main(int argc,char * argv[])34 main( int    argc,
35       char * argv[ ] )
36 {
37     FL_FORM *form;
38     FL_OBJECT *sl,
39               *but1,
40               *but2,
41               *but3,
42               *but,
43               *obj;
44 
45     fl_initialize( &argc, argv, "FormDemo", 0, 0 );
46 
47     form = fl_bgn_form( FL_UP_BOX, 300, 300 );
48     sl = fl_add_slider( FL_VERT_SLIDER, 40, 40, 60, 220, "X" );
49     sl->radio = 1;
50     but1 = fl_add_lightbutton( FL_RADIO_BUTTON, 140, 220, 120, 40, "0.0" );
51     but2 = fl_add_lightbutton( FL_RADIO_BUTTON, 140, 160, 120, 40, "0.5" );
52     but3 = fl_add_lightbutton( FL_RADIO_BUTTON, 140, 100, 120, 40, "1.0" );
53     but = fl_add_button( FL_NORMAL_BUTTON, 140, 40, 120, 40, "Exit" );
54     fl_end_form( );
55 
56     fl_show_form( form, FL_PLACE_CENTER, FL_NOBORDER, "slRadio" );
57 
58     do
59     {
60         obj = fl_do_forms( );
61         if ( obj == but1 )
62             fl_set_slider_value( sl, 0.0 );
63         if ( obj == but2 )
64             fl_set_slider_value( sl, 0.5 );
65         if ( obj == but3 )
66             fl_set_slider_value( sl, 1.0 );
67     } while ( obj != but );
68 
69     fl_finish( );
70     return 0;
71 }
72 
73 
74 /*
75  * Local variables:
76  * tab-width: 4
77  * indent-tabs-mode: nil
78  * End:
79  */
80