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 classes
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/buttons_gui.h"   /* from fd/ directory */
34 #include <stdlib.h>
35 
36 
37 /* callbacks for form buttform */
38 
39 /***************************************
40  ***************************************/
41 
done_cb(FL_OBJECT * ob,long data FL_UNUSED_ARG)42 void done_cb( FL_OBJECT * ob,
43               long        data  FL_UNUSED_ARG )
44 {
45     fl_free( ob->form->fdui );
46     fl_finish( );
47     exit( 0 );
48 }
49 
50 
51 /***************************************
52  ***************************************/
53 
bw_cb(FL_OBJECT * ob,long data FL_UNUSED_ARG)54 void bw_cb( FL_OBJECT * ob,
55             long        data  FL_UNUSED_ARG )
56 {
57     int bws[ ] = { -4, -3, -2, -1, 1, 2, 3, 4 };
58     int n = fl_get_choice( ob ) - 1;
59     FD_buttform *fdui = ob->form->fdui;
60 
61     fl_freeze_form( ob->form );
62 
63     fl_set_object_bw( fdui->backface, bws[ n ] );
64     fl_set_object_bw( fdui->objsgroup, bws[ n ] );
65     fl_set_object_bw( fdui->done, bws[ n ] );
66 
67     fl_unfreeze_form( ob->form );
68 }
69 
70 
71 /***************************************
72  ***************************************/
73 
74 int
main(int argc,char * argv[])75 main( int    argc,
76       char * argv[ ] )
77 {
78     FD_buttform *fd_buttform;
79 
80     fl_initialize( &argc, argv, 0, 0, 0 );
81     fd_buttform = create_form_buttform( );
82 
83     /* fill-in form initialization code */
84 
85     fl_set_pixmapbutton_file( fd_buttform->pbutt,"crab45.xpm" );
86     fl_set_bitmapbutton_file( fd_buttform->bbutt,"bm1.xbm" );
87     fl_addto_choice( fd_buttform->bw_obj,
88                      " -4 | -3 | -2 | -1 |  1|  2|  3|  4" );
89     fl_set_choice( fd_buttform->bw_obj, 5 );
90 
91     /* show the first form */
92 
93     fl_show_form( fd_buttform->buttform, FL_PLACE_CENTER, FL_FULLBORDER,
94                   "buttform" );
95 
96     while ( fl_do_forms( ) )
97         /* empty */ ;
98 
99     return 0;
100 }
101 
102 
103 /*
104  * Local variables:
105  * tab-width: 4
106  * indent-tabs-mode: nil
107  * End:
108  */
109