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 /* A demo of the forms library using light buttons for
22 radio buttons and input fields.
23 */
24
25
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30 #include <stdlib.h>
31 #include "include/forms.h"
32
33
34 FL_FORM *form;
35 FL_OBJECT *but;
36
37
38 /***************************************
39 ***************************************/
40
41 void
make_form1(void)42 make_form1( void )
43 {
44 FL_OBJECT *obj;
45
46 form = fl_bgn_form( FL_UP_BOX, 500, 400 );
47
48 fl_bgn_group( );
49
50 obj = fl_add_box( FL_UP_BOX, 150, 295, 300, 65, "Children " );
51 fl_set_object_lalign( obj, FL_ALIGN_LEFT);
52 fl_add_lightbutton( FL_RADIO_BUTTON, 175, 310, 50, 35, "1" );
53 fl_add_lightbutton( FL_RADIO_BUTTON, 241, 310, 50, 35, "2" );
54 fl_add_lightbutton( FL_RADIO_BUTTON, 308, 310, 50, 35, "3" );
55 fl_add_lightbutton( FL_RADIO_BUTTON, 375, 310, 50, 35, "4" );
56
57 fl_end_group( );
58
59 fl_bgn_group( );
60
61 obj = fl_add_box( FL_UP_BOX, 150, 230, 300, 65, "Married " );
62 fl_set_object_lalign( obj, FL_ALIGN_LEFT );
63 fl_add_lightbutton( FL_RADIO_BUTTON, 175, 245, 100, 35, "Yes" );
64 fl_add_lightbutton( FL_RADIO_BUTTON, 325, 245, 100, 35, "No" );
65
66 fl_end_group( );
67
68 fl_bgn_group( );
69
70 obj = fl_add_box( FL_UP_BOX, 150, 165, 300, 65, "Sex " );
71 fl_set_object_lalign( obj, FL_ALIGN_LEFT );
72 fl_add_lightbutton( FL_RADIO_BUTTON, 175, 180, 100, 35, "Male" );
73 fl_add_lightbutton( FL_RADIO_BUTTON, 325, 180, 100, 35, "Female" );
74
75 fl_end_group( );
76
77 fl_add_input( FL_NORMAL_INPUT, 150, 30, 300, 30, "Name " );
78
79 fl_add_input( FL_NORMAL_INPUT, 150, 75, 300, 30, "Address " );
80
81 fl_add_input( FL_NORMAL_INPUT, 150, 120, 300, 30, "City " );
82
83 but = fl_add_button( FL_NORMAL_BUTTON, 25, 360, 75, 30, "OK" );
84
85 fl_end_form( );
86 }
87
88
89 /***************************************
90 ***************************************/
91
92 int
main(int argc,char * argv[])93 main( int argc,
94 char * argv[ ] )
95 {
96 FL_OBJECT *obj;
97
98 fl_initialize( &argc, argv, "FormDemo", 0, 0 );
99 make_form1( );
100
101 fl_show_form( form, FL_PLACE_CENTER, FL_NOBORDER, "Demo06" );
102
103 while ( 1 )
104 {
105 do
106 obj = fl_do_forms( );
107 while ( obj != but );
108
109 if ( fl_show_question( "Do you really want to Quit?", 0 ))
110 break;
111 }
112
113 fl_finish( );
114 return 0;
115 }
116
117
118 /*
119 * Local variables:
120 * tab-width: 4
121 * indent-tabs-mode: nil
122 * End:
123 */
124