Debian Codegraph @

gui/XDo/src/HelpDo.c

raw
1
2 /*******************************************************************************
3 HelpDo.c
4
5 *******************************************************************************/
6
7 #include <stdio.h>
8 #include "UxLib.h"
9 #include "UxPushB.h"
10 #include "UxScText.h"
11 #include "UxScrW.h"
12 #include "UxForm.h"
13 #include "UxTopSh.h"
14
15 /*******************************************************************************
16 Includes, Defines, and Global variables from the Declarations Editor:
17 *******************************************************************************/
18
19 #include <ExternResources.h>
20
21 /*******************************************************************************
22 The definition of the context structure:
23 If you create multiple instances of your interface, the context
24 structure ensures that your callbacks use the variables for the
25 correct instance.
26
27 For each swidget in the interface, each argument to the Interface
28 function, and each variable in the Instance Specific section of the
29 Declarations Editor, there is an entry in the context structure.
30 and a #define. The #define makes the variable name refer to the
31 corresponding entry in the context structure.
32 *******************************************************************************/
33
34 typedef struct
35 {
36 swidget UxHelpDo;
37 swidget Uxform7;
38 swidget UxscrolledWindow9;
39 swidget UxscrolledText1;
40 swidget UxCloseHelp;
41 } _UxCHelpDo;
42
43 #define HelpDo UxHelpDoContext->UxHelpDo
44 #define form7 UxHelpDoContext->Uxform7
45 #define scrolledWindow9 UxHelpDoContext->UxscrolledWindow9
46 #define scrolledText1 UxHelpDoContext->UxscrolledText1
47 #define CloseHelp UxHelpDoContext->UxCloseHelp
48
49 static _UxCHelpDo *UxHelpDoContext;
50
51
52 /*******************************************************************************
53 Forward declarations of functions that are defined later in this file.
54 *******************************************************************************/
55
56 swidget create_HelpDo();
57
58 /*******************************************************************************
59 The following are callback functions.
60 *******************************************************************************/
61
62 static void activateCB_CloseHelp( UxWidget, UxClientData, UxCallbackArg )
63 Widget UxWidget;
64 XtPointer UxClientData, UxCallbackArg;
65 {
66 _UxCHelpDo *UxSaveCtx, *UxContext;
67 swidget UxThisWidget;
68
69 UxThisWidget = UxWidgetToSwidget( UxWidget );
70 UxSaveCtx = UxHelpDoContext;
71 UxHelpDoContext = UxContext =
72 (_UxCHelpDo *) UxGetContext( UxThisWidget );
73 {
74 extern swidget help;
75 UxPopdownInterface(help);
76 }
77 UxHelpDoContext = UxSaveCtx;
78 }
79
80 /*******************************************************************************
81 The 'init_' function sets the private properties for all the
82 swidgets to the values specified in the Property Table.
83 Some properties need to be set after the X widgets have been
84 created and the setting of these properties is done in the
85 'build_' function after the UxCreateWidget call.
86 *******************************************************************************/
87
88 static void _Uxinit_HelpDo()
89 {
90 UxPutIconName( HelpDo, "Helpwindow" );
91 UxPutBackground( HelpDo, WindowBackground );
92 UxPutHeight( HelpDo, 260 );
93 UxPutWidth( HelpDo, 540 );
94 UxPutY( HelpDo, 10 );
95 UxPutX( HelpDo, 630 );
96
97 UxPutBackground( form7, WindowBackground );
98 UxPutHeight( form7, 240 );
99 UxPutWidth( form7, 520 );
100 UxPutY( form7, 10 );
101 UxPutX( form7, 0 );
102 UxPutUnitType( form7, "pixels" );
103 UxPutResizePolicy( form7, "resize_none" );
104
105 UxPutForeground( scrolledWindow9, TextForeground );
106 UxPutBackground( scrolledWindow9, ApplicBackground );
107 UxPutShadowThickness( scrolledWindow9, 0 );
108 UxPutScrollBarDisplayPolicy( scrolledWindow9, "static" );
109 UxPutVisualPolicy( scrolledWindow9, "variable" );
110 UxPutY( scrolledWindow9, 10 );
111 UxPutX( scrolledWindow9, 0 );
112 UxPutScrollingPolicy( scrolledWindow9, "application_defined" );
113
114 UxPutScrollHorizontal( scrolledText1, "false" );
115 UxPutForeground( scrolledText1, TextForeground );
116 UxPutFontList( scrolledText1, TextFont );
117 UxPutEditable( scrolledText1, "false" );
118 UxPutEditMode( scrolledText1, "multi_line_edit" );
119 UxPutBackground( scrolledText1, TextBackground );
120 UxPutHeight( scrolledText1, 200 );
121 UxPutWidth( scrolledText1, 520 );
122
123 UxPutLabelString( CloseHelp, "Close" );
124 UxPutForeground( CloseHelp, CancelForeground );
125 UxPutFontList( CloseHelp, BoldTextFont );
126 UxPutBackground( CloseHelp, ButtonBackground );
127 UxPutHeight( CloseHelp, 30 );
128 UxPutWidth( CloseHelp, 100 );
129 UxPutY( CloseHelp, 230 );
130 UxPutX( CloseHelp, 190 );
131
132 }
133
134 /*******************************************************************************
135 The 'build_' function creates all the swidgets and X widgets,
136 and sets their properties to the values specified in the
137 Property Editor.
138 *******************************************************************************/
139
140 static swidget _Uxbuild_HelpDo()
141 {
142 /* Create the swidgets */
143
144 HelpDo = UxCreateTopLevelShell( "HelpDo", NO_PARENT );
145 UxPutContext( HelpDo, UxHelpDoContext );
146
147 form7 = UxCreateForm( "form7", HelpDo );
148 scrolledWindow9 = UxCreateScrolledWindow( "scrolledWindow9", form7 );
149 scrolledText1 = UxCreateScrolledText( "scrolledText1", scrolledWindow9 );
150 CloseHelp = UxCreatePushButton( "CloseHelp", form7 );
151
152 _Uxinit_HelpDo();
153
154 /* Create the X widgets */
155
156 UxCreateWidget( HelpDo );
157 UxCreateWidget( form7 );
158 UxPutLeftOffset( scrolledWindow9, 0 );
159 UxPutLeftAttachment( scrolledWindow9, "attach_form" );
160 UxPutRightOffset( scrolledWindow9, 0 );
161 UxPutRightAttachment( scrolledWindow9, "attach_form" );
162 UxPutTopOffset( scrolledWindow9, 0 );
163 UxPutTopAttachment( scrolledWindow9, "attach_form" );
164 UxCreateWidget( scrolledWindow9 );
165
166 UxCreateWidget( scrolledText1 );
167 UxPutRightOffset( CloseHelp, 215 );
168 UxPutRightAttachment( CloseHelp, "attach_form" );
169 UxPutLeftOffset( CloseHelp, 215 );
170 UxPutLeftAttachment( CloseHelp, "attach_form" );
171 UxPutBottomOffset( CloseHelp, 5 );
172 UxPutBottomAttachment( CloseHelp, "attach_form" );
173 UxCreateWidget( CloseHelp );
174
175
176 UxAddCallback( CloseHelp, XmNactivateCallback,
177 activateCB_CloseHelp,
178 (XtPointer) UxHelpDoContext );
179
180
181 /* Finally, call UxRealizeInterface to create the X windows
182 for the widgets created above. */
183
184 UxRealizeInterface( HelpDo );
185
186 return ( HelpDo );
187 }
188
189 /*******************************************************************************
190 The following function includes the code that was entered
191 in the 'Initial Code' and 'Final Code' sections of the
192 Declarations Editor. This function is called from the
193 'Interface function' below.
194 *******************************************************************************/
195
196 static swidget _Ux_create_HelpDo()
197 {
198 swidget rtrn;
199 _UxCHelpDo *UxContext;
200
201 UxHelpDoContext = UxContext =
202 (_UxCHelpDo *) UxMalloc( sizeof(_UxCHelpDo) );
203
204 rtrn = _Uxbuild_HelpDo();
205
206 return(rtrn);
207 }
208
209 /*******************************************************************************
210 The following is the 'Interface function' which is the
211 external entry point for creating this interface.
212 This function should be called from your application or from
213 a callback function.
214 *******************************************************************************/
215
216 swidget create_HelpDo()
217 {
218 swidget _Uxrtrn;
219
220 _Uxrtrn = _Ux_create_HelpDo();
221
222 return ( _Uxrtrn );
223 }
224
225 /*******************************************************************************
226 END OF FILE
227 *******************************************************************************/
228