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 * Demo showing the use of user defined object class: CROSSBUTTON
23 *
24 * Form definition file generated with fdesign.
25 * changed stub button to crossbutton
26 */
27
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31
32 #include "include/forms.h"
33 #include "crossbut.h"
34 #include <stdlib.h>
35
36 /**** Forms and Objects ****/
37
38 typedef struct {
39 FL_FORM * newbut;
40 void * vdata;
41 FL_OBJECT * bexit;
42 } FD_newbut;
43
44 extern FD_newbut *create_form_newbut(void);
45
46
47 /***************************************
48 ***************************************/
49
50 int
main(int argc,char * argv[])51 main( int argc,
52 char * argv[ ] )
53 {
54 FD_newbut *cbform ;
55
56 fl_initialize( &argc, argv, "FormDemo", 0, 0 );
57 cbform = create_form_newbut( );
58 fl_show_form( cbform->newbut, FL_PLACE_CENTER, FL_TRANSIENT,
59 "newbutton" );
60
61 while( fl_do_forms( ) != cbform->bexit )
62 /* empty */;
63
64 fl_finish( );
65 return 0;
66 }
67
68
69 /***************************************
70 ***************************************/
71
72 FD_newbut *
create_form_newbut(void)73 create_form_newbut( void )
74 {
75 FL_OBJECT *obj;
76 FD_newbut *fdui = fl_malloc( sizeof *fdui );
77 int oldbw = fl_get_border_width( );
78
79 fl_set_border_width( -2 );
80
81 fdui->newbut = fl_bgn_form( FL_NO_BOX, 310, 190 );
82
83 fl_add_box( FL_UP_BOX, 0, 0, 310, 190, "" );
84 obj = fl_add_labelframe( FL_ENGRAVED_FRAME, 40, 45, 100, 120, "CrossA" );
85 fl_set_object_boxtype( obj, FL_FLAT_BOX );
86 fl_set_object_lstyle( obj ,FL_BOLD_STYLE );
87
88 obj = fl_add_crossbutton( FL_RADIO_BUTTON, 50, 115, 80, 30, "Button" );
89 fl_set_object_color( obj, FL_COL1, FL_RED );
90
91 obj = fl_add_crossbutton( FL_RADIO_BUTTON, 50, 85, 80, 30, "Button" );
92 fl_set_object_color( obj, FL_COL1, FL_GREEN );
93
94 obj = fl_add_crossbutton( FL_RADIO_BUTTON, 50, 55, 80, 30, "Button" );
95 fl_set_object_color( obj, FL_COL1, FL_BLUE );
96
97 obj = fl_add_labelframe( FL_ENGRAVED_FRAME, 180, 45, 100, 120, "CrossB" );
98 fl_set_object_boxtype( obj, FL_FLAT_BOX );
99 fl_set_object_lstyle( obj, FL_BOLD_STYLE );
100
101 obj = fl_add_crossbutton( FL_PUSH_BUTTON, 190, 115, 80, 30, "Button" );
102 fl_set_object_color( obj, FL_COL1, FL_RED );
103
104 obj = fl_add_crossbutton( FL_PUSH_BUTTON, 190, 85, 90, 30, "Button" );
105 fl_set_object_color( obj, FL_COL1, FL_GREEN );
106
107 obj = fl_add_crossbutton( FL_PUSH_BUTTON, 190, 55, 80, 30, "Button" );
108 fl_set_object_color( obj, FL_COL1, FL_BLUE );
109
110 fdui->bexit = fl_add_button( FL_NORMAL_BUTTON, 125, 10, 65, 25, "Exit" );
111
112 fl_end_form( );
113
114 fl_set_border_width( oldbw );
115
116 return fdui;
117 }
118
119
120 /*
121 * Local variables:
122 * tab-width: 4
123 * indent-tabs-mode: nil
124 * End:
125 */
126