1 /* $Id: readme.c,v 1.3 2002/03/02 21:02:21 sverrehu Exp $ */
2 /**************************************************************************
3  *
4  *  FILE            readme.c
5  *  MODULE OF       Card game.
6  *
7  *  DESCRIPTION     REAME file viewer.
8  *
9  *  WRITTEN BY      Sverre H. Huseby <shh@thathost.com>
10  *
11  **************************************************************************/
12 
13 #include <stdlib.h>
14 
15 #include <X11/Xlib.h>
16 #include <X11/Intrinsic.h>
17 #include <X11/StringDefs.h>
18 #include <X11/Shell.h>
19 #include <X11/Xaw/Command.h>
20 #include <X11/Xaw/AsciiText.h>
21 #include <X11/Xaw/Form.h>
22 
23 #include "win.h"
24 #include "readme.h"
25 
26 /**************************************************************************
27  *                                                                        *
28  *                       P R I V A T E    D A T A                         *
29  *                                                                        *
30  **************************************************************************/
31 
32 static Widget readmeWidget, readmeParent, textWidget;
33 static int isPoppedUp = 0;
34 #include "readme.var"
35 
36 
37 
38 /**************************************************************************
39  *                                                                        *
40  *                   P R I V A T E    F U N C T I O N S                   *
41  *                                                                        *
42  **************************************************************************/
43 
44 static void
callbackOk(Widget w,XtPointer clientData,XtPointer callData)45 callbackOk(Widget w, XtPointer clientData, XtPointer callData)
46 {
47     XtPopdown(readmeWidget);
48     XtSetSensitive(readmeButton, 1);
49     isPoppedUp = 0;
50 }
51 
52 
53 
54 /**************************************************************************
55  *                                                                        *
56  *                    P U B L I C    F U N C T I O N S                    *
57  *                                                                        *
58  **************************************************************************/
59 
60 void
readmeInit(Widget parent)61 readmeInit(Widget parent)
62 {
63     Widget form, button;
64 
65     readmeParent = parent;
66     readmeWidget
67 	= XtVaCreatePopupShell("readmeWindow",
68 			       topLevelShellWidgetClass, parent,
69 			       XtNtitle, "Sol Help",
70 			       XtNallowShellResize, 1,
71 			       NULL);
72     form
73 	= XtVaCreateManagedWidget("readmeFrom",
74 				  formWidgetClass, readmeWidget,
75 				  NULL);
76     textWidget
77 	= XtVaCreateManagedWidget("readme",
78 				  asciiTextWidgetClass, form,
79 				  XtNwidth, 66,
80 				  XtNheight, 25 * 10 + 4,
81 				  XtNdisplayCaret, 0,
82 				  XtNscrollVertical, XawtextScrollWhenNeeded,
83 				  XtNresizable, 1,
84 				  XtNresize, XawtextResizeWidth,
85 				  NULL);
86     button
87 	= XtVaCreateManagedWidget("ok",
88 				  commandWidgetClass, form,
89 				  XtNlabel, "It's all clear to me now.",
90 				  XtNfromVert, textWidget,
91 				  NULL);
92     XtAddCallback(button, XtNcallback, callbackOk, 0);
93 }
94 
95 void
readmeFinish(void)96 readmeFinish(void)
97 {
98 }
99 
100 void
readmePopup(void)101 readmePopup(void)
102 {
103     if (isPoppedUp)
104 	return;
105     XtSetSensitive(readmeButton, 0);
106     isPoppedUp = 1;
107 
108     XtVaSetValues(textWidget, XtNstring, readmeText, NULL);
109     XtPopup(readmeWidget, XtGrabNone);
110 }
111