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  * Show all the input field 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/inputall_gui.h"
34 #include <stdlib.h>
35 
36 /* callbacks for form input */
37 
38 /***************************************
39  ***************************************/
40 
41 void
done_cb(FL_OBJECT * ob FL_UNUSED_ARG,long data FL_UNUSED_ARG)42 done_cb( FL_OBJECT * ob    FL_UNUSED_ARG,
43          long        data  FL_UNUSED_ARG )
44 {
45     fl_finish( );
46     exit( 0 );
47 }
48 
49 
50 /***************************************
51  ***************************************/
52 
53 void
input_cb(FL_OBJECT * ob,long data FL_UNUSED_ARG)54 input_cb( FL_OBJECT * ob,
55           long        data  FL_UNUSED_ARG )
56 {
57     int cx,
58         cy;
59     char buf[ 128 ];
60 
61     fl_get_input_cursorpos( ob, &cx, &cy );
62     sprintf( buf,"x = %d y = %d", cx, cy );
63     fl_set_object_label( ( ( FD_input * ) ob->form->fdui )->report, buf );
64 }
65 
66 
67 /***************************************
68  ***************************************/
69 
70 void
hide_show_cb(FL_OBJECT * ob,long data FL_UNUSED_ARG)71 hide_show_cb( FL_OBJECT * ob,
72               long        data  FL_UNUSED_ARG )
73 {
74     FD_input *fd = ob->form->fdui;
75 
76     if ( fl_object_is_visible( fd->multiinput ) )
77         fl_hide_object( fd->multiinput );
78     else
79         fl_show_object( fd->multiinput );
80 }
81 
82 
83 /***************************************
84  ***************************************/
85 
86 int
main(int argc,char * argv[])87 main( int    argc,
88       char * argv[ ] )
89 {
90     FD_input *fd_input;
91 
92     fl_initialize( &argc, argv, 0, 0, 0 );
93     fd_input = create_form_input( );
94 
95     fl_set_object_dblbuffer( fd_input->report, 1 );
96     fl_set_object_return( fd_input->norminput, FL_RETURN_ALWAYS );
97     fl_set_object_return( fd_input->intinput, FL_RETURN_ALWAYS );
98     fl_set_object_return( fd_input->floatinput, FL_RETURN_ALWAYS );
99     fl_set_object_return( fd_input->dateinput, FL_RETURN_ALWAYS );
100     fl_set_object_return( fd_input->secretinput, FL_RETURN_ALWAYS );
101     fl_set_object_return( fd_input->multiinput, FL_RETURN_ALWAYS );
102 
103     /* Show the form */
104 
105     fl_show_form( fd_input->input, FL_PLACE_CENTERFREE, FL_FULLBORDER,
106                   "input" );
107 
108     while ( fl_do_forms( ) )
109         /* empty */ ;
110 
111     return 0;
112 }
113 
114 
115 /*
116  * Local variables:
117  * tab-width: 4
118  * indent-tabs-mode: nil
119  * End:
120  */
121