home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / include / x11 / xaw / textsrc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-17  |  7.7 KB  |  238 lines

  1. /*
  2.  * $XConsortium: TextSrc.h,v 1.11 94/04/17 20:13:15 kaleb Exp $
  3.  */
  4.  
  5. /***********************************************************
  6.  
  7. Copyright (c) 1987, 1988, 1994  X Consortium
  8.  
  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:
  15.  
  16. The above copyright notice and this permission notice shall be included in
  17. all copies or substantial portions of the Software.
  18.  
  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.
  25.  
  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.
  29.  
  30.  
  31. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
  32.  
  33.                         All Rights Reserved
  34.  
  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.  
  42.  
  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
  49. SOFTWARE.
  50.  
  51. ******************************************************************/
  52.  
  53. #ifndef _XawTextSrc_h
  54. #define _XawTextSrc_h
  55.  
  56. /***********************************************************************
  57.  *
  58.  * TextSrc Object
  59.  *
  60.  ***********************************************************************/
  61.  
  62. #include <X11/Xaw/Text.h>
  63.  
  64. /* Resources:
  65.  
  66.  Name             Class        RepType        Default Value
  67.  ----             -----        -------        -------------
  68.  editType         EditType        XawTextEditType    XawtextRead
  69.  
  70. */
  71.  
  72. /* Class record constants */
  73.  
  74. extern WidgetClass textSrcObjectClass;
  75.  
  76. typedef struct _TextSrcClassRec *TextSrcObjectClass;
  77. typedef struct _TextSrcRec      *TextSrcObject;
  78.  
  79. typedef enum {XawstPositions, XawstWhiteSpace, XawstEOL, XawstParagraph,
  80.               XawstAll} XawTextScanType;
  81. typedef enum {Normal, Selected }highlightType;
  82. typedef enum {XawsmTextSelect, XawsmTextExtend} XawTextSelectionMode;
  83. typedef enum {XawactionStart, XawactionAdjust, XawactionEnd}
  84.     XawTextSelectionAction;
  85.  
  86. /*
  87.  * Error Conditions:
  88.  */
  89.  
  90. #define XawTextReadError -1
  91. #define XawTextScanError -1
  92.  
  93. /************************************************************
  94.  *
  95.  * Public Functions.
  96.  *
  97.  ************************************************************/
  98.  
  99. _XFUNCPROTOBEGIN
  100.  
  101. /*    Function Name: XawTextSourceRead
  102.  *    Description: This function reads the source.
  103.  *    Arguments: w - the TextSrc Object.
  104.  *                 pos - position of the text to retreive.
  105.  * RETURNED        text - text block that will contain returned text.
  106.  *                 length - maximum number of characters to read.
  107.  *    Returns: The number of characters read into the buffer.
  108.  */
  109.  
  110. extern XawTextPosition XawTextSourceRead(
  111. #if NeedFunctionPrototypes
  112.     Widget        /* w */,
  113.     XawTextPosition    /* pos */,
  114.     XawTextBlock*    /* text_return */,
  115.     int            /* length */
  116. #endif
  117. );
  118.  
  119. /*    Function Name: XawTextSourceReplace.
  120.  *    Description: Replaces a block of text with new text.
  121.  *    Arguments: src - the Text Source Object.
  122.  *                 startPos, endPos - ends of text that will be removed.
  123.  *                 text - new text to be inserted into buffer at startPos.
  124.  *    Returns: XawEditError or XawEditDone.
  125.  */
  126.  
  127. extern int XawTextSourceReplace (
  128. #if NeedFunctionPrototypes
  129.     Widget        /* w */,
  130.     XawTextPosition    /* start */,
  131.     XawTextPosition    /* end */,
  132.     XawTextBlock*    /* text */
  133. #endif
  134. );
  135.  
  136. /*    Function Name: XawTextSourceScan
  137.  *    Description: Scans the text source for the number and type
  138.  *                   of item specified.
  139.  *    Arguments: w - the TextSrc Object.
  140.  *                 position - the position to start scanning.
  141.  *                 type - type of thing to scan for.
  142.  *                 dir - direction to scan.
  143.  *                 count - which occurance if this thing to search for.
  144.  *                 include - whether or not to include the character found in
  145.  *                           the position that is returned. 
  146.  *    Returns: The position of the text.
  147.  *
  148.  */
  149.  
  150. extern XawTextPosition XawTextSourceScan(
  151. #if NeedFunctionPrototypes
  152.     Widget        /* w */,
  153.     XawTextPosition    /* position */,
  154. #if NeedWidePrototypes
  155.     /* XawTextScanType */ int        /* type */,
  156.     /* XawTextScanDirection */ int    /* dir */,
  157. #else
  158.     XawTextScanType    /* type */,
  159.     XawTextScanDirection /* dir */,
  160. #endif
  161.     int            /* count */,
  162. #if NeedWidePrototypes
  163.     /* Boolean */ int    /* include */
  164. #else
  165.     Boolean        /* include */
  166. #endif
  167. #endif
  168. );
  169.  
  170. /*    Function Name: XawTextSourceSearch
  171.  *    Description: Searchs the text source for the text block passed
  172.  *    Arguments: w - the TextSource Object.
  173.  *                 position - the position to start scanning.
  174.  *                 dir - direction to scan.
  175.  *                 text - the text block to search for.
  176.  *    Returns: The position of the text we are searching for or
  177.  *               XawTextSearchError.
  178.  */
  179.  
  180. extern XawTextPosition XawTextSourceSearch(
  181. #if NeedFunctionPrototypes
  182.     Widget        /* w */,
  183.     XawTextPosition    /* position */,
  184. #if NeedWidePrototypes
  185.     /* XawTextScanDirection */ int    /* dir */,
  186. #else
  187.     XawTextScanDirection /* dir */,
  188. #endif
  189.     XawTextBlock*    /* text */
  190. #endif
  191. );
  192.  
  193. /*    Function Name: XawTextSourceConvertSelection
  194.  *    Description: Dummy selection converter.
  195.  *    Arguments: w - the TextSrc object.
  196.  *                 selection - the current selection atom.
  197.  *                 target    - the current target atom.
  198.  *                 type      - the type to conver the selection to.
  199.  * RETURNED        value, length - the return value that has been converted.
  200.  * RETURNED        format    - the format of the returned value.
  201.  *    Returns: TRUE if the selection has been converted.
  202.  *
  203.  */
  204.  
  205. extern Boolean XawTextSourceConvertSelection(
  206. #if NeedFunctionPrototypes
  207.     Widget        /* w */,
  208.     Atom*        /* selection */,
  209.     Atom*        /* target */,
  210.     Atom*        /* type */,
  211.     XtPointer*        /* value_return */,
  212.     unsigned long*    /* length_return */,
  213.     int*        /* format_return */
  214. #endif
  215. );
  216.  
  217. /*    Function Name: XawTextSourceSetSelection
  218.  *    Description: allows special setting of the selection.
  219.  *    Arguments: w - the TextSrc object.
  220.  *                 left, right - bounds of the selection.
  221.  *                 selection - the selection atom.
  222.  *    Returns: none
  223.  */
  224.  
  225. extern void XawTextSourceSetSelection(
  226. #if NeedFunctionPrototypes
  227.     Widget        /* w */,
  228.     XawTextPosition    /* start */,
  229.     XawTextPosition    /* end */,
  230.     Atom        /* selection */
  231. #endif
  232. );
  233.  
  234. _XFUNCPROTOEND
  235.  
  236. #endif /* _XawTextSrc_h */
  237. /* DON'T ADD STUFF AFTER THIS #endif */
  238.