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 /* Demo of the Use of a very long label */
22 
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26 
27 #include "include/forms.h"
28 
29 
30 const char *label1 = "This demo shows the use of some very\n"
31                      "long labels. The dynamic storage allocation\n"
32                      "for such long labels should guarantee that\n"
33                      "all of this works without any problem.";
34 
35 const char *label2 = "This is the second string that should again\n"
36                      "be a bit larger such that a new, larger amount\n"
37                      "of storage has to be allocated for the label.\n"
38                      "This is of course no problem. By the way,\n"
39                      "dynamic allocation of storage saves a lot\n"
40                      "of memory because for most objects the label\n"
41                      "is much shorter than the 64 bytes that were\n"
42                      "allocated for it in the previous version of\n"
43                      "the Forms Library";
44 
45 const char *label3 = "And now back to the first one:\n\n"
46                      "This demo shows the use of some very\n"
47                      "long labels. The dynamic storage allocation\n"
48                      "for such long labels should guarantee that\n"
49                      "all of this works without any problem.";
50 
51 
52 /***************************************
53  ***************************************/
54 
55 int
main(int argc,char * argv[])56 main( int    argc,
57       char * argv[ ] )
58 {
59     FL_FORM *form;
60     FL_OBJECT *strobj,
61 		      *but;
62 
63     fl_initialize( &argc, argv, "FormDemo", 0, 0 );
64 
65     form = fl_bgn_form( FL_UP_BOX, 400, 300 );
66 
67     strobj = fl_add_box( FL_DOWN_BOX, 10, 10, 380, 240, "Press Next" );
68     fl_set_object_lsize( strobj, FL_NORMAL_SIZE );
69 
70     but = fl_add_button( FL_NORMAL_BUTTON, 160, 260, 80, 30, "Next" );
71 
72     fl_end_form( );
73 
74     fl_set_form_hotobject( form, but );
75 
76     fl_show_form( form, FL_PLACE_HOTSPOT, FL_TRANSIENT, "longlabel" );
77     fl_do_forms( );
78 
79     fl_set_object_label( strobj, label1 );
80     fl_do_forms( );
81 
82     fl_set_object_label( strobj, label2 );
83     fl_do_forms( );
84 
85     fl_set_object_label( strobj, "Now we turn to a short label" );
86     fl_do_forms( );
87 
88     fl_set_object_label( strobj, label3 );
89     fl_set_object_label( but, "Quit" );
90     fl_do_forms( );
91 
92     fl_finish( );
93     return 0;
94 }
95 
96 
97 /*
98  * Local variables:
99  * tab-width: 4
100  * indent-tabs-mode: nil
101  * End:
102  */
103