2 * $XConsortium: TextSink.h,v 1.10 94/04/17 20:13:12 kaleb Exp $
5 /***********************************************************
7 Copyright (c) 1987, 1988, 1994 X Consortium
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 Except as contained in this notice, the name of the X Consortium shall not be
27 used in advertising or otherwise to promote the sale, use or other dealings
28 in this Software without prior written authorization from the X Consortium.
31 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
35 Permission to use, copy, modify, and distribute this software and its
36 documentation for any purpose and without fee is hereby granted,
37 provided that the above copyright notice appear in all copies and that
38 both that copyright notice and this permission notice appear in
39 supporting documentation, and that the name of Digital not be
40 used in advertising or publicity pertaining to distribution of the
41 software without specific, written prior permission.
43 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
44 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
45 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
46 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
47 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
48 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
51 ******************************************************************/
53 #ifndef _XawTextSink_h
54 #define _XawTextSink_h
56 #include <X11/Xaw/Text.h>
58 /***********************************************************************
62 ***********************************************************************/
66 Name Class RepType Default Value
67 ---- ----- ------- -------------
68 font Font XFontStruct * XtDefaultFont
69 foreground Foreground Pixel XtDefaultForeground
70 background Background Pixel XtDefaultBackground
74 /* Class record constants */
76 extern WidgetClass textSinkObjectClass
;
78 typedef struct _TextSinkClassRec
*TextSinkObjectClass
;
79 typedef struct _TextSinkRec
*TextSinkObject
;
81 typedef enum {XawisOn
, XawisOff
} XawTextInsertState
;
83 /************************************************************
87 ************************************************************/
91 /* Function Name: XawTextSinkDisplayText
92 * Description: Stub function that in subclasses will display text.
93 * Arguments: w - the TextSink Object.
94 * x, y - location to start drawing text.
95 * pos1, pos2 - location of starting and ending points
97 * highlight - hightlight this text?
100 * This function doesn't actually display anything, it is only a place
104 extern void XawTextSinkDisplayText(
105 #if NeedFunctionPrototypes
107 #if NeedWidePrototypes
108 /* Position */ int /* x */,
109 /* Position */ int /* y */,
114 XawTextPosition
/* pos1 */,
115 XawTextPosition
/* pos2 */,
116 #if NeedWidePrototypes
117 /* Boolean */ int /* highlight */
119 Boolean
/* highlight */
124 /* Function Name: XawTextSinkInsertCursor
125 * Description: Places the InsertCursor.
126 * Arguments: w - the TextSink Object.
127 * x, y - location for the cursor.
128 * staye - whether to turn the cursor on, or off.
131 * This function doesn't actually display anything, it is only a place
135 extern void XawTextSinkInsertCursor(
136 #if NeedFunctionPrototypes
138 #if NeedWidePrototypes
139 /* Position */ int /* x */,
140 /* Position */ int /* y */,
141 /* XawTextInsertState */ int /* state */
145 XawTextInsertState
/* state */
150 /* Function Name: XawTextSinkClearToBackground
151 * Description: Clears a region of the sink to the background color.
152 * Arguments: w - the TextSink Object.
153 * x, y - location of area to clear.
154 * width, height - size of area to clear
157 * This function doesn't actually display anything, it is only a place
161 extern void XawTextSinkClearToBackground(
162 #if NeedFunctionPrototypes
164 #if NeedWidePrototypes
165 /* Position */ int /* x */,
166 /* Position */ int /* y */,
167 /* Dimension */ int /* width */,
168 /* Dimension */ int /* height */
172 Dimension
/* width */,
173 Dimension
/* height */
178 /* Function Name: XawTextSinkFindPosition
179 * Description: Finds a position in the text.
180 * Arguments: w - the TextSink Object.
181 * fromPos - reference position.
182 * fromX - reference location.
183 * width, - width of section to paint text.
184 * stopAtWordBreak - returned position is a word break?
185 * resPos - Position to return. *** RETURNED ***
186 * resWidth - Width actually used. *** RETURNED ***
187 * resHeight - Height actually used. *** RETURNED ***
188 * Returns: none (see above).
191 extern void XawTextSinkFindPosition(
192 #if NeedFunctionPrototypes
194 XawTextPosition
/* fromPos */,
197 #if NeedWidePrototypes
198 /* Boolean */ int /* stopAtWordBreak */,
200 Boolean
/* stopAtWordBreak */,
202 XawTextPosition
* /* pos_return */,
203 int* /* width_return */,
204 int* /* height_return */
208 /* Function Name: XawTextSinkFindDistance
209 * Description: Find the Pixel Distance between two text Positions.
210 * Arguments: w - the TextSink Object.
211 * fromPos - starting Position.
212 * fromX - x location of starting Position.
213 * toPos - end Position.
214 * resWidth - Distance between fromPos and toPos.
215 * resPos - Acutal toPos used.
216 * resHeight - Height required by this text.
220 extern void XawTextSinkFindDistance (
221 #if NeedFunctionPrototypes
223 XawTextPosition
/* fromPos */,
225 XawTextPosition
/* toPos */,
226 int* /* width_return */,
227 XawTextPosition
* /* pos_return */,
228 int* /* height_return */
232 /* Function Name: XawTextSinkResolve
233 * Description: Resloves a location to a position.
234 * Arguments: w - the TextSink Object.
235 * pos - a reference Position.
236 * fromx - a reference Location.
237 * width - width to move.
238 * resPos - the resulting position.
242 extern void XawTextSinkResolve(
243 #if NeedFunctionPrototypes
245 XawTextPosition
/* fromPos */,
248 XawTextPosition
* /* pos_return */
252 /* Function Name: XawTextSinkMaxLines
253 * Description: Finds the Maximum number of lines that will fit in
255 * Arguments: w - the TextSink Object.
256 * height - height to fit lines into.
257 * Returns: the number of lines that will fit.
260 extern int XawTextSinkMaxLines(
261 #if NeedFunctionPrototypes
263 #if NeedWidePrototypes
264 /* Dimension */ int /* height */
266 Dimension
/* height */
271 /* Function Name: XawTextSinkMaxHeight
272 * Description: Finds the Minium height that will contain a given number
274 * Arguments: w - the TextSink Object.
275 * lines - the number of lines.
276 * Returns: the height.
279 extern int XawTextSinkMaxHeight(
280 #if NeedFunctionPrototypes
286 /* Function Name: XawTextSinkSetTabs
287 * Description: Sets the Tab stops.
288 * Arguments: w - the TextSink Object.
289 * tab_count - the number of tabs in the list.
290 * tabs - the text positions of the tabs.
294 extern void XawTextSinkSetTabs(
295 #if NeedFunctionPrototypes
302 /* Function Name: XawTextSinkGetCursorBounds
303 * Description: Finds the bounding box for the insert curor (caret).
304 * Arguments: w - the TextSinkObject.
305 * rect - an X rectance containing the cursor bounds.
306 * Returns: none (fills in rect).
309 extern void XawTextSinkGetCursorBounds(
310 #if NeedFunctionPrototypes
312 XRectangle
* /* rect_return */
318 #endif /* _XawTextSrc_h */