00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 #include <stdio.h>
00071 #include <X11/IntrinsicP.h>
00072 #include <X11/StringDefs.h>
00073
00074 #include <X11/Xaw3d/XawInit.h>
00075 #include <X11/Xaw3d/Cardinals.h>
00076 #include <X11/Xaw3d/AsciiTextP.h>
00077 #include <X11/Xaw3d/AsciiSrc.h>
00078 #include <X11/Xaw3d/AsciiSink.h>
00079 #include <X11/Xaw3d/MultiSrc.h>
00080 #include <X11/Xaw3d/MultiSinkP.h>
00081 #include <X11/Xaw3d/XawImP.h>
00082
00083 #define TAB_COUNT 32
00084
00085 static void Initialize(), Destroy();
00086
00087 AsciiTextClassRec asciiTextClassRec = {
00088 {
00089 (WidgetClass) &textClassRec,
00090 "Text",
00091 sizeof(AsciiRec),
00092 XawInitializeWidgetSet,
00093 NULL,
00094 FALSE,
00095 Initialize,
00096 NULL,
00097 XtInheritRealize,
00098 NULL,
00099 0,
00100 NULL,
00101 0,
00102 NULLQUARK,
00103 TRUE,
00104 XtExposeGraphicsExpose | XtExposeNoExpose,
00105 TRUE,
00106 FALSE,
00107 Destroy,
00108 XtInheritResize,
00109 XtInheritExpose,
00110 NULL,
00111 NULL,
00112 XtInheritSetValuesAlmost,
00113 NULL,
00114 XtInheritAcceptFocus,
00115 XtVersion,
00116 NULL,
00117 XtInheritTranslations,
00118 XtInheritQueryGeometry
00119 },
00120 {
00121 XtInheritChangeSensitive
00122 },
00123 {
00124 0
00125 },
00126 {
00127 0
00128 }
00129 };
00130
00131 WidgetClass asciiTextWidgetClass = (WidgetClass)&asciiTextClassRec;
00132
00133
00134 static void
00135 Initialize(request, new, args, num_args)
00136 Widget request, new;
00137 ArgList args;
00138 Cardinal *num_args;
00139 {
00140 AsciiWidget w = (AsciiWidget) new;
00141 int i;
00142 int tabs[TAB_COUNT], tab;
00143
00144 MultiSinkObject sink;
00145
00146
00147
00148
00149 if (request->core.height == DEFAULT_TEXT_HEIGHT)
00150 new->core.height = DEFAULT_TEXT_HEIGHT;
00151
00152
00153
00154
00155 if ( w->simple.international == True ) {
00156
00157 w->text.source = XtCreateWidget( "textSource", multiSrcObjectClass,
00158 new, args, *num_args );
00159 w->text.sink = XtCreateWidget( "textSink", multiSinkObjectClass,
00160 new, args, *num_args );
00161 }
00162 else {
00163
00164 w->text.source = XtCreateWidget( "textSource", asciiSrcObjectClass,
00165 new, args, *num_args );
00166 w->text.sink = XtCreateWidget( "textSink", asciiSinkObjectClass,
00167 new, args, *num_args );
00168 }
00169
00170 if (w->core.height == DEFAULT_TEXT_HEIGHT)
00171 w->core.height = VMargins(w) + XawTextSinkMaxHeight(w->text.sink, 1);
00172
00173 for (i=0, tab=0 ; i < TAB_COUNT ; i++)
00174 tabs[i] = (tab += 8);
00175
00176 XawTextSinkSetTabs(w->text.sink, TAB_COUNT, tabs);
00177
00178 XawTextDisableRedisplay(new);
00179 XawTextEnableRedisplay(new);
00180
00181
00182
00183
00184 if ( w->simple.international == True ) {
00185 Arg list[4];
00186 Cardinal ac = 0;
00187
00188 sink = (MultiSinkObject)w->text.sink;
00189 _XawImRegister( new );
00190 XtSetArg (list[ac], XtNfontSet, sink->multi_sink.fontset); ac++;
00191 XtSetArg (list[ac], XtNinsertPosition, w->text.insertPos); ac++;
00192 XtSetArg (list[ac], XtNforeground, sink->text_sink.foreground); ac++;
00193 XtSetArg (list[ac], XtNbackground, sink->text_sink.background); ac++;
00194 _XawImSetValues(new, list, ac);
00195 }
00196 }
00197
00198 static void
00199 Destroy(w)
00200 Widget w;
00201 {
00202
00203
00204 if ( ((AsciiWidget)w)->simple.international == True )
00205 _XawImUnregister( w );
00206
00207 if (w == XtParent(((AsciiWidget)w)->text.source))
00208 XtDestroyWidget( ((AsciiWidget)w)->text.source );
00209
00210 if (w == XtParent(((AsciiWidget)w)->text.sink))
00211 XtDestroyWidget( ((AsciiWidget)w)->text.sink );
00212 }
00213
00214 #ifdef ASCII_STRING
00215
00216
00217
00218
00219
00220
00221
00222 AsciiStringClassRec asciiStringClassRec = {
00223 {
00224 (WidgetClass) &asciiTextClassRec,
00225 "Text",
00226 sizeof(AsciiStringRec),
00227 NULL,
00228 NULL,
00229 FALSE,
00230 NULL,
00231 NULL,
00232 XtInheritRealize,
00233 NULL,
00234 0,
00235 NULL,
00236 0,
00237 NULLQUARK,
00238 TRUE,
00239 XtExposeGraphicsExpose,
00240 TRUE,
00241 FALSE,
00242 NULL,
00243 XtInheritResize,
00244 XtInheritExpose,
00245 NULL,
00246 NULL,
00247 XtInheritSetValuesAlmost,
00248 NULL,
00249 XtInheritAcceptFocus,
00250 XtVersion,
00251 NULL,
00252 XtInheritTranslations,
00253 XtInheritQueryGeometry
00254 },
00255 {
00256 XtInheritChangeSensitive
00257 },
00258 {
00259 0
00260 },
00261 {
00262 0
00263 }
00264 };
00265
00266 WidgetClass asciiStringWidgetClass = (WidgetClass)&asciiStringClassRec;
00267
00268 #endif
00269
00270 #ifdef ASCII_DISK
00271
00272
00273
00274
00275
00276
00277
00278 AsciiDiskClassRec asciiDiskClassRec = {
00279 {
00280 (WidgetClass) &asciiTextClassRec,
00281 "Text",
00282 sizeof(AsciiDiskRec),
00283 NULL,
00284 NULL,
00285 FALSE,
00286 NULL,
00287 NULL,
00288 XtInheritRealize,
00289 NULL,
00290 0,
00291 NULL,
00292 0,
00293 NULLQUARK,
00294 TRUE,
00295 XtExposeGraphicsExpose,
00296 TRUE,
00297 FALSE,
00298 NULL,
00299 XtInheritResize,
00300 XtInheritExpose,
00301 NULL,
00302 NULL,
00303 XtInheritSetValuesAlmost,
00304 NULL,
00305 XtInheritAcceptFocus,
00306 XtVersion,
00307 NULL,
00308 XtInheritTranslations,
00309 XtInheritQueryGeometry
00310 },
00311 {
00312 XtInheritChangeSensitive
00313 },
00314 {
00315 0
00316 },
00317 {
00318 0
00319 }
00320 };
00321
00322 WidgetClass asciiDiskWidgetClass = (WidgetClass)&asciiDiskClassRec;
00323
00324 #endif
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336