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 program uses the routines in the
22 * goodies section, that help you create easy
23 * forms in an even easier way.
24 */
25
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30 #include <stdlib.h>
31 #include <string.h>
32 #include "include/forms.h"
33
34
35 /***************************************
36 ***************************************/
37
38 void
timeout_remove_alert(int id FL_UNUSED_ARG,void * data FL_UNUSED_ARG)39 timeout_remove_alert( int id FL_UNUSED_ARG,
40 void * data FL_UNUSED_ARG )
41 {
42 fl_hide_alert( );
43 }
44
45
46 /***************************************
47 ***************************************/
48
49 int
main(int argc,char * argv[])50 main( int argc,
51 char * argv[ ] )
52 {
53 int choice;
54 char str1[ 100 ],
55 str2[ 100 ];
56 const char *s;
57
58 fl_initialize( &argc, argv, "FormDemo", 0, 0 );
59
60 #if 0
61 fl_set_resource( FLOKLabel, "Go" );
62 #endif
63
64 if( fl_show_question( "Do you want bold font ?",1 ) )
65 fl_set_goodies_font( FL_BOLD_STYLE, FL_NORMAL_SIZE );
66
67 fl_show_messages( "This is a test program for the goodies of the "
68 "forms library" );
69
70 fl_add_timeout( 5000, timeout_remove_alert, 0 );
71 fl_show_alert( "Alert", "Alert form can be used to inform",
72 "about recoverable errors", 0 );
73
74 if ( fl_show_question( "Do you want to quit?", 0 ) )
75 exit( 0 );
76
77 strcpy( str1, ( s = fl_show_input( "Enter a string:","" ) ) ? s : "" );
78 fl_show_message( "You typed:", "", str1 );
79 choice = fl_show_choices( "Pick a choice", 3, "One", "Two", "Three", 2 );
80 switch ( choice )
81 {
82 case 1:
83 fl_show_message( "You typed: One", "", "" );
84 break;
85
86 case 2:
87 fl_show_message( "You typed: Two", "", "" );
88 break;
89
90 case 3:
91 fl_show_message( "You typed: Three", "", "" );
92 break;
93
94 default:
95 fl_show_message( "An error occured!", "", "" );
96 break;
97 }
98
99 strcpy( str2,
100 ( s = fl_show_input( "Enter another string:", str1 ) ) ?
101 s : "<Cancel>" );
102 fl_show_message( "You typed:", "", str2 );
103 fl_show_messages( "Good Bye" );
104
105 fl_finish( );
106 return 0;
107 }
108
109
110 /*
111 * Local variables:
112 * tab-width: 4
113 * indent-tabs-mode: nil
114 * End:
115 */
116