rust/cargo-c: update to 0.10.7+cargo-0.84.0
[oi-userland.git] / components / x11 / libXaw4 / src / Xaw3_1AsciiText.c
blob5fcd7df8a21b800b708400558fcefd4d2470ef0b
1 #if (!defined(lint) && !defined(SABER))
2 static char Xrcsid[] = "$XConsortium: AsciiText.c,v 1.36 89/12/11 14:42:56 kit Exp $";
3 #endif /* lint && SABER */
5 /***********************************************************
6 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
7 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
9 All Rights Reserved
11 Permission to use, copy, modify, and distribute this software and its
12 documentation for any purpose and without fee is hereby granted,
13 provided that the above copyright notice appear in all copies and that
14 both that copyright notice and this permission notice appear in
15 supporting documentation, and that the names of Digital or MIT not be
16 used in advertising or publicity pertaining to distribution of the
17 software without specific, written prior permission.
19 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
20 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
21 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
22 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
23 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
25 SOFTWARE.
27 ******************************************************************/
29 /***********************************************************************
31 * AsciiText Widget
33 ***********************************************************************/
36 * AsciiText.c - Source code for AsciiText Widget.
38 * This Widget is intended to be used as a simple front end to the
39 * text widget with an ascii source and ascii sink attached to it.
41 * Date: June 29, 1989
43 * By: Chris D. Peterson
44 * MIT X Consortium
45 * kit@expo.lcs.mit.edu
48 #include <stdio.h>
49 /* #include <X11/copyright.h> */
50 #include <X11/IntrinsicP.h>
51 #include <X11/StringDefs.h>
53 #include <./Xaw3_1XawInit.h>
54 #include <./Xaw3_1AsciiSrc.h>
55 #include <./Xaw3_1AsciiSink.h>
56 #include <./Xaw3_1AsciiTextP.h>
57 #include <./Xaw3_1Cardinals.h>
59 #define TAB_COUNT 32
61 static void ClassInitialize(), Initialize(), CreateSourceSink(), Destroy();
63 AsciiTextClassRec asciiTextClassRec = {
64 { /* core fields */
65 /* superclass */ (WidgetClass) &textClassRec,
66 /* class_name */ "Text",
67 /* widget_size */ sizeof(AsciiRec),
68 /* class_initialize */ ClassInitialize,
69 /* class_part_init */ NULL,
70 /* class_inited */ FALSE,
71 /* initialize */ Initialize,
72 /* initialize_hook */ CreateSourceSink,
73 /* realize */ XtInheritRealize,
74 /* actions */ textActionsTable,
75 /* num_actions */ 0,
76 /* resources */ NULL,
77 /* num_ resource */ 0,
78 /* xrm_class */ NULLQUARK,
79 /* compress_motion */ TRUE,
80 /* compress_exposure*/ XtExposeGraphicsExpose,
81 /* compress_enterleave*/ TRUE,
82 /* visible_interest */ FALSE,
83 /* destroy */ Destroy,
84 /* resize */ XtInheritResize,
85 /* expose */ XtInheritExpose,
86 /* set_values */ NULL,
87 /* set_values_hook */ NULL,
88 /* set_values_almost*/ XtInheritSetValuesAlmost,
89 /* get_values_hook */ NULL,
90 /* accept_focus */ XtInheritAcceptFocus,
91 /* version */ XtVersion,
92 /* callback_private */ NULL,
93 /* tm_table */ XtInheritTranslations,
94 /* query_geometry */ XtInheritQueryGeometry
96 { /* Simple fields */
97 /* change_sensitive */ XtInheritChangeSensitive
99 { /* text fields */
100 /* empty */ 0
102 { /* ascii fields */
103 /* empty */ 0
107 WidgetClass asciiTextWidgetClass = (WidgetClass)&asciiTextClassRec;
109 static void
110 ClassInitialize()
112 XawInitializeWidgetSet();
113 asciiTextClassRec.core_class.num_actions = textActionsTableCount;
116 /* ARGSUSED */
117 static void
118 Initialize(request, new)
119 Widget request, new;
121 /* superclass Initialize can't set the following,
122 * as it didn't know the source or sink when it was called */
123 if (request->core.height == DEFAULT_TEXT_HEIGHT)
124 new->core.height = DEFAULT_TEXT_HEIGHT;
128 static void
129 CreateSourceSink(widget, args, num_args)
130 Widget widget;
131 ArgList args;
132 Cardinal *num_args;
134 AsciiWidget w = (AsciiWidget) widget;
135 int i;
136 int tabs[TAB_COUNT], tab;
138 w->text.source = XtCreateWidget( "textSource", asciiSrcObjectClass,
139 widget, args, *num_args );
140 w->text.sink = XtCreateWidget( "textSink", asciiSinkObjectClass,
141 widget, args, *num_args );
143 if (w->core.height == DEFAULT_TEXT_HEIGHT)
144 w->core.height = VMargins(w) + XawTextSinkMaxHeight(w->text.sink, 1);
146 for (i=0, tab=0 ; i < TAB_COUNT ; i++)
147 tabs[i] = (tab += 8);
149 XawTextSinkSetTabs(w->text.sink, TAB_COUNT, tabs);
151 XawTextDisableRedisplay(widget);
152 XawTextEnableRedisplay(widget);
155 static void
156 Destroy(w)
157 Widget w;
159 XtDestroyWidget( ((AsciiWidget)w)->text.source);
160 XtDestroyWidget( ((AsciiWidget)w)->text.sink );
163 #ifdef ASCII_STRING
165 /************************************************************
167 * Ascii String Compatibility Code.
169 ************************************************************/
171 AsciiStringClassRec asciiStringClassRec = {
172 { /* core fields */
173 /* superclass */ (WidgetClass) &asciiTextClassRec,
174 /* class_name */ "Text",
175 /* widget_size */ sizeof(AsciiStringRec),
176 /* class_initialize */ NULL,
177 /* class_part_init */ NULL,
178 /* class_inited */ FALSE,
179 /* initialize */ NULL,
180 /* initialize_hook */ NULL,
181 /* realize */ XtInheritRealize,
182 /* actions */ textActionsTable,
183 /* num_actions */ 0,
184 /* resources */ NULL,
185 /* num_ resource */ 0,
186 /* xrm_class */ NULLQUARK,
187 /* compress_motion */ TRUE,
188 /* compress_exposure*/ XtExposeGraphicsExpose,
189 /* compress_enterleave*/ TRUE,
190 /* visible_interest */ FALSE,
191 /* destroy */ NULL,
192 /* resize */ XtInheritResize,
193 /* expose */ XtInheritExpose,
194 /* set_values */ NULL,
195 /* set_values_hook */ NULL,
196 /* set_values_almost*/ XtInheritSetValuesAlmost,
197 /* get_values_hook */ NULL,
198 /* accept_focus */ XtInheritAcceptFocus,
199 /* version */ XtVersion,
200 /* callback_private */ NULL,
201 /* tm_table */ XtInheritTranslations,
202 /* query_geometry */ XtInheritQueryGeometry
204 { /* Simple fields */
205 /* change_sensitive */ XtInheritChangeSensitive
207 { /* text fields */
208 /* empty */ 0
210 { /* ascii fields */
211 /* empty */ 0
215 WidgetClass asciiStringWidgetClass = (WidgetClass)&asciiStringClassRec;
217 #endif /* ASCII_STRING */
219 #ifdef ASCII_DISK
221 /************************************************************
223 * Ascii Disk Compatibility Code.
225 ************************************************************/
227 AsciiDiskClassRec asciiDiskClassRec = {
228 { /* core fields */
229 /* superclass */ (WidgetClass) &asciiTextClassRec,
230 /* class_name */ "Text",
231 /* widget_size */ sizeof(AsciiDiskRec),
232 /* class_initialize */ NULL,
233 /* class_part_init */ NULL,
234 /* class_inited */ FALSE,
235 /* initialize */ NULL,
236 /* initialize_hook */ NULL,
237 /* realize */ XtInheritRealize,
238 /* actions */ textActionsTable,
239 /* num_actions */ 0,
240 /* resources */ NULL,
241 /* num_ resource */ 0,
242 /* xrm_class */ NULLQUARK,
243 /* compress_motion */ TRUE,
244 /* compress_exposure*/ XtExposeGraphicsExpose,
245 /* compress_enterleave*/ TRUE,
246 /* visible_interest */ FALSE,
247 /* destroy */ NULL,
248 /* resize */ XtInheritResize,
249 /* expose */ XtInheritExpose,
250 /* set_values */ NULL,
251 /* set_values_hook */ NULL,
252 /* set_values_almost*/ XtInheritSetValuesAlmost,
253 /* get_values_hook */ NULL,
254 /* accept_focus */ XtInheritAcceptFocus,
255 /* version */ XtVersion,
256 /* callback_private */ NULL,
257 /* tm_table */ XtInheritTranslations,
258 /* query_geometry */ XtInheritQueryGeometry
260 { /* Simple fields */
261 /* change_sensitive */ XtInheritChangeSensitive
263 { /* text fields */
264 /* empty */ 0
266 { /* ascii fields */
267 /* empty */ 0
271 WidgetClass asciiDiskWidgetClass = (WidgetClass)&asciiDiskClassRec;
273 #endif /* ASCII_DISK */