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 resources_dialog;
37 Widget resources_form;
42 Widget lock_time_text;
43 Widget passwd_time_text;
44 Widget verbose_toggle;
67 static Widget buttonbox, textbox, okbox;
71 create_resources_dialog(Widget parent, Visual *visual, Colormap colormap)
74 int depth = visual_depth(XtScreen(parent), visual);
77 XtVaCreatePopupShell("resources_dialog", transientShellWidgetClass, parent,
79 XtNoverrideRedirect, TRUE,
81 XtNcolormap, colormap,
86 XtVaCreateManagedWidget("resources_form", formWidgetClass,
89 XtNcolormap, colormap,
93 rlabel = XtVaCreateManagedWidget("label1", labelWidgetClass, resources_form,
95 XtNright, XtChainRight,
100 XtVaCreateManagedWidget("textbox", formWidgetClass, resources_form,
101 XtNleft, XtChainLeft,
105 XtVaCreateManagedWidget("textbox", boxWidgetClass, resources_form,
106 XtNleft, XtChainLeft,
107 XtNright, XtChainRight,
108 XtNfromVert, textbox,
109 XtNorientation, XtorientHorizontal,
112 XtVaCreateManagedWidget("timeout", dialogWidgetClass, textbox,
113 XtNleft, XtChainLeft,
114 XtNright, XtChainRight,
118 XtVaCreateManagedWidget("cycle", dialogWidgetClass, textbox,
119 XtNleft, XtChainLeft,
120 XtNright, XtChainRight,
121 XtNfromVert, timeout_text,
124 XtVaCreateManagedWidget("fade", dialogWidgetClass, textbox,
125 XtNleft, XtChainLeft,
126 XtNright, XtChainRight,
127 XtNfromVert, cycle_text,
131 XtVaCreateManagedWidget("ticks", dialogWidgetClass, textbox,
133 XtNright, XtChainRight,
134 XtNfromHoriz, timeout_text,
138 XtVaCreateManagedWidget("lockTime", dialogWidgetClass, textbox,
139 XtNfromVert, ticks_text,
140 XtNright, XtChainRight,
141 XtNfromHoriz, cycle_text,
145 XtVaCreateManagedWidget("passwdTime", dialogWidgetClass, textbox,
146 XtNfromVert, lock_time_text,
147 XtNright, XtChainRight,
148 XtNfromHoriz, fade_text,
152 XtVaCreateManagedWidget("buttonbox", boxWidgetClass, resources_form,
154 XtNfromHoriz, textbox,
155 XtNright, XtChainRight,
156 XtNorientation, XtorientVertical,
159 XtVaCreateManagedWidget("verbose", toggleWidgetClass, buttonbox,
162 XtVaCreateManagedWidget("cmap", toggleWidgetClass, buttonbox,
165 XtVaCreateManagedWidget("fade", toggleWidgetClass, buttonbox,
168 XtVaCreateManagedWidget("unfade", toggleWidgetClass, buttonbox,
171 XtVaCreateManagedWidget("lock", toggleWidgetClass, buttonbox,
175 res_done = XtVaCreateManagedWidget("done", commandWidgetClass, okbox,
177 res_cancel = XtVaCreateManagedWidget("cancel", commandWidgetClass, okbox,
182 create_demo_dialog(Widget parent, Visual *visual, Colormap colormap)
184 Widget subform, box, viewport, label2;
185 int depth = visual_depth(XtScreen(parent), visual);
188 XtVaCreatePopupShell("demo_dialog", transientShellWidgetClass, parent,
190 XtNoverrideRedirect, TRUE,
192 XtNcolormap, colormap,
197 XtVaCreateManagedWidget("demo_form", formWidgetClass, demo_dialog,
199 XtNcolormap, colormap,
203 label1 = XtVaCreateManagedWidget("label1", labelWidgetClass, demo_form,
204 XtNleft, XtChainLeft,
205 XtNright, XtChainRight,
209 label2 = XtVaCreateManagedWidget("label2", labelWidgetClass, demo_form,
210 XtNleft, XtChainLeft,
211 XtNright, XtChainRight,
216 XtVaCreateManagedWidget("subform", formWidgetClass, demo_form,
217 XtNleft, XtChainLeft,
218 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);
255 restart = XtVaCreateManagedWidget("restart", commandWidgetClass, box, NULL);
256 done = XtVaCreateManagedWidget("done", commandWidgetClass, box, NULL);