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 * Built-in xforms clock
23 * T.C. Zhao and M. Overmars
24 */
25
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30 #include "include/forms.h"
31 #include <stdlib.h>
32
33 FL_FORM *fclock;
34
35
36 /***************************************
37 ***************************************/
38
39 void
exit_cb(FL_OBJECT * ob FL_UNUSED_ARG,long q FL_UNUSED_ARG)40 exit_cb( FL_OBJECT * ob FL_UNUSED_ARG,
41 long q FL_UNUSED_ARG )
42 {
43 fl_finish( );
44 exit( 0 );
45 }
46
47
48 /***************************************
49 ***************************************/
50
51 void
create_form_clock(void)52 create_form_clock( void )
53 {
54 FL_OBJECT *obj;
55
56 fclock = fl_bgn_form( FL_NO_BOX, 500, 350 );
57
58 fl_add_box( FL_UP_BOX, 0, 0, 500, 350, "" );
59
60 obj = fl_add_clock( FL_DIGITAL_CLOCK, 185, 20, 150, 35, "" );
61 fl_set_object_boxtype( obj, FL_ROUNDED_BOX );
62 fl_set_object_color( obj, FL_COL1,FL_BLACK );
63 fl_set_object_lsize( obj, FL_MEDIUM_SIZE );
64 fl_set_object_lstyle( obj, FL_BOLD_STYLE );
65
66 obj = fl_add_clock( FL_ANALOG_CLOCK, 30, 70, 220, 200, "" );
67 fl_set_object_boxtype( obj, FL_UP_BOX );
68
69 obj = fl_add_clock( FL_ANALOG_CLOCK, 260, 70, 220, 200, "" );
70 fl_set_object_boxtype( obj, FL_OVAL3D_UPBOX );
71
72 obj = fl_add_button( FL_NORMAL_BUTTON, 375, 300, 110, 35, "Exit" );
73 fl_set_object_callback( obj, exit_cb, 0 );
74
75 fl_end_form( );
76
77 fl_scale_form( fclock, 0.7, 0.7 );
78 }
79
80
81 /***************************************
82 ***************************************/
83
84 int
main(int argc,char * argv[])85 main( int argc,
86 char * argv[ ] )
87 {
88 fl_initialize( &argc, argv, "FormDemo", 0, 0 );
89
90 create_form_clock( );
91 fl_show_form( fclock, FL_PLACE_CENTER, FL_TRANSIENT,"clocks" );
92
93 fl_do_forms( );
94
95 fl_finish( );
96 return 0;
97 }
98
99
100 /*
101 * Local variables:
102 * tab-width: 4
103 * indent-tabs-mode: nil
104 * End:
105 */
106