1 /* dialogs-Xaw.c --- Athena widgets for demo, options, and password dialogs.
2 * xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@jwz.org>
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation. No representations are made about the suitability of this
9 * software for any purpose. It is provided "as is" without express or
12 * Most of this code contributed by Jon A. Christopher <jac8782@tamu.edu>
13 * Copyright 1997, with the same permissions as above.
20 #include <X11/Intrinsic.h>
21 #include <X11/StringDefs.h>
22 #include <X11/Shell.h>
23 #include <X11/Xaw/Form.h>
24 #include <X11/Xaw/Box.h>
25 #include <X11/Xaw/List.h>
26 #include <X11/Xaw/Command.h>
27 #include <X11/Xaw/Toggle.h>
28 #include <X11/Xaw/Viewport.h>
29 #include <X11/Xaw/Dialog.h>
30 #include <X11/Xaw/AsciiText.h>
34 #include "visual.h" /* for visual_depth() */
41 /*Widget passwd_text;*/
42 /*Widget passwd_done;*/
43 /*Widget passwd_cancel;*/
45 Widget resources_dialog;
46 Widget resources_form;
51 Widget lock_time_text;
52 Widget passwd_time_text;
53 Widget verbose_toggle;
78 Widget splash_roger_label;
85 static Widget buttonbox, textbox, okbox;
89 create_passwd_dialog(Widget parent, Visual *visual, Colormap colormap)
91 Widget box, passwd_label2;
92 int depth = visual_depth(XtScreen(parent), visual);
95 XtVaCreatePopupShell("passwd_dialog", transientShellWidgetClass, parent,
97 XtNoverrideRedirect, TRUE,
99 XtNcolormap, colormap,
103 box = XtVaCreateManagedWidget("box", formWidgetClass, passwd_dialog,
104 XtNleft, XtChainLeft,
105 XtNright, XtChainRight,
107 XtNbottom, XtChainBottom,
109 XtNcolormap, colormap,
113 roger_label = XtVaCreateManagedWidget("roger", labelWidgetClass, box,
115 XtNleft, XtChainLeft,
116 XtNright, XtChainRight,
120 passwd_label1 = XtVaCreateManagedWidget("label1", labelWidgetClass, box,
121 XtNfromHoriz, roger_label,
122 XtNright, XtChainRight,
125 passwd_label2 = XtVaCreateManagedWidget("label2", labelWidgetClass, box,
126 XtNfromHoriz, roger_label,
127 XtNright, XtChainRight,
128 XtNfromVert, passwd_label1,
130 passwd_label3 = XtVaCreateManagedWidget("label3", labelWidgetClass, box,
131 XtNfromHoriz, roger_label,
132 XtNright, XtChainRight,
133 XtNfromVert, passwd_label2,
137 XtVaCreateManagedWidget("passwd_form", dialogWidgetClass, box,
138 XtNfromHoriz, roger_label,
139 XtNright, XtChainRight,
140 XtNfromVert, passwd_label3,
146 create_resources_dialog(Widget parent, Visual *visual, Colormap colormap)
149 int depth = visual_depth(XtScreen(parent), visual);
152 XtVaCreatePopupShell("resources_dialog", transientShellWidgetClass, parent,
154 XtNoverrideRedirect, TRUE,
156 XtNcolormap, colormap,
161 XtVaCreateManagedWidget("resources_form", formWidgetClass,
164 XtNcolormap, colormap,
168 rlabel = XtVaCreateManagedWidget("label1", labelWidgetClass, resources_form,
169 XtNleft, XtChainLeft,
170 XtNright, XtChainRight,
175 XtVaCreateManagedWidget("textbox", formWidgetClass, resources_form,
176 XtNleft, XtChainLeft,
180 XtVaCreateManagedWidget("textbox", boxWidgetClass, resources_form,
181 XtNleft, XtChainLeft,
182 XtNright, XtChainRight,
183 XtNfromVert, textbox,
184 XtNorientation, XtorientHorizontal,
187 XtVaCreateManagedWidget("timeout", dialogWidgetClass, textbox,
188 XtNleft, XtChainLeft,
189 XtNright, XtChainRight,
193 XtVaCreateManagedWidget("cycle", dialogWidgetClass, textbox,
194 XtNleft, XtChainLeft,
195 XtNright, XtChainRight,
196 XtNfromVert, timeout_text,
199 XtVaCreateManagedWidget("fade", dialogWidgetClass, textbox,
200 XtNleft, XtChainLeft,
201 XtNright, XtChainRight,
202 XtNfromVert, cycle_text,
206 XtVaCreateManagedWidget("ticks", dialogWidgetClass, textbox,
208 XtNright, XtChainRight,
209 XtNfromHoriz, timeout_text,
213 XtVaCreateManagedWidget("lockTime", dialogWidgetClass, textbox,
214 XtNfromVert, ticks_text,
215 XtNright, XtChainRight,
216 XtNfromHoriz, cycle_text,
220 XtVaCreateManagedWidget("passwdTime", dialogWidgetClass, textbox,
221 XtNfromVert, lock_time_text,
222 XtNright, XtChainRight,
223 XtNfromHoriz, fade_text,
227 XtVaCreateManagedWidget("buttonbox", boxWidgetClass, resources_form,
229 XtNfromHoriz, textbox,
230 XtNright, XtChainRight,
231 XtNorientation, XtorientVertical,
234 XtVaCreateManagedWidget("verbose", toggleWidgetClass, buttonbox,
237 XtVaCreateManagedWidget("cmap", toggleWidgetClass, buttonbox,
240 XtVaCreateManagedWidget("fade", toggleWidgetClass, buttonbox,
243 XtVaCreateManagedWidget("unfade", toggleWidgetClass, buttonbox,
246 XtVaCreateManagedWidget("lock", toggleWidgetClass, buttonbox,
250 res_done = XtVaCreateManagedWidget("done", commandWidgetClass, okbox,
252 res_cancel = XtVaCreateManagedWidget("cancel", commandWidgetClass, okbox,
257 create_demo_dialog(Widget parent, Visual *visual, Colormap colormap)
259 Widget subform, box, viewport, label2;
260 int depth = visual_depth(XtScreen(parent), visual);
263 XtVaCreatePopupShell("demo_dialog", transientShellWidgetClass, parent,
265 XtNoverrideRedirect, TRUE,
267 XtNcolormap, colormap,
272 XtVaCreateManagedWidget("demo_form", formWidgetClass, demo_dialog,
274 XtNcolormap, colormap,
278 label1 = XtVaCreateManagedWidget("label1", labelWidgetClass, demo_form,
279 XtNleft, XtChainLeft,
280 XtNright, XtChainRight,
284 label2 = XtVaCreateManagedWidget("label2", labelWidgetClass, demo_form,
285 XtNleft, XtChainLeft,
286 XtNright, XtChainRight,
291 XtVaCreateManagedWidget("subform", formWidgetClass, demo_form,
292 XtNleft, XtChainLeft,
293 XtNright, XtChainRight,
297 XtVaCreateManagedWidget("viewport", viewportWidgetClass, subform,
299 XtNleft, XtChainLeft,
300 XtNright, XtChainRight,
306 demo_list = XtVaCreateManagedWidget("demo_list", listWidgetClass, viewport,
307 XtNverticalList, TRUE,
308 XtNdefaultColumns, 1,
311 text_line = XtVaCreateManagedWidget("text", asciiTextWidgetClass, subform,
312 XtNleft, XtChainLeft,
313 XtNright, XtChainRight,
314 XtNfromVert, viewport,
315 XtNbottom, XtChainBottom,
316 XtNeditType, XawtextEdit,
320 XtVaCreateManagedWidget("box", boxWidgetClass, demo_form,
321 XtNleft, XtChainLeft,
322 XtNfromVert, subform,
323 XtNbottom, XtChainBottom,
324 XtNright, XtChainRight,
325 XtNorientation, XtEhorizontal,
327 next = XtVaCreateManagedWidget("next", commandWidgetClass, box, NULL);
328 prev = XtVaCreateManagedWidget("prev", commandWidgetClass, box, NULL);
329 edit = XtVaCreateManagedWidget("edit", commandWidgetClass, box, NULL);
330 restart = XtVaCreateManagedWidget("restart", commandWidgetClass, box, NULL);
331 done = XtVaCreateManagedWidget("done", commandWidgetClass, box, NULL);
336 create_splash_dialog(Widget parent, Visual *visual, Colormap colormap)
338 Widget box, splash_label2;
339 int depth = visual_depth(XtScreen(parent), visual);
342 XtVaCreatePopupShell("splash_dialog", transientShellWidgetClass, parent,
344 XtNoverrideRedirect, TRUE,
346 XtNcolormap, colormap,
350 box = XtVaCreateManagedWidget("box", formWidgetClass, splash_dialog,
351 XtNleft, XtChainLeft,
352 XtNright, XtChainRight,
354 XtNbottom, XtChainBottom,
356 XtNcolormap, colormap,
360 splash_roger_label = XtVaCreateManagedWidget("roger", labelWidgetClass, box,
362 XtNleft, XtChainLeft,
363 XtNright, XtChainRight,
367 splash_label1 = XtVaCreateManagedWidget("splashLabel1", labelWidgetClass,
369 XtNfromHoriz, splash_roger_label,
370 XtNright, XtChainRight,
373 splash_label2 = XtVaCreateManagedWidget("splashLabel2", labelWidgetClass,
375 XtNfromHoriz, splash_roger_label,
376 XtNright, XtChainRight,
377 XtNfromVert, splash_label1,
379 splash_label3 = XtVaCreateManagedWidget("splashLabel3", labelWidgetClass,
381 XtNfromHoriz, splash_roger_label,
382 XtNright, XtChainRight,
383 XtNfromVert, splash_label2,
387 XtVaCreateManagedWidget("splash_form", dialogWidgetClass, box,
388 XtNfromHoriz, splash_roger_label,
389 XtNright, XtChainRight,
390 XtNfromVert, splash_label3,