1 /* dialogs-Xaw.c --- Athena widgets for demo, options, and password dialogs.
2 * xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
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>
33 #include "visual.h" /* for visual_depth() */
40 /*Widget passwd_text;*/
41 /*Widget passwd_done;*/
42 /*Widget passwd_cancel;*/
44 Widget resources_dialog;
45 Widget resources_form;
50 Widget lock_time_text;
51 Widget passwd_time_text;
52 Widget verbose_toggle;
76 static Widget buttonbox, textbox, okbox;
80 create_passwd_dialog(Widget parent, Visual *visual, Colormap colormap)
82 Widget box, passwd_label2;
83 int depth = visual_depth(XtScreen(parent), visual);
86 XtVaCreatePopupShell("passwd_dialog", transientShellWidgetClass, parent,
88 XtNoverrideRedirect, TRUE,
90 XtNcolormap, colormap,
94 box = XtVaCreateManagedWidget("box", formWidgetClass, passwd_dialog,
96 XtNright, XtChainRight,
98 XtNbottom, XtChainBottom,
100 XtNcolormap, colormap,
104 roger_label = XtVaCreateManagedWidget("roger", labelWidgetClass, box,
106 XtNleft, XtChainLeft,
107 XtNright, XtChainRight,
111 passwd_label1 = XtVaCreateManagedWidget("label1", labelWidgetClass, box,
112 XtNfromHoriz, roger_label,
113 XtNright, XtChainRight,
116 passwd_label2 = XtVaCreateManagedWidget("label2", labelWidgetClass, box,
117 XtNfromHoriz, roger_label,
118 XtNright, XtChainRight,
119 XtNfromVert, passwd_label1,
121 passwd_label3 = XtVaCreateManagedWidget("label3", labelWidgetClass, box,
122 XtNfromHoriz, roger_label,
123 XtNright, XtChainRight,
124 XtNfromVert, passwd_label2,
128 XtVaCreateManagedWidget("passwd_form", dialogWidgetClass, box,
129 XtNfromHoriz, roger_label,
130 XtNright, XtChainRight,
131 XtNfromVert, passwd_label3,
137 create_resources_dialog(Widget parent, Visual *visual, Colormap colormap)
140 int depth = visual_depth(XtScreen(parent), visual);
143 XtVaCreatePopupShell("resources_dialog", transientShellWidgetClass, parent,
145 XtNoverrideRedirect, TRUE,
147 XtNcolormap, colormap,
152 XtVaCreateManagedWidget("resources_form", formWidgetClass,
155 XtNcolormap, colormap,
159 rlabel = XtVaCreateManagedWidget("label1", labelWidgetClass, resources_form,
160 XtNleft, XtChainLeft,
161 XtNright, XtChainRight,
166 XtVaCreateManagedWidget("textbox", formWidgetClass, resources_form,
167 XtNleft, XtChainLeft,
171 XtVaCreateManagedWidget("textbox", boxWidgetClass, resources_form,
172 XtNleft, XtChainLeft,
173 XtNright, XtChainRight,
174 XtNfromVert, textbox,
175 XtNorientation, XtorientHorizontal,
178 XtVaCreateManagedWidget("timeout", dialogWidgetClass, textbox,
179 XtNleft, XtChainLeft,
180 XtNright, XtChainRight,
184 XtVaCreateManagedWidget("cycle", dialogWidgetClass, textbox,
185 XtNleft, XtChainLeft,
186 XtNright, XtChainRight,
187 XtNfromVert, timeout_text,
190 XtVaCreateManagedWidget("fade", dialogWidgetClass, textbox,
191 XtNleft, XtChainLeft,
192 XtNright, XtChainRight,
193 XtNfromVert, cycle_text,
197 XtVaCreateManagedWidget("ticks", dialogWidgetClass, textbox,
199 XtNright, XtChainRight,
200 XtNfromHoriz, timeout_text,
204 XtVaCreateManagedWidget("lockTime", dialogWidgetClass, textbox,
205 XtNfromVert, ticks_text,
206 XtNright, XtChainRight,
207 XtNfromHoriz, cycle_text,
211 XtVaCreateManagedWidget("passwdTime", dialogWidgetClass, textbox,
212 XtNfromVert, lock_time_text,
213 XtNright, XtChainRight,
214 XtNfromHoriz, fade_text,
218 XtVaCreateManagedWidget("buttonbox", boxWidgetClass, resources_form,
220 XtNfromHoriz, textbox,
221 XtNright, XtChainRight,
222 XtNorientation, XtorientVertical,
225 XtVaCreateManagedWidget("verbose", toggleWidgetClass, buttonbox,
228 XtVaCreateManagedWidget("cmap", toggleWidgetClass, buttonbox,
231 XtVaCreateManagedWidget("fade", toggleWidgetClass, buttonbox,
234 XtVaCreateManagedWidget("unfade", toggleWidgetClass, buttonbox,
237 XtVaCreateManagedWidget("lock", toggleWidgetClass, buttonbox,
241 res_done = XtVaCreateManagedWidget("done", commandWidgetClass, okbox,
243 res_cancel = XtVaCreateManagedWidget("cancel", commandWidgetClass, okbox,
248 create_demo_dialog(Widget parent, Visual *visual, Colormap colormap)
250 Widget subform, box, viewport, label2;
251 int depth = visual_depth(XtScreen(parent), visual);
254 XtVaCreatePopupShell("demo_dialog", transientShellWidgetClass, parent,
256 XtNoverrideRedirect, TRUE,
258 XtNcolormap, colormap,
263 XtVaCreateManagedWidget("demo_form", formWidgetClass, demo_dialog,
265 XtNcolormap, colormap,
269 label1 = XtVaCreateManagedWidget("label1", labelWidgetClass, demo_form,
270 XtNleft, XtChainLeft,
271 XtNright, XtChainRight,
275 label2 = XtVaCreateManagedWidget("label2", labelWidgetClass, demo_form,
276 XtNleft, XtChainLeft,
277 XtNright, XtChainRight,
282 XtVaCreateManagedWidget("subform", formWidgetClass, demo_form,
283 XtNleft, XtChainLeft,
284 XtNright, XtChainRight,
286 XtNbottom, XtChainBottom,
289 XtVaCreateManagedWidget("viewport", viewportWidgetClass, subform,
295 demo_list = XtVaCreateManagedWidget("demo_list", listWidgetClass, viewport,
296 XtNverticalList, TRUE,
297 XtNdefaultColumns, 1,
300 XtVaCreateManagedWidget("box", boxWidgetClass, demo_form,
301 XtNfromHoriz, subform,
303 XtNbottom, XtChainBottom,
304 XtNright, XtChainRight,
306 prev = XtVaCreateManagedWidget("prev", commandWidgetClass, box, NULL);
307 next = XtVaCreateManagedWidget("next", commandWidgetClass, box, NULL);
308 edit = XtVaCreateManagedWidget("edit", commandWidgetClass, box, NULL);
309 restart = XtVaCreateManagedWidget("restart", commandWidgetClass, box, NULL);
310 done = XtVaCreateManagedWidget("done", commandWidgetClass, box, NULL);