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 /*
22 * All button types
23 *
24 * This file is part of xforms package
25 * T.C. Zhao and M. Overmars (1997)
26 */
27
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31
32 #include "include/forms.h"
33 #include "fd/butttypes_gui.h"
34 #include <stdlib.h>
35
36
37 /* callbacks for form form0 */
38
39 /***************************************
40 ***************************************/
41
42 void
button_cb(FL_OBJECT * ob,long data FL_UNUSED_ARG)43 button_cb( FL_OBJECT * ob,
44 long data FL_UNUSED_ARG )
45 {
46 FD_form0 *ui = ( FD_form0 * ) ob->form->fdui;
47 char buf[ 128 ];
48
49 if ( ob->type == FL_HIDDEN_BUTTON )
50 {
51 if ( fl_show_question( "Want to Quit ?", 1 ) == 1 )
52 {
53 fl_free( ob->form->fdui );
54 fl_finish( );
55 exit( 0 );
56 }
57 }
58 else
59 {
60 sprintf( buf, "%s callback called: %d", ob->label, fl_get_button( ob ) );
61 fl_addto_browser( ui->br, buf );
62 }
63 }
64
65
66 /***************************************
67 ***************************************/
68
69 int
main(int argc,char * argv[])70 main( int argc,
71 char * argv[ ] )
72 {
73 FD_form0 *fd_form0;
74
75 fl_initialize( &argc, argv, 0, 0, 0 );
76 fd_form0 = create_form_form0( );
77
78 /* fill-in form initialization code */
79
80 /* show the first form */
81
82 fl_show_form( fd_form0->form0, FL_PLACE_CENTER, FL_FULLBORDER, "form0" );
83
84 fl_do_forms( );
85
86 return 0;
87 }
88
89
90 /*
91 * Local variables:
92 * tab-width: 4
93 * indent-tabs-mode: nil
94 * End:
95 */
96