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 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24 
25 #include "include/forms.h"
26 #include "fd/twheel_gui.h"
27 
28 /* callbacks and freeobj handles for form twheelform */
29 
30 /***************************************
31  ***************************************/
32 
33 void
valchange_cb(FL_OBJECT * ob,long data FL_UNUSED_ARG)34 valchange_cb( FL_OBJECT * ob,
35               long        data  FL_UNUSED_ARG )
36 {
37     FD_twheelform *fdui = ( FD_twheelform * ) ob->form->fdui;
38     char buf[ 128 ];
39 
40     sprintf( buf, "%.3f", fl_get_thumbwheel_value( ob ) );
41     fl_set_object_label( fdui->report, buf );
42 }
43 
44 
45 /***************************************
46  ***************************************/
47 
48 void
returnchange_cb(FL_OBJECT * ob,long data FL_UNUSED_ARG)49 returnchange_cb( FL_OBJECT * ob,
50                  long        data  FL_UNUSED_ARG )
51 {
52      FD_twheelform *fdui = ( FD_twheelform * ) ob->form->fdui;
53      int n = fl_get_choice( ob );
54 
55      if ( n == 1 )
56          n = FL_RETURN_END_CHANGED;
57      else if ( n == 2 )
58          n = FL_RETURN_CHANGED;
59      else if ( n == 3 )
60          n = FL_RETURN_END;
61      else
62          n = FL_RETURN_ALWAYS;
63 
64      fl_set_thumbwheel_return( fdui->vert, n );
65      fl_set_thumbwheel_return( fdui->hor, n );
66 }
67 
68 
69 /***************************************
70  ***************************************/
71 
72 int
main(int argc,char * argv[])73 main( int    argc,
74       char * argv[ ] )
75 {
76     FD_twheelform *fd_twheelform;
77 
78     fl_initialize( &argc, argv, 0, 0, 0 );
79     fd_twheelform = create_form_twheelform( );
80 
81     /* show the first form */
82 
83     fl_show_form( fd_twheelform->twheelform,
84                   FL_PLACE_CENTERFREE, FL_FULLBORDER, "twheelform" );
85 
86     fl_do_forms( );
87     return 0;
88 }
89 
90 
91 /*
92  * Local variables:
93  * tab-width: 4
94  * indent-tabs-mode: nil
95  * End:
96  */
97