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() */
36 Widget preferences_dialog;
37 Widget preferences_form;
41 Widget fade_ticks_text;
42 Widget lock_timeout_text;
43 Widget passwd_timeout_text;
44 Widget verbose_toggle;
45 Widget install_cmap_toggle;
67 static Widget buttonbox, textbox, okbox;
71 create_preferences_dialog(Widget parent, Visual *visual, Colormap colormap)
74 int depth = visual_depth(XtScreen(parent), visual);
77 XtVaCreatePopupShell("preferences_dialog", transientShellWidgetClass, parent,
79 XtNcolormap, colormap,
84 XtVaCreateManagedWidget("preferences_form", formWidgetClass,
87 XtNcolormap, colormap,
91 rlabel = XtVaCreateManagedWidget("label1", labelWidgetClass, preferences_form,
93 XtNright, XtChainRight,
98 XtVaCreateManagedWidget("textbox", formWidgetClass, preferences_form,
103 XtVaCreateManagedWidget("textbox", boxWidgetClass, preferences_form,
104 XtNleft, XtChainLeft,
105 XtNright, XtChainRight,
106 XtNfromVert, textbox,
107 XtNorientation, XtorientHorizontal,
110 XtVaCreateManagedWidget("timeout", dialogWidgetClass, textbox,
111 XtNleft, XtChainLeft,
112 XtNright, XtChainRight,
116 XtVaCreateManagedWidget("cycle", dialogWidgetClass, textbox,
117 XtNleft, XtChainLeft,
118 XtNright, XtChainRight,
119 XtNfromVert, timeout_text,
122 XtVaCreateManagedWidget("fade", dialogWidgetClass, textbox,
123 XtNleft, XtChainLeft,
124 XtNright, XtChainRight,
125 XtNfromVert, cycle_text,
129 XtVaCreateManagedWidget("ticks", dialogWidgetClass, textbox,
131 XtNright, XtChainRight,
132 XtNfromHoriz, timeout_text,
136 XtVaCreateManagedWidget("lockTime", dialogWidgetClass, textbox,
137 XtNfromVert, fade_ticks_text,
138 XtNright, XtChainRight,
139 XtNfromHoriz, cycle_text,
142 passwd_timeout_text =
143 XtVaCreateManagedWidget("passwdTime", dialogWidgetClass, textbox,
144 XtNfromVert, lock_timeout_text,
145 XtNright, XtChainRight,
146 XtNfromHoriz, fade_text,
150 XtVaCreateManagedWidget("buttonbox", boxWidgetClass, preferences_form,
152 XtNfromHoriz, textbox,
153 XtNright, XtChainRight,
154 XtNorientation, XtorientVertical,
157 XtVaCreateManagedWidget("verbose", toggleWidgetClass, buttonbox,
159 install_cmap_toggle =
160 XtVaCreateManagedWidget("cmap", toggleWidgetClass, buttonbox,
163 XtVaCreateManagedWidget("fade", toggleWidgetClass, buttonbox,
166 XtVaCreateManagedWidget("unfade", toggleWidgetClass, buttonbox,
169 XtVaCreateManagedWidget("lock", toggleWidgetClass, buttonbox,
173 prefs_done = XtVaCreateManagedWidget("done", commandWidgetClass, okbox,
175 prefs_cancel = XtVaCreateManagedWidget("cancel", commandWidgetClass, okbox,
180 create_demo_dialog(Widget parent, Visual *visual, Colormap colormap)
182 Widget subform, box, viewport, label2;
183 int depth = visual_depth(XtScreen(parent), visual);
186 XtVaCreatePopupShell("demo_dialog", transientShellWidgetClass, parent,
188 XtNcolormap, colormap,
193 XtVaCreateManagedWidget("demo_form", formWidgetClass, demo_dialog,
195 XtNcolormap, colormap,
197 XtNleft, XtChainLeft,
198 XtNright, XtChainRight,
202 label1 = XtVaCreateManagedWidget("label1", labelWidgetClass, demo_form,
203 XtNleft, XtChainLeft,
204 XtNright, XtChainRight,
208 label2 = XtVaCreateManagedWidget("label2", labelWidgetClass, demo_form,
209 XtNleft, XtChainLeft,
210 XtNright, XtChainRight,
215 XtVaCreateManagedWidget("subform", formWidgetClass, demo_form,
216 XtNleft, XtChainLeft,
217 XtNright, XtChainRight,
222 XtVaCreateManagedWidget("viewport", viewportWidgetClass, subform,
224 XtNleft, XtChainLeft,
225 XtNright, XtChainRight,
231 demo_list = XtVaCreateManagedWidget("demo_list", listWidgetClass, viewport,
232 XtNverticalList, TRUE,
233 XtNdefaultColumns, 1,
236 text_line = XtVaCreateManagedWidget("text", asciiTextWidgetClass, subform,
237 XtNleft, XtChainLeft,
238 XtNright, XtChainRight,
239 XtNfromVert, viewport,
240 XtNbottom, XtChainBottom,
241 XtNeditType, XawtextEdit,
245 XtVaCreateManagedWidget("box", boxWidgetClass, demo_form,
246 XtNleft, XtChainLeft,
247 XtNfromVert, subform,
248 XtNbottom, XtChainBottom,
249 XtNright, XtChainRight,
250 XtNorientation, XtEhorizontal,
252 next = XtVaCreateManagedWidget("next", commandWidgetClass, box, NULL);
253 prev = XtVaCreateManagedWidget("prev", commandWidgetClass, box, NULL);
254 edit = XtVaCreateManagedWidget("edit", commandWidgetClass, box, NULL);
256 restart = XtVaCreateManagedWidget("restart", commandWidgetClass, box, NULL);
258 done = XtVaCreateManagedWidget("done", commandWidgetClass, box, NULL);