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 <stdlib.h>
27 #include "fd/formbrowser_gui.h"
28
29
30 /***************************************
31 ***************************************/
32
33 void
done_cb(FL_OBJECT * ob FL_UNUSED_ARG,long data FL_UNUSED_ARG)34 done_cb( FL_OBJECT * ob FL_UNUSED_ARG,
35 long data FL_UNUSED_ARG )
36 {
37 fl_finish( );
38 exit( 0 );
39 }
40
41
42 /***************************************
43 ***************************************/
44
45 void
hide_show_cb(FL_OBJECT * ob,long data)46 hide_show_cb( FL_OBJECT * ob,
47 long data )
48 {
49 FD_mainform *fdui = ob->form->fdui;
50
51 ( data ? fl_show_object : fl_hide_object )( fdui->formbrowser );
52 }
53
54
55 /***************************************
56 ***************************************/
57
58 void
reshow_cb(FL_OBJECT * ob,long data FL_UNUSED_ARG)59 reshow_cb( FL_OBJECT * ob,
60 long data FL_UNUSED_ARG )
61 {
62 fl_hide_form( ob->form );
63 fl_show_form( ob->form, FL_PLACE_POSITION, FL_FULLBORDER, "formbrowser" );
64 }
65
66
67 /***************************************
68 ***************************************/
69
70 void
scroll_cb(FL_OBJECT * ob,long data FL_UNUSED_ARG)71 scroll_cb( FL_OBJECT * ob,
72 long data FL_UNUSED_ARG )
73 {
74 static int n;
75 FD_mainform *fdui = ob->form->fdui;
76
77 fl_set_object_label( ob, n ? "Jump" : "Smooth" );
78 fl_set_formbrowser_scroll( fdui->formbrowser, n ^= 1 );
79 }
80
81
82 /***************************************
83 ***************************************/
84
85 void
deactivate_cb(FL_OBJECT * ob,long data FL_UNUSED_ARG)86 deactivate_cb( FL_OBJECT * ob,
87 long data FL_UNUSED_ARG )
88 {
89 FD_mainform *fdui = ob->form->fdui;
90
91 if ( fl_object_is_active( fdui->formbrowser ) )
92 {
93 fl_set_object_label( ob, "Activate" );
94 fl_deactivate_object( fdui->formbrowser );
95 }
96 else
97 {
98 fl_set_object_label( ob,"Deactivate" );
99 fl_activate_object( fdui->formbrowser );
100 }
101 }
102
103
104 /***************************************
105 ***************************************/
106
main(int argc,char * argv[])107 int main( int argc,
108 char * argv[ ] )
109 {
110 FD_buttonform *fd_buttonform;
111 FD_staticform *fd_staticform;
112 FD_mainform *fd_mainform;
113 FD_valuatorform *fd_valuatorform;
114 FD_choiceform *fd_choiceform;
115 FD_big *fd_big;
116
117 fl_set_border_width( -2 );
118 fl_initialize( &argc, argv, 0, 0, 0 );
119
120 fd_buttonform = create_form_buttonform( );
121 fd_staticform = create_form_staticform( );
122 fd_mainform = create_form_mainform( );
123 fd_valuatorform = create_form_valuatorform( );
124 fd_choiceform = create_form_choiceform( );
125 create_form_inputform( );
126
127 fd_big = create_form_big( );
128 {
129 float xx[ 5 ] = { 1, 2, 3, 4, 5 };
130 float yy[ 5 ] = { 1, 2, 3, 4, 5 };
131
132 fl_set_xyplot_data( fd_big->xyplot, xx, yy, 5, "title", "x", "y" );
133 }
134
135 /* fl_set_object_boxtype( fd_mainform->formbrowser, FL_SHADOW_BOX ); */
136
137 fl_addto_formbrowser( fd_mainform->formbrowser, fd_buttonform->buttonform );
138 fl_addto_formbrowser( fd_mainform->formbrowser,
139 fd_valuatorform->valuatorform);
140 fl_addto_formbrowser( fd_mainform->formbrowser, fd_big->big);
141 fl_addto_formbrowser( fd_mainform->formbrowser, fd_choiceform->choiceform );
142 fl_addto_formbrowser( fd_mainform->formbrowser, fd_staticform->staticform );
143
144 /* show the first form */
145
146 fl_show_form( fd_mainform->mainform,
147 FL_PLACE_CENTERFREE, FL_FULLBORDER, "buttonform" );
148
149 fl_do_forms( );
150
151 return 0;
152 }
153
154
155 /*
156 * Local variables:
157 * tab-width: 4
158 * indent-tabs-mode: nil
159 * End:
160 */
161