00001 /* 00002 * $XConsortium: TextSink.h,v 1.10 94/04/17 20:13:12 kaleb Exp $ 00003 */ 00004 00005 /*********************************************************** 00006 00007 Copyright (c) 1987, 1988, 1994 X Consortium 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00023 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00024 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00025 00026 Except as contained in this notice, the name of the X Consortium shall not be 00027 used in advertising or otherwise to promote the sale, use or other dealings 00028 in this Software without prior written authorization from the X Consortium. 00029 00030 00031 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 00032 00033 All Rights Reserved 00034 00035 Permission to use, copy, modify, and distribute this software and its 00036 documentation for any purpose and without fee is hereby granted, 00037 provided that the above copyright notice appear in all copies and that 00038 both that copyright notice and this permission notice appear in 00039 supporting documentation, and that the name of Digital not be 00040 used in advertising or publicity pertaining to distribution of the 00041 software without specific, written prior permission. 00042 00043 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 00044 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 00045 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 00046 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 00047 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 00048 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 00049 SOFTWARE. 00050 00051 ******************************************************************/ 00052 00053 #ifndef _XawTextSink_h 00054 #define _XawTextSink_h 00055 00056 #include <X11/Xaw3d/Text.h> 00057 00058 /*********************************************************************** 00059 * 00060 * TextSink Object 00061 * 00062 ***********************************************************************/ 00063 00064 /* Resources: 00065 00066 Name Class RepType Default Value 00067 ---- ----- ------- ------------- 00068 foreground Foreground Pixel XtDefaultForeground 00069 background Background Pixel XtDefaultBackground 00070 00071 */ 00072 00073 /* Class record constants */ 00074 00075 extern WidgetClass textSinkObjectClass; 00076 00077 typedef struct _TextSinkClassRec *TextSinkObjectClass; 00078 typedef struct _TextSinkRec *TextSinkObject; 00079 00080 typedef enum {XawisOn, XawisOff} XawTextInsertState; 00081 00082 /************************************************************ 00083 * 00084 * Public Functions. 00085 * 00086 ************************************************************/ 00087 00088 _XFUNCPROTOBEGIN 00089 00090 /* Function Name: XawTextSinkDisplayText 00091 * Description: Stub function that in subclasses will display text. 00092 * Arguments: w - the TextSink Object. 00093 * x, y - location to start drawing text. 00094 * pos1, pos2 - location of starting and ending points 00095 * in the text buffer. 00096 * highlight - hightlight this text? 00097 * Returns: none. 00098 * 00099 * This function doesn't actually display anything, it is only a place 00100 * holder. 00101 */ 00102 00103 extern void XawTextSinkDisplayText( 00104 #if NeedFunctionPrototypes 00105 Widget /* w */, 00106 #if NeedWidePrototypes 00107 /* Position */ int /* x */, 00108 /* Position */ int /* y */, 00109 #else 00110 Position /* x */, 00111 Position /* y */, 00112 #endif 00113 XawTextPosition /* pos1 */, 00114 XawTextPosition /* pos2 */, 00115 #if NeedWidePrototypes 00116 /* Boolean */ int /* highlight */ 00117 #else 00118 Boolean /* highlight */ 00119 #endif 00120 #endif 00121 ); 00122 00123 /* Function Name: XawTextSinkInsertCursor 00124 * Description: Places the InsertCursor. 00125 * Arguments: w - the TextSink Object. 00126 * x, y - location for the cursor. 00127 * staye - whether to turn the cursor on, or off. 00128 * Returns: none. 00129 * 00130 * This function doesn't actually display anything, it is only a place 00131 * holder. 00132 */ 00133 00134 extern void XawTextSinkInsertCursor( 00135 #if NeedFunctionPrototypes 00136 Widget /* w */, 00137 #if NeedWidePrototypes 00138 /* Position */ int /* x */, 00139 /* Position */ int /* y */, 00140 /* XawTextInsertState */ int /* state */ 00141 #else 00142 Position /* x */, 00143 Position /* y */, 00144 XawTextInsertState /* state */ 00145 #endif 00146 #endif 00147 ); 00148 00149 /* Function Name: XawTextSinkClearToBackground 00150 * Description: Clears a region of the sink to the background color. 00151 * Arguments: w - the TextSink Object. 00152 * x, y - location of area to clear. 00153 * width, height - size of area to clear 00154 * Returns: void. 00155 * 00156 * This function doesn't actually display anything, it is only a place 00157 * holder. 00158 */ 00159 00160 extern void XawTextSinkClearToBackground( 00161 #if NeedFunctionPrototypes 00162 Widget /* w */, 00163 #if NeedWidePrototypes 00164 /* Position */ int /* x */, 00165 /* Position */ int /* y */, 00166 /* Dimension */ int /* width */, 00167 /* Dimension */ int /* height */ 00168 #else 00169 Position /* x */, 00170 Position /* y */, 00171 Dimension /* width */, 00172 Dimension /* height */ 00173 #endif 00174 #endif 00175 ); 00176 00177 /* Function Name: XawTextSinkFindPosition 00178 * Description: Finds a position in the text. 00179 * Arguments: w - the TextSink Object. 00180 * fromPos - reference position. 00181 * fromX - reference location. 00182 * width, - width of section to paint text. 00183 * stopAtWordBreak - returned position is a word break? 00184 * resPos - Position to return. *** RETURNED *** 00185 * resWidth - Width actually used. *** RETURNED *** 00186 * resHeight - Height actually used. *** RETURNED *** 00187 * Returns: none (see above). 00188 */ 00189 00190 extern void XawTextSinkFindPosition( 00191 #if NeedFunctionPrototypes 00192 Widget /* w */, 00193 XawTextPosition /* fromPos */, 00194 int /* fromX */, 00195 int /* width */, 00196 #if NeedWidePrototypes 00197 /* Boolean */ int /* stopAtWordBreak */, 00198 #else 00199 Boolean /* stopAtWordBreak */, 00200 #endif 00201 XawTextPosition* /* pos_return */, 00202 int* /* width_return */, 00203 int* /* height_return */ 00204 #endif 00205 ); 00206 00207 /* Function Name: XawTextSinkFindDistance 00208 * Description: Find the Pixel Distance between two text Positions. 00209 * Arguments: w - the TextSink Object. 00210 * fromPos - starting Position. 00211 * fromX - x location of starting Position. 00212 * toPos - end Position. 00213 * resWidth - Distance between fromPos and toPos. 00214 * resPos - Acutal toPos used. 00215 * resHeight - Height required by this text. 00216 * Returns: none. 00217 */ 00218 00219 extern void XawTextSinkFindDistance ( 00220 #if NeedFunctionPrototypes 00221 Widget /* w */, 00222 XawTextPosition /* fromPos */, 00223 int /* fromX */, 00224 XawTextPosition /* toPos */, 00225 int* /* width_return */, 00226 XawTextPosition* /* pos_return */, 00227 int* /* height_return */ 00228 #endif 00229 ); 00230 00231 /* Function Name: XawTextSinkResolve 00232 * Description: Resloves a location to a position. 00233 * Arguments: w - the TextSink Object. 00234 * pos - a reference Position. 00235 * fromx - a reference Location. 00236 * width - width to move. 00237 * resPos - the resulting position. 00238 * Returns: none 00239 */ 00240 00241 extern void XawTextSinkResolve( 00242 #if NeedFunctionPrototypes 00243 Widget /* w */, 00244 XawTextPosition /* fromPos */, 00245 int /* fromX */, 00246 int /* width */, 00247 XawTextPosition* /* pos_return */ 00248 #endif 00249 ); 00250 00251 /* Function Name: XawTextSinkMaxLines 00252 * Description: Finds the Maximum number of lines that will fit in 00253 * a given height. 00254 * Arguments: w - the TextSink Object. 00255 * height - height to fit lines into. 00256 * Returns: the number of lines that will fit. 00257 */ 00258 00259 extern int XawTextSinkMaxLines( 00260 #if NeedFunctionPrototypes 00261 Widget /* w */, 00262 #if NeedWidePrototypes 00263 /* Dimension */ int /* height */ 00264 #else 00265 Dimension /* height */ 00266 #endif 00267 #endif 00268 ); 00269 00270 /* Function Name: XawTextSinkMaxHeight 00271 * Description: Finds the Minium height that will contain a given number 00272 * lines. 00273 * Arguments: w - the TextSink Object. 00274 * lines - the number of lines. 00275 * Returns: the height. 00276 */ 00277 00278 extern int XawTextSinkMaxHeight( 00279 #if NeedFunctionPrototypes 00280 Widget /* w */, 00281 int /* lines */ 00282 #endif 00283 ); 00284 00285 /* Function Name: XawTextSinkSetTabs 00286 * Description: Sets the Tab stops. 00287 * Arguments: w - the TextSink Object. 00288 * tab_count - the number of tabs in the list. 00289 * tabs - the text positions of the tabs. 00290 * Returns: none 00291 */ 00292 00293 extern void XawTextSinkSetTabs( 00294 #if NeedFunctionPrototypes 00295 Widget /* w */, 00296 int /* tab_count */, 00297 int* /* tabs */ 00298 #endif 00299 ); 00300 00301 /* Function Name: XawTextSinkGetCursorBounds 00302 * Description: Finds the bounding box for the insert curor (caret). 00303 * Arguments: w - the TextSinkObject. 00304 * rect - an X rectance containing the cursor bounds. 00305 * Returns: none (fills in rect). 00306 */ 00307 00308 extern void XawTextSinkGetCursorBounds( 00309 #if NeedFunctionPrototypes 00310 Widget /* w */, 00311 XRectangle* /* rect_return */ 00312 #endif 00313 ); 00314 00315 _XFUNCPROTOEND 00316 00317 #endif /* _XawTextSrc_h */
1.5.1