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>
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;
77 static Widget buttonbox, textbox, okbox;
81 create_passwd_dialog(Widget parent, Visual *visual, Colormap colormap)
83 Widget box, passwd_label2;
84 int depth = visual_depth(XtScreen(parent), visual);
87 XtVaCreatePopupShell("passwd_dialog", transientShellWidgetClass, parent,
89 XtNoverrideRedirect, TRUE,
91 XtNcolormap, colormap,
95 box = XtVaCreateManagedWidget("box", formWidgetClass, passwd_dialog,
97 XtNright, XtChainRight,
99 XtNbottom, XtChainBottom,
101 XtNcolormap, colormap,
105 roger_label = XtVaCreateManagedWidget("roger", labelWidgetClass, box,
107 XtNleft, XtChainLeft,
108 XtNright, XtChainRight,
112 passwd_label1 = XtVaCreateManagedWidget("label1", labelWidgetClass, box,
113 XtNfromHoriz, roger_label,
114 XtNright, XtChainRight,
117 passwd_label2 = XtVaCreateManagedWidget("label2", labelWidgetClass, box,
118 XtNfromHoriz, roger_label,
119 XtNright, XtChainRight,
120 XtNfromVert, passwd_label1,
122 passwd_label3 = XtVaCreateManagedWidget("label3", labelWidgetClass, box,
123 XtNfromHoriz, roger_label,
124 XtNright, XtChainRight,
125 XtNfromVert, passwd_label2,
129 XtVaCreateManagedWidget("passwd_form", dialogWidgetClass, box,
130 XtNfromHoriz, roger_label,
131 XtNright, XtChainRight,
132 XtNfromVert, passwd_label3,
138 create_resources_dialog(Widget parent, Visual *visual, Colormap colormap)
141 int depth = visual_depth(XtScreen(parent), visual);
144 XtVaCreatePopupShell("resources_dialog", transientShellWidgetClass, parent,
146 XtNoverrideRedirect, TRUE,
148 XtNcolormap, colormap,
153 XtVaCreateManagedWidget("resources_form", formWidgetClass,
156 XtNcolormap, colormap,
160 rlabel = XtVaCreateManagedWidget("label1", labelWidgetClass, resources_form,
161 XtNleft, XtChainLeft,
162 XtNright, XtChainRight,
167 XtVaCreateManagedWidget("textbox", formWidgetClass, resources_form,
168 XtNleft, XtChainLeft,
172 XtVaCreateManagedWidget("textbox", boxWidgetClass, resources_form,
173 XtNleft, XtChainLeft,
174 XtNright, XtChainRight,
175 XtNfromVert, textbox,
176 XtNorientation, XtorientHorizontal,
179 XtVaCreateManagedWidget("timeout", dialogWidgetClass, textbox,
180 XtNleft, XtChainLeft,
181 XtNright, XtChainRight,
185 XtVaCreateManagedWidget("cycle", dialogWidgetClass, textbox,
186 XtNleft, XtChainLeft,
187 XtNright, XtChainRight,
188 XtNfromVert, timeout_text,
191 XtVaCreateManagedWidget("fade", dialogWidgetClass, textbox,
192 XtNleft, XtChainLeft,
193 XtNright, XtChainRight,
194 XtNfromVert, cycle_text,
198 XtVaCreateManagedWidget("ticks", dialogWidgetClass, textbox,
200 XtNright, XtChainRight,
201 XtNfromHoriz, timeout_text,
205 XtVaCreateManagedWidget("lockTime", dialogWidgetClass, textbox,
206 XtNfromVert, ticks_text,
207 XtNright, XtChainRight,
208 XtNfromHoriz, cycle_text,
212 XtVaCreateManagedWidget("passwdTime", dialogWidgetClass, textbox,
213 XtNfromVert, lock_time_text,
214 XtNright, XtChainRight,
215 XtNfromHoriz, fade_text,
219 XtVaCreateManagedWidget("buttonbox", boxWidgetClass, resources_form,
221 XtNfromHoriz, textbox,
222 XtNright, XtChainRight,
223 XtNorientation, XtorientVertical,
226 XtVaCreateManagedWidget("verbose", toggleWidgetClass, buttonbox,
229 XtVaCreateManagedWidget("cmap", toggleWidgetClass, buttonbox,
232 XtVaCreateManagedWidget("fade", toggleWidgetClass, buttonbox,
235 XtVaCreateManagedWidget("unfade", toggleWidgetClass, buttonbox,
238 XtVaCreateManagedWidget("lock", toggleWidgetClass, buttonbox,
242 res_done = XtVaCreateManagedWidget("done", commandWidgetClass, okbox,
244 res_cancel = XtVaCreateManagedWidget("cancel", commandWidgetClass, okbox,
249 create_demo_dialog(Widget parent, Visual *visual, Colormap colormap)
251 Widget subform, box, viewport, label2;
252 int depth = visual_depth(XtScreen(parent), visual);
255 XtVaCreatePopupShell("demo_dialog", transientShellWidgetClass, parent,
257 XtNoverrideRedirect, TRUE,
259 XtNcolormap, colormap,
264 XtVaCreateManagedWidget("demo_form", formWidgetClass, demo_dialog,
266 XtNcolormap, colormap,
270 label1 = XtVaCreateManagedWidget("label1", labelWidgetClass, demo_form,
271 XtNleft, XtChainLeft,
272 XtNright, XtChainRight,
276 label2 = XtVaCreateManagedWidget("label2", labelWidgetClass, demo_form,
277 XtNleft, XtChainLeft,
278 XtNright, XtChainRight,
283 XtVaCreateManagedWidget("subform", formWidgetClass, demo_form,
284 XtNleft, XtChainLeft,
285 XtNright, XtChainRight,
289 XtVaCreateManagedWidget("viewport", viewportWidgetClass, subform,
291 XtNleft, XtChainLeft,
292 XtNright, XtChainRight,
298 demo_list = XtVaCreateManagedWidget("demo_list", listWidgetClass, viewport,
299 XtNverticalList, TRUE,
300 XtNdefaultColumns, 1,
303 text_line = XtVaCreateManagedWidget("text", asciiTextWidgetClass, subform,
304 XtNleft, XtChainLeft,
305 XtNright, XtChainRight,
306 XtNfromVert, viewport,
307 XtNbottom, XtChainBottom,
308 XtNeditType, XawtextEdit,
312 XtVaCreateManagedWidget("box", boxWidgetClass, demo_form,
313 XtNleft, XtChainLeft,
314 XtNfromVert, subform,
315 XtNbottom, XtChainBottom,
316 XtNright, XtChainRight,
317 XtNorientation, XtEhorizontal,
319 next = XtVaCreateManagedWidget("next", commandWidgetClass, box, NULL);
320 prev = XtVaCreateManagedWidget("prev", commandWidgetClass, box, NULL);
321 edit = XtVaCreateManagedWidget("edit", commandWidgetClass, box, NULL);
322 restart = XtVaCreateManagedWidget("restart", commandWidgetClass, box, NULL);
323 done = XtVaCreateManagedWidget("done", commandWidgetClass, box, NULL);