1 /***********************************************************
3 Copyright 1987, 1988, 1994, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
26 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
30 Permission to use, copy, modify, and distribute this software and its
31 documentation for any purpose and without fee is hereby granted,
32 provided that the above copyright notice appear in all copies and that
33 both that copyright notice and this permission notice appear in
34 supporting documentation, and that the name of Digital not be
35 used in advertising or publicity pertaining to distribution of the
36 software without specific, written prior permission.
38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46 ******************************************************************/
48 #ifndef _XawTextSink_h
49 #define _XawTextSink_h
51 #include <X11/Xaw/Text.h>
53 /***********************************************************************
57 ***********************************************************************/
61 Name Class RepType Default Value
62 ---- ----- ------- -------------
63 font Font XFontStruct * XtDefaultFont
64 foreground Foreground Pixel XtDefaultForeground
65 background Background Pixel XtDefaultBackground
66 cursorColor Color Pixel XtDefaultForeground
69 /* Class record constants */
71 extern WidgetClass textSinkObjectClass;
73 typedef struct _TextSinkClassRec *TextSinkObjectClass;
74 typedef struct _TextSinkRec *TextSinkObject;
76 typedef enum {XawisOn, XawisOff} XawTextInsertState;
79 #ifndef XtNcursorColor
80 #define XtNcursorColor "cursorColor"
83 #define XawNtextProperties "textProperties"
84 #define XawCTextProperties "TextProperties"
85 #define XawRTextProperties "XawTextProperties"
95 * XawTextSinkDisplayText
98 * w - the TextSink Object
99 * x - location to start drawing text
101 * pos1 - location of starting and ending points in the text buffer
103 * highlight - hightlight this text?
106 * Stub function that in subclasses will display text.
109 * This function doesn't actually display anything, it is only a place
112 void XawTextSinkDisplayText
115 #if NeedWidePrototypes
122 XawTextPosition pos1,
123 XawTextPosition pos2,
124 #if NeedWidePrototypes
133 * XawTextSinkInsertCursor
136 * w - the TextSink Object.
137 * x - location for the cursor.
139 * state - whether to turn the cursor on, or off
142 * Places the InsertCursor.
145 * This function doesn't actually display anything, it is only a place
148 void XawTextSinkInsertCursor
151 #if NeedWidePrototypes
158 XawTextInsertState state
164 * XawTextSinkClearToBackground
167 * w - TextSink Object
168 * x - location of area to clear
170 * width - size of area to clear
174 * Clears a region of the sink to the background color.
177 * This function doesn't actually display anything, it is only a place
180 void XawTextSinkClearToBackground
183 #if NeedWidePrototypes
198 * XawTextSinkFindPosition
201 * w - TextSink Object
202 * fromPos - reference position
203 * fromX - reference location
204 * width - width of section to paint text
205 * stopAtWordBreak - returned position is a word break?
206 * resPos - Position to return
207 * resWidth - Width actually used
208 * resHeight - Height actually used
211 * Finds a position in the text.
213 void XawTextSinkFindPosition
216 XawTextPosition fromPos,
219 #if NeedWidePrototypes
222 Boolean stopAtWordBreak,
224 XawTextPosition* pos_return,
231 * XawTextSinkFindDistance
234 * w - TextSink Object
235 * fromPos - starting Position
236 * fromX - x location of starting Position
237 * toPos - end Position
238 * resWidth - Distance between fromPos and toPos
239 * resPos - Acutal toPos used
240 * resHeight - Height required by this text
243 * Find the Pixel Distance between two text Positions.
245 void XawTextSinkFindDistance
248 XawTextPosition fromPos,
250 XawTextPosition toPos,
252 XawTextPosition *pos_return,
261 * w - TextSink Object
262 * pos - reference Position
263 * fromx - reference Location
264 * width - width to move
265 * resPos - resulting position
268 * Resloves a location to a position.
270 void XawTextSinkResolve
273 XawTextPosition fromPos,
276 XawTextPosition *pos_return
281 * XawTextSinkMaxLines
284 * w - TextSink Object
285 * height - height to fit lines into
288 * Number of lines that will fit
291 * Finds the Maximum number of lines that will fit in a given height.
293 int XawTextSinkMaxLines
296 #if NeedWidePrototypes
305 * XawTextSinkMaxHeight
308 * w - TextSink Object
309 * lines - number of lines
315 * Finds the Minium height that will contain a given number lines.
317 int XawTextSinkMaxHeight
328 * w - TextSink Object
329 * tab_count - number of tabs in the list
330 * tabs - text positions of the tabs
332 * Sets the Tab stops.
334 void XawTextSinkSetTabs
343 * XawTextSinkGetCursorBounds
346 * w - TextSink Object
347 * rect - X rectance containing the cursor bounds
349 * Finds the bounding box for the insert curor (caret).
351 void XawTextSinkGetCursorBounds
354 XRectangle *rect_return
359 #endif /* _XawTextSink_h */