File: VXDialog.c

package info (click to toggle)
via 1.6.0-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,480 kB
  • ctags: 2,266
  • sloc: ansic: 30,757; makefile: 101; sh: 46
file content (674 lines) | stat: -rwxr-xr-x 19,241 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
/*
 * $Id: VXDialog.c 3177 2008-04-01 14:47:24Z karstenm $
 *
 * This file contains VX dialog routines.
 *
 * [Thanks to Dan Heller (argv@sun.com)]
 */

/*
 *  Copyright 1993, 1994 University of British Columbia
 *
 *  Permission to use, copy, modify, distribute, and sell this software and its
 *  documentation for any purpose is hereby granted without fee, provided that
 *  the above copyright notice appears in all copies and that both that
 *  copyright notice and this permission notice appear in supporting
 *  documentation. UBC makes no representations about the suitability of this
 *  software for any purpose. It is provided "as is" without express or
 *  implied warranty.
 *
 *  Author: Daniel Ko, UBC Laboratory for Computational Intelligence
 */

/* From the Vista library: */
#include "viaio/Vlib.h"
#include "viaio/os.h"
#include "viaio/VImage.h"
#include "viaio/mu.h"
#include "viaio/VX.h"
#include "viaio/VXPrivate.h"

/* From X11R5 Xt and Motif: */
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#if defined(XtSpecificationRelease) && XtSpecificationRelease >= 5
#include <X11/Xmu/Editres.h>
#endif
#include <Xm/Xm.h>
#include <Xm/MessageB.h>
#include <Xm/SelectioB.h>
#include <Xm/FileSB.h>
#include <Xm/PushB.h>
#include <Xm/Form.h>
#include <Xm/DialogS.h>
#include <Xm/Text.h>

/* File identification string: */
VRcsId ("$Id: VXDialog.c 3177 2008-04-01 14:47:24Z karstenm $");


/* New Data type(s): */

/* Type: DialogRec
 *
 * Record for storing dialog related data.
 */
typedef struct {
    Widget fileBox;		/* file-selection dialog box */
    Widget warningBox;		/* warning dialog box */
} DialogRec;

/*
 * Type: VXInputResponse
 *
 * Record for storing user response to an input box.
 */
typedef struct {
    VBoolean responded;		/* TRUE iff user has responded */
    VString value;		/* user input */
} VXInputResponse;

/*
 * Type: VXYesNoResponse
 *
 * Record for storing user response to a yes-no box.
 */
typedef struct {
    VBoolean responded;		/* TRUE iff user has responded */
    VXAnswer value;		/* user response */
} VXYesNoResponse;

/*
 * Type: VXFileResponse
 *
 * Record for storing user response to a file box.
 */
typedef struct {
    VBoolean responded;		/* TRUE iff user has responded */
    VString value;		/* filename of the selected file */
} VXFileResponse;


/* Variable(s): */
static DialogRec l_dialog;


/* Function prototypes: */
static void MessageBoxCallback (Widget, XtPointer, XtPointer);
static void TextBoxCallback (Widget, XtPointer, XtPointer);
static void InputBoxCallback (Widget, XtPointer, XtPointer);
static void YesNoBoxCallback (Widget, XtPointer, XtPointer);
static void FileBoxCallback (Widget, XtPointer, XtPointer);
static void WarningBoxCallback (Widget, XtPointer, XtPointer);


/*
 * Extern: VX_InitDialog
 *
 * Initialize the dialog module.
 */

extern VBoolean VX_InitDialog (void)
{
    l_dialog.fileBox = NULL;
    return TRUE;
}


/*
 * Local: MessageBoxCallback
 *
 * Destroy the message box when the "Ok" button is pressed.
 */

static void MessageBoxCallback (Widget w, XtPointer client_data,
				XtPointer call_data)
{
    XtDestroyWidget (XtParent(w));
}


/*
 * Local: TextBoxCallback
 *
 * Destroy the text box when the "Close" button is pressed.
 */

static void TextBoxCallback (Widget w, XtPointer client_data,
			     XtPointer call_data)
{
    XtDestroyWidget (XtParent(XtParent(w)));
}


/*
 * Local: InputBoxCallback
 *
 * Store the user response when a button is pressed.
 */

static void InputBoxCallback (Widget w, XtPointer client_data,
			      XtPointer call_data)
{
    XmSelectionBoxCallbackStruct *callback_data;
    VXInputResponse *response;

    callback_data = (XmSelectionBoxCallbackStruct *) call_data;
    response = (VXInputResponse *) client_data;

    response->responded = TRUE;

    /* Check why this callback is invoked and act accordingly: */
    if (callback_data->reason == XmCR_OK) { /* "Ok" button is pressed. */

	/* Set the "value" field of "response" to the input string: */
	XmStringGetLtoR (callback_data->value, XmSTRING_DEFAULT_CHARSET,
			 (char **) &(response->value));

    } else { /* "Cancel" button is pressed. */

	/* Set the "value" field of "response" to "NULL"
	   to indicate "Cancel": */
	response->value = NULL;
    }
}


/*
 * Local: YesNoBoxCallback
 *
 * Store the user response when a button is pressed.
 */

static void YesNoBoxCallback (Widget w, XtPointer client_data,
			      XtPointer call_data)
{
    XmAnyCallbackStruct *callback_data;
    VXYesNoResponse *response;

    callback_data = (XmAnyCallbackStruct *) call_data;
    response = (VXYesNoResponse *) client_data;

    response->responded = TRUE;

    /* Check why this callback is invoked and act accordingly: */
    if (callback_data->reason == XmCR_OK)  {

	/* "Yes" button is pressed. */
	response->value = VXAyes;

    } else if (callback_data->reason == XmCR_CANCEL) {

	/* "No" button is pressed. */
	response->value = VXAno;

    } else {

	/* "Cancel" button is pressed: */
	response->value = VXAcancel;
    }
}

/*
 * Local: FileBoxCallback
 *
 * Store the user response when a button is pressed.
 */

static void FileBoxCallback (Widget w, XtPointer client_data,
			     XtPointer call_data)
{
    XmFileSelectionBoxCallbackStruct *callback_data;
    VXFileResponse *response;

    callback_data = (XmFileSelectionBoxCallbackStruct *) call_data;
    response = (VXFileResponse *) client_data;

    response->responded = TRUE;

    /* Check why this callback is invoked and act accordingly: */
    if (callback_data->reason == XmCR_OK) { /* "Ok" button is pressed. */

	/* Set the "value" field of "response" to the full path name
	   of the selected file: */
	XmStringGetLtoR (callback_data->value, XmSTRING_DEFAULT_CHARSET,
			 (char **) &(response->value));

    } else { /* "Cancel" button is pressed. */

	/* Set the "value" field of "response" to "NULL"
	   to indicate "Cancel": */
	response->value = NULL;
    }
}


/*
 * Local: WarningBoxCallback
 *
 * Notify that the user has responded.
 */

static void WarningBoxCallback (Widget w, XtPointer client_data,
				XtPointer call_data)
{
    VBoolean *responded;

    responded = (VBoolean *) client_data;
    *responded = TRUE;
}


/*
 * VXPopupMessageBox
 *
 * Popup a modeless message box to display a message.
 */

void VXPopupMessageBox (VStringConst title, VStringConst message)
{
    Widget msgBox, button;
    XmString title_str, message_str;

    if (! VX_App.initialized)
	VError ("VXPopupMessageBox: VX not initialized");

    if (!VX_App.in_main_loop)
	VError ("VXPopupMessageBox: Main event loop not started");

    /* Create a message dialog box: */
    msgBox = XmCreateMessageDialog (VX_App.x.topLevel, "messageBox",
				    NULL, 0);

    /* Participate in the Editres Protocol: */
#if defined(XtSpecificationRelease) && XtSpecificationRelease >= 5
    XtAddEventHandler (XtParent (msgBox), (EventMask)0,
		       True, _XEditResCheckMessages, NULL);
#endif

    /* Set the title and message string: */
    title_str = XmStringCreateLtoR ((char *) title, XmSTRING_DEFAULT_CHARSET);
    message_str =
	XmStringCreateLtoR ((char *) message, XmSTRING_DEFAULT_CHARSET);
    XtVaSetValues (msgBox,
		   XmNautoUnmanage, FALSE,
		   XmNmessageString, message_str,
		   XmNdialogTitle, title_str,
		   (char *) NULL);
    XmStringFree (title_str);
    XmStringFree (message_str);

    /* Add a callback to be invoked when the "Ok" button is pressed: */
    XtAddCallback (msgBox, XmNokCallback, MessageBoxCallback, NULL);

    /* Do not display the "Help" and "Cancel" buttons: */
    button = XmMessageBoxGetChild (msgBox, XmDIALOG_CANCEL_BUTTON);
    XtUnmanageChild (button);
    button = XmMessageBoxGetChild (msgBox, XmDIALOG_HELP_BUTTON);
    XtUnmanageChild (button);

    /* Popup the message box: */
    XtManageChild (msgBox);
}


/*
 * VXPopupTextBox
 *
 * Popup a modeless text box to display a piece of text.
 */

void VXPopupTextBox (int nrows, int ncolumns, VStringConst title,
		     VStringConst text)
{
    Widget textArea, textBox, button, form;
    XmString title_str, close_str;

    if (! VX_App.initialized)
	VError ("VXPopupTextBox: VX not initialized");

    if (!VX_App.in_main_loop)
	VError ("VXPopupTextBox: Main event loop not started");

    /* Create a dialog shell: */
    textBox = XmCreateDialogShell (VX_App.x.topLevel, "textBox", NULL, 0);

    /* Participate in the Editres Protocol: */
#if defined(XtSpecificationRelease) && XtSpecificationRelease >= 5
    XtAddEventHandler (textBox, (EventMask)0,
		       True, _XEditResCheckMessages, NULL);
#endif

    /* Create a form to hold the text widget and the "Close" button widget: */
    title_str = XmStringCreateLtoR ((char *)title, XmSTRING_DEFAULT_CHARSET);
    form = XtVCW ("form", xmFormWidgetClass, textBox,
		  XmNdialogTitle, title_str,
		  XmNfractionBase, 100, (char *) NULL);
    XmStringFree (title_str);

    /* Create a text widget as a child of a scrolled window: */
    textArea = XmCreateScrolledText (form, "textArea", NULL, 0);

    /* Set the text string and display mode of the text widget: */
    XtVSV (textArea,
	   XmNrows, (short) nrows,
	   XmNcolumns, (short) ncolumns,
	   XmNvalue, text,
	   XmNeditable, FALSE,
	   XmNeditMode, XmMULTI_LINE_EDIT,
	   XmNcursorPositionVisible, FALSE, (char *) NULL);

    /* Set the layout of the scrolled window: */
    XtVSV (XtParent(textArea),
	   XmNtopAttachment, XmATTACH_FORM,
	   XmNtopOffset, 2,
	   XmNleftAttachment, XmATTACH_FORM,
	   XmNleftOffset, 2,
	   XmNrightAttachment, XmATTACH_FORM,
	   XmNrightOffset, 2,
	   XmNbottomAttachment, XmATTACH_FORM,
	   XmNbottomOffset, 50, (char *) NULL);

    /* Create the "Close" button: */
    close_str = XmStringCreateLtoR ("Close", XmSTRING_DEFAULT_CHARSET);
    button = XtVCMW ("closeButton",
		     xmPushButtonWidgetClass,
		     form,
		     XmNlabelString, close_str,
		     XmNleftAttachment, XmATTACH_POSITION,
		     XmNleftPosition, 45,
		     XmNtopAttachment, XmATTACH_WIDGET,
		     XmNtopWidget, XtParent(textArea),
		     XmNtopOffset, 10, (char *) NULL);
    XmStringFree (close_str);

    /* Add a callback to be invoked when the "Close" button is pressed: */
    XtAddCallback (button, XmNactivateCallback, TextBoxCallback, NULL);

    /* Display the text dialog box: */
    XtManageChild (textArea);
    XtManageChild (form);
}


/*
 * VXPopupInputBox
 *
 * Popup a modal input box for inputting a string.
 */

VString VXPopupInputBox (VStringConst title, VStringConst prompt,
			 VStringConst text)
{
    Widget inputBox, button;
    XmString title_str, prompt_str, text_str;
    static VXInputResponse response;

    if (! VX_App.initialized)
	VError ("VXPopupInputBox: VX not initialized");

    if (!VX_App.in_main_loop)
	VError ("VXPopupInputBox: Main event loop not started");

    /* Use has not responded yet: */
    response.responded = FALSE;

    /* Create the input box: */
    inputBox = XmCreatePromptDialog (VX_App.x.topLevel, "inputBox", NULL, 0);

    /* Participate in the Editres Protocol: */
#if defined(XtSpecificationRelease) && XtSpecificationRelease >= 5
    XtAddEventHandler (XtParent (inputBox), (EventMask)0,
		       True, _XEditResCheckMessages, NULL);
#endif

    /* Add a callback to be invoked when the "Cancel" button is pressed: */
    XtAddCallback (inputBox, XmNcancelCallback, InputBoxCallback, & response);

    /* Add a callback to be invoked when the "Ok" button is pressed: */
    XtAddCallback (inputBox, XmNokCallback, InputBoxCallback, & response);

    /* Do not display the "Help" button: */
    button = XmSelectionBoxGetChild (inputBox, XmDIALOG_HELP_BUTTON);
    XtUnmanageChild (button);

    /* Set the title, prompt, and default input: */
    title_str = XmStringCreateLtoR ((char *)title, XmSTRING_DEFAULT_CHARSET);
    prompt_str = XmStringCreateLtoR ((char *)prompt, XmSTRING_DEFAULT_CHARSET);
    text_str = XmStringCreateLtoR ((char *)text, XmSTRING_DEFAULT_CHARSET);
    XtVSV (inputBox,
	   XmNautoUnmanage, FALSE,
	   XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
	   XmNdialogTitle, title_str,
	   XmNselectionLabelString, prompt_str,
	   XmNtextString, text_str, (char *) NULL);
    XmStringFree (title_str);
    XmStringFree (prompt_str);
    XmStringFree (text_str);

    /* Display the inputBox: */
    XtManageChild (inputBox);

    /* Wait until the user had responed: */
    while (response.responded != TRUE || XtAppPending (VX_App.x.appContext))
	XtAppProcessEvent (VX_App.x.appContext, XtIMAll);

    /* Destroy the inputBox: */
    XtDestroyWidget (XtParent (inputBox));

    return response.value;
}


/*
 * VXPopupYesNoBox
 *
 * Popup a modal yes-no box for inputting a yes/no answer.
 */

VXAnswer VXPopupYesNoBox (VStringConst title, VStringConst question)
{
    Widget yesNoBox;
    XmString title_str, question_str, yes_str, no_str, cancel_str;
    static VXYesNoResponse response;

    if (! VX_App.initialized)
	VError ("VXPopupYesNoBox: VX not initialized");

    if (!VX_App.in_main_loop)
	VError ("VXPopupYesNoBox: Main event loop not started");

    /* User has not responded yet: */
    response.responded = FALSE;

    /* Create the yes-no box: */
    yesNoBox = XmCreateQuestionDialog (VX_App.x.topLevel, "yesNoBox", NULL, 0);

    /* Participate in the Editres Protocol: */
#if defined(XtSpecificationRelease) && XtSpecificationRelease >= 5
    XtAddEventHandler (XtParent (yesNoBox), (EventMask)0,
		       True, _XEditResCheckMessages, NULL);
#endif

    /* Add a callback to be invoked when any button is pressed: */
    XtAddCallback (yesNoBox, XmNokCallback, YesNoBoxCallback, & response);
    XtAddCallback (yesNoBox, XmNcancelCallback, YesNoBoxCallback, & response);
    XtAddCallback (yesNoBox, XmNhelpCallback, YesNoBoxCallback, & response);

    /* Set the title, question, and button labels: */
    title_str = XmStringCreateLtoR ((char *)title, XmSTRING_DEFAULT_CHARSET);
    question_str = XmStringCreateLtoR ((char *)question,
				       XmSTRING_DEFAULT_CHARSET);
    yes_str = XmStringCreateLtoR ("Yes", XmSTRING_DEFAULT_CHARSET);
    no_str = XmStringCreateLtoR ("No", XmSTRING_DEFAULT_CHARSET);
    cancel_str = XmStringCreateLtoR ("Cancel", XmSTRING_DEFAULT_CHARSET);
    XtVSV (yesNoBox,
	   XmNautoUnmanage, FALSE,
	   XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
	   XmNdialogTitle, title_str,
	   XmNmessageString, question_str,
	   XmNokLabelString, yes_str,
	   XmNcancelLabelString, no_str,
	   XmNhelpLabelString, cancel_str, (char *) NULL);
    XmStringFree (title_str);
    XmStringFree (question_str);
    XmStringFree (yes_str);
    XmStringFree (no_str);
    XmStringFree (cancel_str);

    /* Display the yes-no box: */
    XtManageChild (yesNoBox);

    /* Wait until the user has responded: */
    while (response.responded != TRUE || XtAppPending (VX_App.x.appContext))
	XtAppProcessEvent (VX_App.x.appContext, XtIMAll);

    /* Destroy the yes-no box: */
    XtDestroyWidget (XtParent (yesNoBox));

    return response.value;
}


/*
 * VXPopupFileBox
 *
 * Popup a modal file selection box.
 */

VString VXPopupFileBox (VStringConst title)
{
    Widget button;
    XmString title_str;
    static VXFileResponse response;

    if (! VX_App.initialized)
	VError ("VXPopupFileBox: VX not initialized");

    if (!VX_App.in_main_loop)
	VError ("VXPopupFileBox: Main event loop not started");

    /* User has not responded yet: */
    response.responded = FALSE;

    /* Create the file selection box if not yet created: */
    if (l_dialog.fileBox == NULL) {

	/* Display busy cursor: */
	if (XtIsRealized (VX_App.x.topLevel))
	    XMapWindow (XtDisplay(VX_App.x.topLevel), VX_App.x.busyWindow);
	XSync (XtDisplay(VX_App.x.topLevel), FALSE);

	/* Create dialog shell and file-selection box: */
	l_dialog.fileBox =
	    XmCreateFileSelectionDialog (VX_App.x.topLevel, "fileBox",
					 NULL, 0);

	/* Participate in the Editres Protocol: */
#if defined(XtSpecificationRelease) && XtSpecificationRelease >= 5
	XtAddEventHandler (XtParent (l_dialog.fileBox), (EventMask)0,
			   True, _XEditResCheckMessages, NULL);
#endif

	/* Add a callback to be invoked when any button is pressed: */
	XtAddCallback (l_dialog.fileBox, XmNcancelCallback, FileBoxCallback,
		       & response);
	XtAddCallback (l_dialog.fileBox, XmNokCallback, FileBoxCallback,
		       & response);

	/* Do not display the "Help" button: */
	button = XmFileSelectionBoxGetChild (l_dialog.fileBox,
					     XmDIALOG_HELP_BUTTON);
	XtUnmanageChild (button);

	/* Hide busy cursor: */
	if (XtIsRealized (VX_App.x.topLevel))
	    XUnmapWindow (XtDisplay(VX_App.x.topLevel), VX_App.x.busyWindow);
    }

    /* Set the title and other resources: */
    title_str = XmStringCreateLtoR ((char *)title, XmSTRING_DEFAULT_CHARSET);
    XtVSV (l_dialog.fileBox,
	   XmNautoUnmanage, FALSE,
	   XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
	   XmNdialogTitle, title_str, (char *) NULL);
    XmStringFree (title_str);

    /* Display the file selection box: */
    XtManageChild (l_dialog.fileBox);

    /* Wait until the user has responded: */
    while (response.responded != TRUE || XtAppPending (VX_App.x.appContext))
	XtAppProcessEvent (VX_App.x.appContext, XtIMAll);

    /* Hide the file selection box: */
    XtUnmanageChild (l_dialog.fileBox);

    return response.value;
}


/*
 * VX_Warning
 *
 * Internal routine to popup a modal dialog box displaying a warning message.
 */

void VX_Warning (VStringConst message)
{
    Widget button;
    XmString str;
    static VBoolean responded;

    /* User has not responded yet: */
    responded = FALSE;

    /* Create the warning box if not yet created: */
    if (! l_dialog.warningBox) {

	l_dialog.warningBox =
	    XmCreateWarningDialog (VX_App.x.topLevel, "warningBox", NULL, 0);

	/* Participate in the Editres Protocol: */
#if defined(XtSpecificationRelease) && XtSpecificationRelease >= 5
	XtAddEventHandler (XtParent (l_dialog.warningBox), (EventMask)0,
			   True, _XEditResCheckMessages, NULL);
#endif

	/* Add a callback to be invoked when the "Ok" button is pressed: */
	XtAddCallback (l_dialog.warningBox, XmNokCallback,
		       WarningBoxCallback, (XtPointer) &responded);

	/* Do not display the "Help" and "Cancel" buttons: */
	button = XmMessageBoxGetChild (l_dialog.warningBox,
				       XmDIALOG_CANCEL_BUTTON);
	XtUnmanageChild (button);
	button = XmMessageBoxGetChild (l_dialog.warningBox,
				       XmDIALOG_HELP_BUTTON);
	XtUnmanageChild (button);

	/* Set the title string: */
	str = XmStringCreateLtoR ("Warning", XmSTRING_DEFAULT_CHARSET);
	XtVSV (l_dialog.warningBox,
	       XmNdialogStyle, XmDIALOG_APPLICATION_MODAL,
	       XmNautoUnmanage, FALSE,
	       XmNdialogTitle, str, (char *) NULL);
	XmStringFree (str);
    }


    /* Set the message string: */
    str = XmStringCreateLtoR ((char *) message, XmSTRING_DEFAULT_CHARSET);
    XtVSV (l_dialog.warningBox, XmNmessageString, str, (char *) NULL);
    XmStringFree (str);

    /* Display the warning box: */
    XtManageChild (l_dialog.warningBox);

    /* Wait until the user has responded: */
    while (responded != TRUE || XtAppPending (VX_App.x.appContext))
	XtAppProcessEvent (VX_App.x.appContext, XtIMAll);

    /* Hide the warning box: */
    XtUnmanageChild (l_dialog.warningBox);
}