~ubuntu-branches/ubuntu/hoary/plib-doc/hoary

« back to all changes in this revision

Viewing changes to src/pui/widget_list.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Frauenfelder
  • Date: 2004-07-13 20:56:29 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040713205629-gw7kmoiiwaqi6rol
Tags: 1.8.1-4
Changed build depends: added xlibs-dev, removed g++. Additionally, added
-lpthread to LDFLAGS for configure call. Closes: #259131

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
     PLIB - A Suite of Portable Game Libraries
 
3
     Copyright (C) 2001  Steve Baker
 
4
 
 
5
     This program is free software; you can redistribute it and/or modify
 
6
     it under the terms of the GNU General Public License as published by
 
7
     the Free Software Foundation; either version 2 of the License, or
 
8
     (at your option) any later version.
 
9
 
 
10
     This program is distributed in the hope that it will be useful,
 
11
     but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
     GNU General Public License for more details.
 
14
 
 
15
     You should have received a copy of the GNU General Public License
 
16
     along with this program; if not, write to the Free Software
 
17
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
18
 
 
19
     For further information visit http://plib.sourceforge.net
 
20
 
 
21
     $Id: widget_list.cxx,v 1.15 2002/09/01 12:04:51 ude Exp $
 
22
*/
 
23
 
1
24
// Sample program to create a copy of each widget in PUI
2
25
 
3
26
#include <stdio.h>
6
29
#include <string.h>
7
30
#include <time.h>
8
31
#ifdef WIN32
9
 
#include <windows.h>
 
32
#  include <windows.h>
10
33
#else
11
 
#include <unistd.h>
 
34
#  include <unistd.h>
12
35
#endif
13
36
#include <math.h>
14
 
#include <GL/glut.h>
15
 
#include "plib/pu.h"
 
37
 
 
38
#ifdef FREEGLUT_IS_PRESENT
 
39
#  include <GL/freeglut.h>
 
40
#else
 
41
#  ifdef __APPLE__
 
42
#    include <GLUT/glut.h>
 
43
#  else
 
44
#    include <GL/glut.h>
 
45
#  endif
 
46
#endif
 
47
 
 
48
#include <plib/pu.h>
16
49
 
17
50
//#define VOODOO 1
18
51
 
22
55
*                                   *
23
56
\***********************************/
24
57
 
25
 
int          main_window ;
26
 
 
27
 
int button_box_window ;
28
 
puButtonBox *button_box ;
29
 
 
30
 
int frame_window ;
31
 
puFrame *frame ;
32
 
 
33
 
int text_window ;
34
 
puText *text ;
35
 
 
36
 
int button_window ;
37
 
puButton *button ;
38
 
 
39
 
int one_shot_window ;
40
 
puOneShot *one_shot ;
41
 
 
42
 
int popup_menu_window ;
43
 
puPopupMenu *popup_menu ;
44
 
 
45
 
int menu_bar_window ;
46
 
puMenuBar *menu_bar ;
47
 
 
48
 
int input_window ;
49
 
puInput *input ;
50
 
 
51
 
int slider_window ;
52
 
puSlider *slider ;
53
 
 
54
 
int arrow_button_window ;
55
 
puArrowButton *arrow_button ;
56
 
 
57
 
int dial_window ;
58
 
puDial *dial ;
59
 
 
60
 
int file_picker_window ;
61
 
puFilePicker *file_picker ;
62
 
 
63
 
int bislider_window ;
64
 
puBiSlider *bislider ;
65
 
 
66
 
int trislider_window ;
67
 
puTriSlider *trislider ;
68
 
 
69
 
int vertical_menu_window ;
70
 
puVerticalMenu *vertical_menu ;
71
 
 
72
 
int dialog_box_window ;
73
 
puDialogBox *dialog_box ;
74
 
 
75
 
int large_input_window ;
76
 
puLargeInput *large_input ;
77
 
 
78
 
fntTexFont *tim ;
79
 
 
80
 
 
81
 
static int firsttime;
 
58
static int          main_window ;
 
59
 
 
60
static int button_box_window ;
 
61
static puButtonBox *button_box ;
 
62
 
 
63
static int frame_window ;
 
64
static puFrame *frame ;
 
65
 
 
66
static int text_window ;
 
67
static puText *text ;
 
68
 
 
69
static int button_window ;
 
70
static puButton *button ;
 
71
static puText *button_text ;
 
72
 
 
73
static int one_shot_window ;
 
74
static puOneShot *one_shot ;
 
75
 
 
76
static int popup_menu_window ;
 
77
static puPopupMenu *popup_menu ;
 
78
 
 
79
static int menu_bar_window ;
 
80
static puMenuBar *menu_bar ;
 
81
 
 
82
static int input_window ;
 
83
static puInput *input ;
 
84
 
 
85
static int slider_window ;
 
86
static puSlider *slider ;
 
87
 
 
88
static int arrow_button_window ;
 
89
static puArrowButton *arrow_button ;
 
90
 
 
91
static int dial_window ;
 
92
static puDial *dial ;
 
93
 
 
94
static int list_box_window ;
 
95
static puListBox *list_box ;
 
96
 
 
97
static int file_selector_window ;
 
98
static puFileSelector *file_selector ;
 
99
 
 
100
static int bislider_window ;
 
101
static puBiSlider *bislider ;
 
102
 
 
103
static int trislider_window ;
 
104
static puTriSlider *trislider ;
 
105
 
 
106
static int vertical_menu_window ;
 
107
static puVerticalMenu *vertical_menu ;
 
108
 
 
109
static int dialog_box_window ;
 
110
static puDialogBox *dialog_box ;
 
111
 
 
112
static int large_input_window ;
 
113
static puLargeInput *large_input ;
 
114
 
 
115
static int combo_box_window ;
 
116
static puComboBox *combo_box ;
 
117
 
 
118
static int select_box_window ;
 
119
static puSelectBox *select_box ;
 
120
 
 
121
//static fntTexFont *tim ;
82
122
 
83
123
 
84
124
 
108
148
  glutPostRedisplay () ;
109
149
}
110
150
 
111
 
static void mousefn ( int button, int updown, int x, int y )
 
151
static void mousefn ( int btn, int updown, int x, int y )
112
152
{
113
 
  puMouse ( button, updown, x, y ) ;
 
153
  puMouse ( btn, updown, x, y ) ;
114
154
  glutPostRedisplay () ;
115
155
}
116
156
 
124
164
{
125
165
  /* Clear the screen */
126
166
 
127
 
  glClearColor ( 0.4, 1.0, 1.0, 1.0 ) ;
128
 
  glClear      ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
 
167
  glClearColor ( 0.55f, 0.55f, 0.55f, 1.0f ) ;
 
168
  glClear      ( GL_COLOR_BUFFER_BIT ) ;
129
169
 
130
170
  /* Make PUI redraw */
131
171
 
132
172
  puDisplay () ;
133
 
  
134
 
  /* Off we go again... */
 
173
 
 
174
  /* Swap buffers */
135
175
 
136
176
  glutSwapBuffers   () ;
137
 
  glutPostRedisplay () ;
138
177
}
139
178
 
140
179
 
145
184
*                                   *
146
185
\***********************************/
147
186
 
148
 
void exit_cb ( puObject * )
 
187
static void exit_cb ( puObject * )
149
188
{
150
189
  fprintf ( stderr, "Exiting PUI demo program.\n" ) ;
151
190
  exit ( 1 ) ;
153
192
 
154
193
/* Menu bar entries: */
155
194
 
156
 
char      *file_submenu    [] = {  "Exit", "Close", "========", "Print", "========", "Save", "New", NULL } ;
157
 
puCallback file_submenu_cb [] = { exit_cb, exit_cb,       NULL, NULL  ,       NULL,  NULL, NULL, NULL } ;
 
195
static char      *file_submenu    [] = {  "Exit", "Close", "========", "Print", "========", "Save", "New", NULL } ;
 
196
static puCallback file_submenu_cb [] = { exit_cb, exit_cb,       NULL, NULL  ,       NULL,  NULL, NULL, NULL } ;
158
197
 
159
 
char      *edit_submenu    [] = { "Do nothing.", NULL } ;
 
198
static char      *edit_submenu    [] = { "Do nothing.", NULL } ;
160
199
puCallback edit_submenu_cb [] = {     NULL, NULL } ;
161
200
 
162
 
char      *help_submenu    [] = { "About...",  "Help", NULL } ;
 
201
static char      *help_submenu    [] = { "About...",  "Help", NULL } ;
163
202
puCallback help_submenu_cb [] = {   NULL, NULL, NULL } ;
164
203
 
165
204
 
166
205
int main ( int argc, char **argv )
167
206
{
168
 
  firsttime = TRUE;
169
 
 
170
207
  glutInitWindowPosition( 100,   0 ) ;
171
208
  glutInitWindowSize    ( 640, 480 ) ;
172
209
  glutInit              ( &argc, argv ) ;
173
 
  glutInitDisplayMode   ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
 
210
  glutInitDisplayMode   ( GLUT_RGB | GLUT_DOUBLE ) ;
174
211
  main_window = glutCreateWindow      ( "PUI Widget List"  ) ;
175
212
  glutDisplayFunc       ( displayfn ) ;
176
213
  glutKeyboardFunc      ( keyfn     ) ;
177
214
  glutSpecialFunc       ( specialfn ) ;
178
215
  glutMouseFunc         ( mousefn   ) ;
179
216
  glutMotionFunc        ( motionfn  ) ;
 
217
#ifdef VOODOO
180
218
  glutPassiveMotionFunc ( motionfn  ) ;
181
 
  glutIdleFunc          ( displayfn ) ;
 
219
#endif
182
220
 
183
221
  puInit () ;
184
222
 
186
224
  puShowCursor () ;
187
225
#endif
188
226
 
189
 
  tim = new fntTexFont ;
190
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
191
 
  puFont times_medium ( tim, 12 ) ;
192
 
  puSetDefaultFonts        ( times_medium, times_medium ) ;
 
227
  //tim = new fntTexFont ;
 
228
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
 
229
  //puFont times_medium ( tim, 12 ) ;
 
230
  //puSetDefaultFonts        ( times_medium, times_medium ) ;
193
231
  puSetDefaultStyle        ( PUSTYLE_SMALL_SHADED ) ;
194
 
  puSetDefaultColourScheme ( 0.8, 0.8, 0.8, 1.0) ;
 
232
  puSetDefaultColourScheme ( 0.8f, 0.8f, 0.8f, 1.0f ) ;
 
233
 
195
234
 
196
235
  /* Set up the secondary windows and their widgets */
197
236
 
203
242
  glutSpecialFunc       ( specialfn ) ;
204
243
  glutMouseFunc         ( mousefn   ) ;
205
244
  glutMotionFunc        ( motionfn  ) ;
 
245
#ifdef VOODOO
206
246
  glutPassiveMotionFunc ( motionfn  ) ;
207
 
  glutIdleFunc          ( displayfn ) ;
 
247
#endif
208
248
 
209
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
249
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
210
250
 
211
251
  char *button_box_entries [] = { "First Entry", "Second Entry", "Third Entry", NULL } ;
212
252
  button_box = new puButtonBox ( 10, 10, 130, 80, button_box_entries, TRUE ) ;
213
253
  button_box->setLabel ( "Label" ) ;
214
 
  button_box->setLegend ( "Legend" ) ;
 
254
 
215
255
 
216
256
  frame_window = glutCreateWindow      ( "Frame Window"  ) ;
217
257
  glutPositionWindow    ( 200, 100 ) ;
221
261
  glutSpecialFunc       ( specialfn ) ;
222
262
  glutMouseFunc         ( mousefn   ) ;
223
263
  glutMotionFunc        ( motionfn  ) ;
 
264
#ifdef VOODOO
224
265
  glutPassiveMotionFunc ( motionfn  ) ;
225
 
  glutIdleFunc          ( displayfn ) ;
 
266
#endif
226
267
 
227
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
268
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
228
269
 
229
270
  frame = new puFrame ( 10, 10, 130, 80 ) ;
230
271
  frame->setLabel ( "Label" ) ;
231
272
  frame->setLegend ( "Legend" ) ;
232
273
 
 
274
 
233
275
  text_window = glutCreateWindow      ( "Text Window"  ) ;
234
276
  glutPositionWindow    ( 200, 100 ) ;
235
277
  glutReshapeWindow     ( 180,  100 ) ;
238
280
  glutSpecialFunc       ( specialfn ) ;
239
281
  glutMouseFunc         ( mousefn   ) ;
240
282
  glutMotionFunc        ( motionfn  ) ;
 
283
#ifdef VOODOO
241
284
  glutPassiveMotionFunc ( motionfn  ) ;
242
 
  glutIdleFunc          ( displayfn ) ;
 
285
#endif
243
286
 
244
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
287
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
245
288
 
246
289
  text = new puText ( 10, 10 ) ;
247
290
  text->setLabel ( "Label" ) ;
248
 
  text->setLegend ( "Legend" ) ;
 
291
 
249
292
 
250
293
  button_window = glutCreateWindow      ( "Button Window"  ) ;
251
294
  glutPositionWindow    ( 200, 100 ) ;
252
 
  glutReshapeWindow     ( 180,  100 ) ;
 
295
  glutReshapeWindow     ( 220,  160 ) ;
253
296
  glutDisplayFunc       ( displayfn ) ;
254
297
  glutKeyboardFunc      ( keyfn     ) ;
255
298
  glutSpecialFunc       ( specialfn ) ;
256
299
  glutMouseFunc         ( mousefn   ) ;
257
300
  glutMotionFunc        ( motionfn  ) ;
 
301
#ifdef VOODOO
258
302
  glutPassiveMotionFunc ( motionfn  ) ;
259
 
  glutIdleFunc          ( displayfn ) ;
260
 
 
261
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
262
 
 
263
 
  button = new puButton ( 10, 10, 90, 30 ) ;
 
303
#endif
 
304
 
 
305
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
 
306
 
 
307
  button_text = new puText ( 5, 6 ) ;
 
308
  button_text->setLabel ( "XCHECK:" ) ;
 
309
 
 
310
  button = new puButton ( 90, 10, 90+16, 10+16, PUBUTTON_XCHECK ) ;
 
311
  button->setLabelPlace ( PUPLACE_CENTERED_RIGHT ) ;
 
312
  button->setLabel ( "Label" ) ;
 
313
  button->setValue ( 1 ) ;
 
314
 
 
315
  button_text = new puText ( 5, 36 ) ;
 
316
  button_text->setLabel ( "VCHECK:" ) ;
 
317
 
 
318
  button = new puButton ( 90, 40, 90+16, 40+16, PUBUTTON_VCHECK ) ;
 
319
  button->setLabelPlace ( PUPLACE_CENTERED_RIGHT ) ;
 
320
  button->setLabel ( "Label" ) ;
 
321
  button->setValue ( 1 ) ;
 
322
 
 
323
  button_text = new puText ( 5, 66 ) ;
 
324
  button_text->setLabel ( "CIRCLE:" ) ;
 
325
 
 
326
  button = new puButton ( 90, 70, 90+16, 70+16, PUBUTTON_CIRCLE ) ;
 
327
  button->setLabelPlace ( PUPLACE_CENTERED_RIGHT ) ;
 
328
  button->setLabel ( "Label" ) ;
 
329
  button->setValue ( 1 ) ;
 
330
 
 
331
  button_text = new puText ( 5, 96 ) ;
 
332
  button_text->setLabel ( "RADIO:" ) ;
 
333
 
 
334
  button = new puButton ( 90, 100, 90+16, 100+16, PUBUTTON_RADIO ) ;
 
335
  button->setLabelPlace ( PUPLACE_CENTERED_RIGHT ) ;
 
336
  button->setLabel ( "Label" ) ;
 
337
  button->setValue ( 1 ) ;
 
338
 
 
339
  button_text = new puText ( 5, 128 ) ;
 
340
  button_text->setLabel ( "NORMAL:" ) ;
 
341
 
 
342
  button = new puButton ( 90, 130, 170, 150 ) ;
 
343
  button->setLabelPlace ( PUPLACE_CENTERED_RIGHT ) ;
264
344
  button->setLabel ( "Label" ) ;
265
345
  button->setLegend ( "Legend" ) ;
266
346
  button->setValue ( 1 ) ;
267
 
  puText *button_text = new puText ( 10, 40 ) ;
268
 
  button_text->setLabel ( "(Button pressed in)" ) ;
 
347
 
269
348
 
270
349
  one_shot_window = glutCreateWindow      ( "One Shot Window"  ) ;
271
350
  glutPositionWindow    ( 200, 100 ) ;
275
354
  glutSpecialFunc       ( specialfn ) ;
276
355
  glutMouseFunc         ( mousefn   ) ;
277
356
  glutMotionFunc        ( motionfn  ) ;
 
357
#ifdef VOODOO
278
358
  glutPassiveMotionFunc ( motionfn  ) ;
279
 
  glutIdleFunc          ( displayfn ) ;
 
359
#endif
280
360
 
281
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
361
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
282
362
 
283
363
  one_shot = new puOneShot ( 10, 10, 90, 30 ) ;
284
364
  one_shot->setLabel ( "Label" ) ;
285
365
  one_shot->setLegend ( "Legend" ) ;
286
366
 
 
367
 
287
368
  popup_menu_window = glutCreateWindow      ( "Popup Menu Window"  ) ;
288
369
  glutPositionWindow    ( 200, 100 ) ;
289
370
  glutReshapeWindow     ( 80,  100 ) ;
292
373
  glutSpecialFunc       ( specialfn ) ;
293
374
  glutMouseFunc         ( mousefn   ) ;
294
375
  glutMotionFunc        ( motionfn  ) ;
 
376
#ifdef VOODOO
295
377
  glutPassiveMotionFunc ( motionfn  ) ;
296
 
  glutIdleFunc          ( displayfn ) ;
 
378
#endif
297
379
 
298
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
380
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
299
381
 
300
382
  popup_menu = new puPopupMenu ( 10, 10 ) ;
301
 
  popup_menu->setLabel ( "Label" ) ;
302
 
  popup_menu->setLegend ( "Legend" ) ;
303
383
  popup_menu->add_item ( "Cut", NULL ) ;
304
384
  popup_menu->add_item ( "Copy", NULL ) ;
305
385
  popup_menu->add_item ( "Paste", NULL ) ;
307
387
  popup_menu->close () ;
308
388
  popup_menu->reveal () ;
309
389
 
 
390
 
310
391
  menu_bar_window = glutCreateWindow      ( "Menu Bar Window"  ) ;
311
392
  glutPositionWindow    ( 200, 100 ) ;
312
393
  glutReshapeWindow     ( 180,  200 ) ;
315
396
  glutSpecialFunc       ( specialfn ) ;
316
397
  glutMouseFunc         ( mousefn   ) ;
317
398
  glutMotionFunc        ( motionfn  ) ;
 
399
#ifdef VOODOO
318
400
  glutPassiveMotionFunc ( motionfn  ) ;
319
 
  glutIdleFunc          ( displayfn ) ;
 
401
#endif
320
402
 
321
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
403
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
322
404
 
323
405
  menu_bar = new puMenuBar () ;
324
406
  {
327
409
    menu_bar -> add_submenu ( "Help", help_submenu, help_submenu_cb ) ;
328
410
  }
329
411
  menu_bar -> close () ; 
330
 
  menu_bar->setLabel ( "Label" ) ;
331
 
  menu_bar->setLegend ( "Legend" ) ;
 
412
 
332
413
 
333
414
  input_window = glutCreateWindow      ( "Input Window"  ) ;
334
415
  glutPositionWindow    ( 200, 100 ) ;
338
419
  glutSpecialFunc       ( specialfn ) ;
339
420
  glutMouseFunc         ( mousefn   ) ;
340
421
  glutMotionFunc        ( motionfn  ) ;
 
422
#ifdef VOODOO
341
423
  glutPassiveMotionFunc ( motionfn  ) ;
342
 
  glutIdleFunc          ( displayfn ) ;
 
424
#endif
343
425
 
344
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
426
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
345
427
 
346
428
  input = new puInput ( 10, 10, 90, 30 ) ;
347
429
  input->setLabel ( "Label" ) ;
348
 
  input->setLegend ( "Legend" ) ;
 
430
 
349
431
 
350
432
  slider_window = glutCreateWindow      ( "Slider Window"  ) ;
351
433
  glutPositionWindow    ( 200, 100 ) ;
355
437
  glutSpecialFunc       ( specialfn ) ;
356
438
  glutMouseFunc         ( mousefn   ) ;
357
439
  glutMotionFunc        ( motionfn  ) ;
 
440
#ifdef VOODOO
358
441
  glutPassiveMotionFunc ( motionfn  ) ;
359
 
  glutIdleFunc          ( displayfn ) ;
360
 
 
361
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
362
 
 
363
 
  slider = new puSlider ( 10, 10, 120, 0 ) ;
 
442
#endif
 
443
 
 
444
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
 
445
 
 
446
  slider = new puSlider ( 10, 10, 120, FALSE ) ;
364
447
  slider->setLabel ( "Label" ) ;
365
448
  slider->setLegend ( "Legend" ) ;
366
449
 
 
450
 
367
451
  arrow_button_window = glutCreateWindow      ( "Arrow Button Window"  ) ;
368
452
  glutPositionWindow    ( 200, 100 ) ;
369
453
  glutReshapeWindow     ( 180,  100 ) ;
372
456
  glutSpecialFunc       ( specialfn ) ;
373
457
  glutMouseFunc         ( mousefn   ) ;
374
458
  glutMotionFunc        ( motionfn  ) ;
 
459
#ifdef VOODOO
375
460
  glutPassiveMotionFunc ( motionfn  ) ;
376
 
  glutIdleFunc          ( displayfn ) ;
 
461
#endif
377
462
 
378
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
463
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
379
464
 
380
465
  arrow_button = new puArrowButton ( 10, 10, 50, 50, PUARROW_RIGHT ) ;
381
466
  arrow_button->setLabel ( "Label" ) ;
382
 
  arrow_button->setLegend ( "Legend" ) ;
 
467
 
383
468
 
384
469
  dial_window = glutCreateWindow      ( "Dial Window"  ) ;
385
470
  glutPositionWindow    ( 200, 100 ) ;
389
474
  glutSpecialFunc       ( specialfn ) ;
390
475
  glutMouseFunc         ( mousefn   ) ;
391
476
  glutMotionFunc        ( motionfn  ) ;
 
477
#ifdef VOODOO
392
478
  glutPassiveMotionFunc ( motionfn  ) ;
393
 
  glutIdleFunc          ( displayfn ) ;
 
479
#endif
394
480
 
395
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
481
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
396
482
 
397
483
  dial = new puDial ( 10, 10, 60 ) ;
398
484
  dial->setLabel ( "Label" ) ;
399
485
  dial->setLegend ( "Legend" ) ;
400
486
 
401
 
  file_picker_window = glutCreateWindow      ( "File Picker Window"  ) ;
402
 
  glutPositionWindow    ( 200, 100 ) ;
403
 
  glutReshapeWindow     ( 300,  200 ) ;
404
 
  glutDisplayFunc       ( displayfn ) ;
405
 
  glutKeyboardFunc      ( keyfn     ) ;
406
 
  glutSpecialFunc       ( specialfn ) ;
407
 
  glutMouseFunc         ( mousefn   ) ;
408
 
  glutMotionFunc        ( motionfn  ) ;
409
 
  glutPassiveMotionFunc ( motionfn  ) ;
410
 
  glutIdleFunc          ( displayfn ) ;
411
 
 
412
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
413
 
 
414
 
  file_picker = new puFilePicker ( 10, 10, 280, 180, "." ) ;
415
 
  file_picker->setLabel ( "Label" ) ;
416
 
  file_picker->setLegend ( "Legend" ) ;
 
487
 
 
488
  list_box_window = glutCreateWindow      ( "List Box Window" ) ;
 
489
  glutPositionWindow    ( 200, 100 ) ;
 
490
  glutReshapeWindow     ( 180, 100  ) ;
 
491
  glutDisplayFunc       ( displayfn ) ;
 
492
  glutKeyboardFunc      ( keyfn     ) ;
 
493
  glutSpecialFunc       ( specialfn ) ;
 
494
  glutMouseFunc         ( mousefn   ) ;
 
495
  glutMotionFunc        ( motionfn  ) ;
 
496
#ifdef VOODOO
 
497
  glutPassiveMotionFunc ( motionfn  ) ;
 
498
#endif
 
499
 
 
500
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
 
501
 
 
502
  char *list_box_entries [] = { "First Entry", "Second Entry", "Third Entry", "Very long Entry that will get truncated", NULL } ;
 
503
  list_box = new puListBox ( 10, 10, 130, 80, list_box_entries ) ;
 
504
  list_box->setLabel ( "Label" ) ;
 
505
 
 
506
 
 
507
  file_selector_window = glutCreateWindow      ( "File Selector Window"  ) ;
 
508
  glutPositionWindow    ( 200, 100 ) ;
 
509
  glutReshapeWindow     ( 300,  220 ) ;
 
510
  glutDisplayFunc       ( displayfn ) ;
 
511
  glutKeyboardFunc      ( keyfn     ) ;
 
512
  glutSpecialFunc       ( specialfn ) ;
 
513
  glutMouseFunc         ( mousefn   ) ;
 
514
  glutMotionFunc        ( motionfn  ) ;
 
515
#ifdef VOODOO
 
516
  glutPassiveMotionFunc ( motionfn  ) ;
 
517
#endif
 
518
 
 
519
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
 
520
 
 
521
  file_selector = new puFileSelector ( 10, 10, 280, 200, "." ) ;
 
522
 
417
523
 
418
524
  bislider_window = glutCreateWindow      ( "BiSlider Window"  ) ;
419
525
  glutPositionWindow    ( 200, 100 ) ;
423
529
  glutSpecialFunc       ( specialfn ) ;
424
530
  glutMouseFunc         ( mousefn   ) ;
425
531
  glutMotionFunc        ( motionfn  ) ;
 
532
#ifdef VOODOO
426
533
  glutPassiveMotionFunc ( motionfn  ) ;
427
 
  glutIdleFunc          ( displayfn ) ;
428
 
 
429
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
430
 
 
431
 
  bislider = new puBiSlider ( 10, 10, 120, 0 ) ;
 
534
#endif
 
535
 
 
536
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
 
537
 
 
538
  bislider = new puBiSlider ( 10, 10, 120, FALSE ) ;
432
539
  bislider->setLabel ( "Label" ) ;
433
540
  bislider->setLegend ( "Legend" ) ;
434
541
  bislider->setMaxValue ( 20 ) ;
435
542
  bislider->setCurrentMin ( 4 ) ;
436
543
  bislider->setCurrentMax ( 15 ) ;
437
544
 
 
545
 
438
546
  trislider_window = glutCreateWindow      ( "TriSlider Window"  ) ;
439
547
  glutPositionWindow    ( 200, 100 ) ;
440
548
  glutReshapeWindow     ( 100,  200 ) ;
443
551
  glutSpecialFunc       ( specialfn ) ;
444
552
  glutMouseFunc         ( mousefn   ) ;
445
553
  glutMotionFunc        ( motionfn  ) ;
 
554
#ifdef VOODOO
446
555
  glutPassiveMotionFunc ( motionfn  ) ;
447
 
  glutIdleFunc          ( displayfn ) ;
448
 
 
449
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
450
 
 
451
 
  trislider = new puTriSlider ( 20, 10, 180, 1 ) ;
 
556
#endif
 
557
 
 
558
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
 
559
 
 
560
  trislider = new puTriSlider ( 20, 10, 180, TRUE ) ;
452
561
  trislider->setLabel ( "Label" ) ;
453
562
  trislider->setLegend ( "Legend" ) ;
454
563
  trislider->setMaxValue ( 20 ) ;
456
565
  trislider->setCurrentMax ( 15 ) ;
457
566
  trislider->setValue ( 12 ) ;
458
567
 
 
568
 
459
569
  vertical_menu_window = glutCreateWindow      ( "Vertical Menu Window"  ) ;
460
570
  glutPositionWindow    ( 200, 100 ) ;
461
571
  glutReshapeWindow     ( 180,  200 ) ;
464
574
  glutSpecialFunc       ( specialfn ) ;
465
575
  glutMouseFunc         ( mousefn   ) ;
466
576
  glutMotionFunc        ( motionfn  ) ;
 
577
#ifdef VOODOO
467
578
  glutPassiveMotionFunc ( motionfn  ) ;
468
 
  glutIdleFunc          ( displayfn ) ;
 
579
#endif
469
580
 
470
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
581
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
471
582
 
472
583
  vertical_menu = new puVerticalMenu () ;
473
584
  {
476
587
    vertical_menu -> add_submenu ( "Help", help_submenu, help_submenu_cb ) ;
477
588
  }
478
589
  vertical_menu -> close () ; 
479
 
  vertical_menu->setLabel ( "Label" ) ;
480
 
  vertical_menu->setLegend ( "Legend" ) ;
 
590
 
481
591
 
482
592
  dialog_box_window = glutCreateWindow      ( "Dialog Box Window"  ) ;
483
593
  glutPositionWindow    ( 200, 100 ) ;
487
597
  glutSpecialFunc       ( specialfn ) ;
488
598
  glutMouseFunc         ( mousefn   ) ;
489
599
  glutMotionFunc        ( motionfn  ) ;
 
600
#ifdef VOODOO
490
601
  glutPassiveMotionFunc ( motionfn  ) ;
491
 
  glutIdleFunc          ( displayfn ) ;
 
602
#endif
492
603
 
493
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
604
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
494
605
 
495
606
  dialog_box = new puDialogBox ( 10, 10 ) ;
496
 
  dialog_box->setLabel ( "Label" ) ;
497
 
  dialog_box->setLegend ( "Legend" ) ;
498
607
  new puOneShot ( 20, 20, "OK" ) ;
499
608
  new puOneShot ( 100, 20, "Cancel" ) ;
500
609
  puText *dialog_text = new puText ( 20, 60 ) ;
502
611
  dialog_box->close () ;
503
612
  dialog_box->reveal () ;
504
613
 
 
614
 
505
615
  large_input_window = glutCreateWindow      ( "Large Input Window"  ) ;
506
616
  glutPositionWindow    ( 200, 100 ) ;
507
617
  glutReshapeWindow     ( 300,  200 ) ;
510
620
  glutSpecialFunc       ( specialfn ) ;
511
621
  glutMouseFunc         ( mousefn   ) ;
512
622
  glutMotionFunc        ( motionfn  ) ;
 
623
#ifdef VOODOO
513
624
  glutPassiveMotionFunc ( motionfn  ) ;
514
 
  glutIdleFunc          ( displayfn ) ;
 
625
#endif
515
626
 
516
 
  tim -> load ( "../fnt/data/times_bold.txf" ) ;
 
627
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
517
628
 
518
629
  large_input = new puLargeInput ( 10, 10, 240, 180, 2, 20 ) ;
519
630
  large_input->setLabel ( "Label" ) ;
520
 
  large_input->setLegend ( "Legend" ) ;
521
631
  large_input->setText ( "This is text in the Large Input widget.\n"
522
632
                         "This is a second line of text" ) ;
523
633
 
 
634
 
 
635
  combo_box_window = glutCreateWindow      ( "Combo Box window"  ) ;
 
636
  glutPositionWindow    ( 200, 100 ) ;
 
637
  glutReshapeWindow     ( 300,  200 ) ;
 
638
  glutDisplayFunc       ( displayfn ) ;
 
639
  glutKeyboardFunc      ( keyfn     ) ;
 
640
  glutSpecialFunc       ( specialfn ) ;
 
641
  glutMouseFunc         ( mousefn   ) ;
 
642
  glutMotionFunc        ( motionfn  ) ;
 
643
#ifdef VOODOO
 
644
  glutPassiveMotionFunc ( motionfn  ) ;
 
645
#endif
 
646
 
 
647
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
 
648
 
 
649
  char *combo_box_entries [] = { "First Entry", "Second Entry", "Third Entry", "Fourth Entry", "Sixth Entry", "Seventh Entry", NULL } ;
 
650
  combo_box = new puComboBox ( 10, 158, 250, 190,
 
651
                               combo_box_entries ) ;
 
652
  /* Don't do that in your own application ! */
 
653
  combo_box -> __getPopupMenu() -> reveal() ;
 
654
  combo_box->setLabel ( "Label" ) ;
 
655
 
 
656
 
 
657
  select_box_window = glutCreateWindow      ( "Select Box window"  ) ;
 
658
  glutPositionWindow    ( 200, 100 ) ;
 
659
  glutReshapeWindow     ( 300, 60   ) ;
 
660
  glutDisplayFunc       ( displayfn ) ;
 
661
  glutKeyboardFunc      ( keyfn     ) ;
 
662
  glutSpecialFunc       ( specialfn ) ;
 
663
  glutMouseFunc         ( mousefn   ) ;
 
664
  glutMotionFunc        ( motionfn  ) ;
 
665
#ifdef VOODOO
 
666
  glutPassiveMotionFunc ( motionfn  ) ;
 
667
#endif
 
668
 
 
669
  //tim -> load ( "../fnt/data/old/times_bold.txf" ) ;
 
670
 
 
671
  glEnable ( GL_BLEND ) ;
 
672
  glAlphaFunc ( GL_GEQUAL, 0.1f ) ;
 
673
  glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
 
674
 
 
675
  select_box = new puSelectBox ( 10, 14, 250, 46,
 
676
                                 combo_box_entries ) ;
 
677
  select_box->setLabel ( "Label" ) ;
 
678
 
524
679
  glutMainLoop () ;
525
680
  return 0 ;
526
681
}