2 * $XConsortium: TextSink.h,v 1.5 89/11/01 17:28:26 kit Exp $
5 /***********************************************************
6 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
7 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
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
27 ******************************************************************/
29 #ifndef _XawTextSink_h
30 #define _XawTextSink_h
32 /***********************************************************************
36 ***********************************************************************/
38 #include <X11/Object.h>
42 Name Class RepType Default Value
43 ---- ----- ------- -------------
44 font Font XFontStruct * XtDefaultFont
45 foreground Foreground Pixel XtDefaultForeground
46 background Background Pixel XtDefaultBackground
50 /* Class record constants */
52 extern WidgetClass textSinkObjectClass
;
54 typedef struct _TextSinkClassRec
*TextSinkObjectClass
;
55 typedef struct _TextSinkRec
*TextSinkObject
;
57 typedef enum {XawisOn
, XawisOff
} XawTextInsertState
;
59 /************************************************************
63 ************************************************************/
65 /* Function Name: XawTextSinkDisplayText
66 * Description: Stub function that in subclasses will display text.
67 * Arguments: w - the TextSink Object.
68 * x, y - location to start drawing text.
69 * pos1, pos2 - location of starting and ending points
71 * highlight - hightlight this text?
74 * This function doesn't actually display anything, it is only a place
78 void XawTextSinkDisplayText(/* w, x, y, pos1, pos2, highlight */);
83 XawTextPosition pos1, pos2;
86 /* Function Name: XawTextSinkInsertCursor
87 * Description: Places the InsertCursor.
88 * Arguments: w - the TextSink Object.
89 * x, y - location for the cursor.
90 * staye - whether to turn the cursor on, or off.
93 * This function doesn't actually display anything, it is only a place
97 void XawTextSinkInsertCursor( /* w, x, y, state */ );
101 XawTextInsertState state;
104 /* Function Name: XawTextSinkClearToBackground
105 * Description: Clears a region of the sink to the background color.
106 * Arguments: w - the TextSink Object.
107 * x, y - location of area to clear.
108 * width, height - size of area to clear
111 * This function doesn't actually display anything, it is only a place
115 void XawTextSinkClearToBackground (/* w, x, y, width, height */);
119 Dimension width, height;
122 /* Function Name: XawTextSinkFindPosition
123 * Description: Finds a position in the text.
124 * Arguments: w - the TextSink Object.
125 * fromPos - reference position.
126 * fromX - reference location.
127 * width, - width of section to paint text.
128 * stopAtWordBreak - returned position is a word break?
129 * resPos - Position to return. *** RETURNED ***
130 * resWidth - Width actually used. *** RETURNED ***
131 * resHeight - Height actually used. *** RETURNED ***
132 * Returns: none (see above).
135 void XawTextSinkFindPosition(/* w, fromPos, fromx, width, stopAtWordBreak,
136 resPos, resWidth, resHeight */ );
139 XawTextPosition fromPos;
141 Boolean stopAtWordBreak;
142 XawTextPosition *resPos;
143 int *resWidth, *resHeight;
146 /* Function Name: XawTextSinkFindDistance
147 * Description: Find the Pixel Distance between two text Positions.
148 * Arguments: w - the TextSink Object.
149 * fromPos - starting Position.
150 * fromX - x location of starting Position.
151 * toPos - end Position.
152 * resWidth - Distance between fromPos and toPos.
153 * resPos - Acutal toPos used.
154 * resHeight - Height required by this text.
158 void XawTextSinkFindDistance (/* w, fromPos, fromx,
159 toPos, resWidth, resPos, resHeight */);
162 XawTextPosition fromPos, toPos, *resPos;
163 int fromx, *resWidth, *resHeight;
166 /* Function Name: XawTextSinkResolve
167 * Description: Resloves a location to a position.
168 * Arguments: w - the TextSink Object.
169 * pos - a reference Position.
170 * fromx - a reference Location.
171 * width - width to move.
172 * resPos - the resulting position.
176 void XawTextSinkResolve(/* w, pos, fromx, width, resPos */);
181 XawTextPosition *resPos;
184 /* Function Name: XawTextSinkMaxLines
185 * Description: Finds the Maximum number of lines that will fit in
187 * Arguments: w - the TextSink Object.
188 * height - height to fit lines into.
189 * Returns: the number of lines that will fit.
192 int XawTextSinkMaxLines(/* w, height */);
198 /* Function Name: XawTextSinkMaxHeight
199 * Description: Finds the Minium height that will contain a given number
201 * Arguments: w - the TextSink Object.
202 * lines - the number of lines.
203 * Returns: the height.
206 int XawTextSinkMaxHeight(/* w, lines */);
212 /* Function Name: XawTextSinkSetTabs
213 * Description: Sets the Tab stops.
214 * Arguments: w - the TextSink Object.
215 * tab_count - the number of tabs in the list.
216 * tabs - the text positions of the tabs.
220 void XawTextSinkSetTabs(/* w, tab_count, tabs */);
223 int tab_count, *tabs;
226 /* Function Name: XawTextSinkGetCursorBounds
227 * Description: Finds the bounding box for the insert curor (caret).
228 * Arguments: w - the TextSinkObject.
229 * rect - an X rectance containing the cursor bounds.
230 * Returns: none (fills in rect).
233 void XawTextSinkGetCursorBounds(/* w, rect */);
239 #endif /* _XawTextSrc_h -- DON'T ADD STUFF AFTER THIS #endif */