17a84e134Smrg/*********************************************************** 27a84e134Smrg 37a84e134SmrgCopyright 1987, 1988, 1994, 1998 The Open Group 47a84e134Smrg 57a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its 67a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that 77a84e134Smrgthe above copyright notice appear in all copies and that both that 87a84e134Smrgcopyright notice and this permission notice appear in supporting 97a84e134Smrgdocumentation. 107a84e134Smrg 117a84e134SmrgThe above copyright notice and this permission notice shall be included in 127a84e134Smrgall copies or substantial portions of the Software. 137a84e134Smrg 147a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 157a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 167a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 177a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 187a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 197a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 207a84e134Smrg 217a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be 227a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings 237a84e134Smrgin this Software without prior written authorization from The Open Group. 247a84e134Smrg 257a84e134Smrg 267a84e134SmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 277a84e134Smrg 287a84e134Smrg All Rights Reserved 297a84e134Smrg 30421c997bSmrgPermission to use, copy, modify, and distribute this software and its 31421c997bSmrgdocumentation for any purpose and without fee is hereby granted, 327a84e134Smrgprovided that the above copyright notice appear in all copies and that 33421c997bSmrgboth that copyright notice and this permission notice appear in 347a84e134Smrgsupporting documentation, and that the name of Digital not be 357a84e134Smrgused in advertising or publicity pertaining to distribution of the 36421c997bSmrgsoftware without specific, written prior permission. 377a84e134Smrg 387a84e134SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 397a84e134SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 407a84e134SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 417a84e134SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 427a84e134SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 437a84e134SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 447a84e134SmrgSOFTWARE. 457a84e134Smrg 467a84e134Smrg******************************************************************/ 477a84e134Smrg 487a84e134Smrg#ifndef _XawTextSrc_h 497a84e134Smrg#define _XawTextSrc_h 507a84e134Smrg 517a84e134Smrg#include <X11/Xaw/Text.h> 527a84e134Smrg 537a84e134Smrg/* Resources: 547a84e134Smrg 557a84e134Smrg Name Class RepType Default Value 567a84e134Smrg ---- ----- ------- ------------- 577a84e134Smrg callback Callback Callback NULL 587a84e134Smrg editType EditType XawTextEditType XawtextRead 597a84e134Smrg enableUndo Undo Boolean False 607a84e134Smrg sourceChanged Changed Boolean False 617a84e134Smrg 627a84e134Smrg*/ 63421c997bSmrg 647a84e134Smrg/* Class record constants */ 657a84e134Smrgextern WidgetClass textSrcObjectClass; 667a84e134Smrg 677a84e134Smrgtypedef struct _TextSrcClassRec *TextSrcObjectClass; 687a84e134Smrgtypedef struct _TextSrcRec *TextSrcObject; 697a84e134Smrg 707a84e134Smrgtypedef enum { 717a84e134Smrg XawstPositions, 727a84e134Smrg XawstWhiteSpace, 737a84e134Smrg XawstEOL, 747a84e134Smrg XawstParagraph, 757a84e134Smrg XawstAll, 767a84e134Smrg XawstAlphaNumeric 777a84e134Smrg } XawTextScanType; 787a84e134Smrg 797a84e134Smrgtypedef enum { 807a84e134Smrg Normal, 817a84e134Smrg Selected 827a84e134Smrg} highlightType; 837a84e134Smrg 847a84e134Smrgtypedef enum { 857a84e134Smrg XawsmTextSelect, 867a84e134Smrg XawsmTextExtend 877a84e134Smrg} XawTextSelectionMode; 887a84e134Smrg 897a84e134Smrgtypedef enum { 907a84e134Smrg XawactionStart, 917a84e134Smrg XawactionAdjust, 927a84e134Smrg XawactionEnd 937a84e134Smrg} XawTextSelectionAction; 947a84e134Smrg 957a84e134Smrg#define XawTextReadError -1 967a84e134Smrg#define XawTextScanError -1 977a84e134Smrg 987a84e134Smrg#ifndef OLDXAW 997a84e134Smrg#define XtNenableUndo "enableUndo" 1007a84e134Smrg#define XtCUndo "Undo" 1017a84e134Smrg 1027a84e134Smrg#define XtNsourceChanged "sourceChanged" 1037a84e134Smrg#define XtCChanged "Changed" 1047a84e134Smrg 1057a84e134Smrg#define XtNpropertyCallback "propertyCallback" 1067a84e134Smrg#endif 1077a84e134Smrg 1087a84e134Smrg/* 1097a84e134Smrg * Public Functions 1107a84e134Smrg */ 1117a84e134Smrg_XFUNCPROTOBEGIN 1127a84e134Smrg 1137a84e134Smrg/* 1147a84e134Smrg * Function: 1157a84e134Smrg * XawTextSourceRead 1167a84e134Smrg * 1177a84e134Smrg * Parameters: 1187a84e134Smrg * w - TextSrc Object 1195b16253fSmrg * pos - position of the text to retrieve 1207a84e134Smrg * text - text block that will contain returned text 1217a84e134Smrg * length - maximum number of characters to read 1227a84e134Smrg * 1237a84e134Smrg * Description: 1247a84e134Smrg * This function reads the source. 1257a84e134Smrg * 1267a84e134Smrg * Returns: 1277a84e134Smrg * The number of characters read into the buffer 1287a84e134Smrg */ 1297a84e134SmrgXawTextPosition XawTextSourceRead 1307a84e134Smrg( 1317a84e134Smrg Widget w, 1327a84e134Smrg XawTextPosition pos, 1337a84e134Smrg XawTextBlock *text_return, 1347a84e134Smrg int length 1357a84e134Smrg ); 1367a84e134Smrg 1377a84e134Smrg/* 1387a84e134Smrg * Function: 1397a84e134Smrg * XawTextSourceReplace 1407a84e134Smrg * 1417a84e134Smrg * Parameters: 1427a84e134Smrg * src - Text Source Object 1437a84e134Smrg * startPos - ends of text that will be removed 1447a84e134Smrg * endPos - "" 1457a84e134Smrg * text - new text to be inserted into buffer at startPos 1467a84e134Smrg * 1477a84e134Smrg * Description: 1487a84e134Smrg * Replaces a block of text with new text 1497a84e134Smrg * 1507a84e134Smrg * Returns: 1517a84e134Smrg * XawEditError or XawEditDone 1527a84e134Smrg */ 1537a84e134Smrgint XawTextSourceReplace 1547a84e134Smrg( 1557a84e134Smrg Widget w, 1567a84e134Smrg XawTextPosition start, 1577a84e134Smrg XawTextPosition end, 1587a84e134Smrg XawTextBlock *text 1597a84e134Smrg ); 1607a84e134Smrg 1617a84e134Smrg/* 1627a84e134Smrg * Function: 1637a84e134Smrg * XawTextSourceScan 1647a84e134Smrg * 1657a84e134Smrg * Parameters: 1667a84e134Smrg * w - TextSrc Object 1677a84e134Smrg * position - position to start scanning 1687a84e134Smrg * type - type of thing to scan for 1697a84e134Smrg * dir - direction to scan 1705b16253fSmrg * count - which occurrence if this thing to search for 1717a84e134Smrg * include - whether or not to include the character found in 172421c997bSmrg * the position that is returned. 1737a84e134Smrg * 1747a84e134Smrg * Description: 1757a84e134Smrg * Scans the text source for the number and type of item specified. 1767a84e134Smrg * 1777a84e134Smrg * Returns: 1787a84e134Smrg * The position of the text 1797a84e134Smrg */ 1807a84e134SmrgXawTextPosition XawTextSourceScan 1817a84e134Smrg( 1827a84e134Smrg Widget w, 1837a84e134Smrg XawTextPosition position, 1847a84e134Smrg#if NeedWidePrototypes 1857a84e134Smrg int type, 1867a84e134Smrg int dir, 1877a84e134Smrg int count, 1887a84e134Smrg int include 1897a84e134Smrg#else 1907a84e134Smrg XawTextScanType type, 1917a84e134Smrg XawTextScanDirection dir, 1927a84e134Smrg int count, 1937a84e134Smrg Boolean include 1947a84e134Smrg#endif 1957a84e134Smrg ); 1967a84e134Smrg 1977a84e134Smrg/* 1987a84e134Smrg * Function: 1997a84e134Smrg * XawTextSourceSearch 2007a84e134Smrg * 2017a84e134Smrg * Parameters: 2027a84e134Smrg * w - TextSource Object 2037a84e134Smrg * position - position to start scanning 2047a84e134Smrg * dir - direction to search 2057a84e134Smrg * text - the text block to search for 2067a84e134Smrg * 2077a84e134Smrg * Description: 2085b16253fSmrg * Searches the text source for the text block passed. 2097a84e134Smrg * 2107a84e134Smrg * Returns: 2117a84e134Smrg * The position of the text we are searching for or XawTextSearchError 2127a84e134Smrg */ 2137a84e134SmrgXawTextPosition XawTextSourceSearch 2147a84e134Smrg( 2157a84e134Smrg Widget w, 2167a84e134Smrg XawTextPosition position, 2177a84e134Smrg#if NeedWidePrototypes 2187a84e134Smrg int dir, 2197a84e134Smrg#else 2207a84e134Smrg XawTextScanDirection dir, 2217a84e134Smrg#endif 2227a84e134Smrg XawTextBlock *text 2237a84e134Smrg ); 2247a84e134Smrg 2257a84e134Smrg/* 2267a84e134Smrg * Function: 2277a84e134Smrg * XawTextSourceConvertSelection 2287a84e134Smrg * 2297a84e134Smrg * Parameters: 2307a84e134Smrg * w - TextSrc object 2317a84e134Smrg * selection - current selection atom 2327a84e134Smrg * target - current target atom 2335b16253fSmrg * type - type to convert the selection to 2347a84e134Smrg * value - return value that has been converted 2357a84e134Smrg * length - "" 2367a84e134Smrg * format - format of the returned value 2377a84e134Smrg * 2387a84e134Smrg * Returns: 2397a84e134Smrg * True if the selection has been converted 2407a84e134Smrg */ 2417a84e134SmrgBoolean XawTextSourceConvertSelection 2427a84e134Smrg( 2437a84e134Smrg Widget w, 2447a84e134Smrg Atom *selection, 2457a84e134Smrg Atom *target, 2467a84e134Smrg Atom *type, 2477a84e134Smrg XtPointer *value_return, 2487a84e134Smrg unsigned long *length_return, 2497a84e134Smrg int *format_return 2507a84e134Smrg ); 2517a84e134Smrg 2527a84e134Smrg/* 2537a84e134Smrg * Function: 2547a84e134Smrg * XawTextSourceSetSelection 2557a84e134Smrg * 2567a84e134Smrg * Parameters: 2577a84e134Smrg * w - TextSrc object 2587a84e134Smrg * left - bounds of the selection 2597a84e134Smrg * right - "" 2607a84e134Smrg * selection - selection atom 2617a84e134Smrg * 2627a84e134Smrg * Description: 2637a84e134Smrg * Allows special setting of the selection. 2647a84e134Smrg */ 2657a84e134Smrgvoid XawTextSourceSetSelection 2667a84e134Smrg( 2677a84e134Smrg Widget w, 2687a84e134Smrg XawTextPosition start, 2697a84e134Smrg XawTextPosition end, 2707a84e134Smrg Atom selection 2717a84e134Smrg ); 2727a84e134Smrg 2737a84e134Smrg_XFUNCPROTOEND 2747a84e134Smrg 2757a84e134Smrg#endif /* _XawTextSrc_h */ 276