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
27
28 /**** Forms and Objects ****/
29
30 typedef struct {
31 FL_FORM *S;
32 void *vdata;
33 char *cdata;
34 long ldata;
35 } FD_S;
36
37 FD_S *S;
38
39
40 /***************************************
41 ***************************************/
42
43 void
timeoutCB(int tid FL_UNUSED_ARG,void * stuff FL_UNUSED_ARG)44 timeoutCB( int tid FL_UNUSED_ARG,
45 void * stuff FL_UNUSED_ARG )
46 {
47 fl_show_alert( "Standby", "This may abort", "with SEGV", 1 );
48 }
49
50
51 /***************************************
52 ***************************************/
53
54 void
pressedCB(FL_OBJECT * obj FL_UNUSED_ARG,long data FL_UNUSED_ARG)55 pressedCB( FL_OBJECT * obj FL_UNUSED_ARG,
56 long data FL_UNUSED_ARG )
57 {
58 int tid = fl_add_timeout( 300L, timeoutCB, NULL );
59
60 fprintf( stderr, "tid=%d\n", tid );
61 }
62
63
64 /***************************************
65 ***************************************/
66
67 FD_S *
create_form_S(void)68 create_form_S( void )
69 {
70 FL_OBJECT *obj;
71 FD_S *fdui = fl_calloc( 1, sizeof *fdui );
72 int old_unit = fl_get_coordunit( );
73
74 fl_set_coordunit( FL_COORD_centiMM );
75
76 fdui->S = fl_bgn_form( FL_NO_BOX, 10837, 8467 );
77
78 fl_add_box( FL_UP_BOX, 0, 0, 10837, 8467, "" );
79
80 obj = fl_add_button( FL_NORMAL_BUTTON, 1693, 1693, 7451, 4403, "Press Me" );
81 fl_set_object_callback( obj, pressedCB, 0 );
82
83 fl_end_form( );
84
85 fdui->S->fdui = fdui;
86 fl_set_coordunit( old_unit );
87
88 return fdui;
89 }
90
91
92 /***************************************
93 ***************************************/
94
95 int
main(int argc,char * argv[])96 main( int argc,
97 char * argv[ ] )
98 {
99 fl_initialize( &argc, argv, "S", 0, 0 );
100
101 S = create_form_S( );
102
103 fl_show_form( S->S, FL_PLACE_CENTER, FL_FULLBORDER, "Crash Test" );
104
105 while ( 1 )
106 fl_do_forms( );
107
108 return 0;
109 }
110
111
112 /*
113 * Local variables:
114 * tab-width: 4
115 * indent-tabs-mode: nil
116 * End:
117 */
118