5 #include <X11/StringDefs.h>
6 #include <X11/Intrinsic.h>
7 #include <X11/IntrinsicP.h>
10 #include <X11/CompositeP.h>
11 #include <X11/cursorfont.h>
15 static char rcsid[] = "$Header$";
17 void extra_help_callback();
19 static Widget logwidget = NULL;
22 SetupLogWidget(parent)
32 XtSetArg(wargs[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
33 XtSetArg(wargs[n], XmNeditable, False); n++;
35 logwidget = XmCreateScrolledText( parent,
38 XtManageChild(logwidget);
44 ** PopupErrorMessage(text)
46 ** Given a char* pointing to an error message, possibly with imbedded
47 ** newlines, display the text in a popup window and put two buttons
48 ** at the bottom of the window, labelled "OK" and "Cancel." Pop down
49 ** when one of the buttons is pressed.
51 ** Return 0 if "OK" is pressed, 1 for "Cancel."
55 PopupErrorMessage(text, extrahelp)
62 static XmString label;
66 XtDestroyWidget(child);
70 label = XmStringCreateLtoR( text, XmSTRING_DEFAULT_CHARSET);
73 XtSetArg(wargs[n], XmNmessageString, label); n++;
75 child = (Widget) XmCreateErrorDialog(logwidget, "errormessage", wargs, n);
77 XtAddCallback (child, XmNhelpCallback, extra_help_callback, extrahelp);
79 XtUnmanageChild(XmMessageBoxGetChild (child, XmDIALOG_HELP_BUTTON));
80 XtUnmanageChild(XmMessageBoxGetChild (child, XmDIALOG_CANCEL_BUTTON));
85 ** PopupHelpWindow(text)
87 ** Given a char* pointing to an help message, possibly with imbedded
88 ** newlines, display the text in a popup window and put a single button
89 ** at the bottom of the window, labelled "OK." Pop down when the
90 ** the buttons is pressed.
101 static XmString label;
104 XtDestroyWidget(child);
107 label = XmStringCreateLtoR( text, XmSTRING_DEFAULT_CHARSET);
110 XtSetArg(wargs[n], XmNmessageString, label); n++;
112 child = (Widget) XmCreateMessageDialog(logwidget, "helpmessage", wargs, n);
113 XtUnmanageChild(XmMessageBoxGetChild (child, XmDIALOG_CANCEL_BUTTON));
114 XtUnmanageChild(XmMessageBoxGetChild (child, XmDIALOG_HELP_BUTTON));
116 XtManageChild(child);
120 ** Given a char* to a single line of text, append this line at the bottom
121 ** of the log window. Return 0 of the append was sucessful, non-zero
122 ** for an error condition.
132 string = XmTextGetString(logwidget);
133 pos = strlen(string);
136 XmTextReplace(logwidget, pos, pos, text);
137 XmTextSetCursorPosition(logwidget, pos + strlen(text));
141 MakeWatchCursor(topW)
149 mycursor = XCreateFontCursor (XtDisplay(topW), XC_watch);
150 XDefineCursor(XtDisplay(topW), XtWindow(topW), mycursor);
154 MakeNormalCursor(topW)
160 XUndefineCursor(XtDisplay(topW), XtWindow(topW));
164 ** Move through the fields of the spec and make certain that the
165 ** form's widgets actually reflect the current values.
172 UserPrompt **myinputlines = spec->inputlines;
178 for ( current = (*myinputlines);
180 myinputlines++, current = (*myinputlines)) {
183 switch (current->type) {
185 if (current->returnvalue.stringvalue) {
186 XmTextSetString (current->mywidget, current->returnvalue.stringvalue);
192 XtSetArg(wargs[n], XmNset,
193 current->returnvalue.booleanvalue ? True : False); n++;
194 XtSetValues (current->mywidget, wargs, n);
198 kidcount = ((CompositeRec *)(current->mywidget))->
199 composite.num_children;
203 kid = ((CompositeRec *)(current->mywidget))->
204 composite.children[kidcount];
205 if (current->returnvalue.stringvalue &&
206 (!strcmp (XtName(kid), current->returnvalue.stringvalue))) {
207 XtSetArg(wargs[n], XmNset, True);
211 XtSetArg(wargs[n], XmNset, False);
214 XtSetValues (kid, wargs, n);
222 XtSetArg(wargs[n], XtNsensitive, !(current->insensitive)); n++;
223 XtSetValues (current->mywidget, wargs, n);
228 extra_help_callback(w, client_data, call_data)
231 XmAnyCallbackStruct *call_data;
233 PopupHelpWindow(client_data);