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

  1. /*
  2.  * $XConsortium: TextSink.h,v 1.10 94/04/17 20:13:12 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 _XawTextSink_h
  54. #define _XawTextSink_h
  55.  
  56. #include <X11/Xaw/Text.h>
  57.  
  58. /***********************************************************************
  59.  *
  60.  * TextSink Object
  61.  *
  62.  ***********************************************************************/
  63.  
  64. /* Resources:
  65.  
  66.  Name             Class        RepType        Default Value
  67.  ----             -----        -------        -------------
  68.  font                Font            XFontStruct *      XtDefaultFont
  69.  foreground          Foreground      Pixel              XtDefaultForeground
  70.  background          Background      Pixel              XtDefaultBackground
  71.  
  72. */
  73.  
  74. /* Class record constants */
  75.  
  76. extern WidgetClass textSinkObjectClass;
  77.  
  78. typedef struct _TextSinkClassRec *TextSinkObjectClass;
  79. typedef struct _TextSinkRec      *TextSinkObject;
  80.  
  81. typedef enum {XawisOn, XawisOff} XawTextInsertState;
  82.  
  83. /************************************************************
  84.  *
  85.  * Public Functions.
  86.  *
  87.  ************************************************************/
  88.  
  89. _XFUNCPROTOBEGIN
  90.  
  91. /*    Function Name: XawTextSinkDisplayText
  92.  *    Description: Stub function that in subclasses will display text. 
  93.  *    Arguments: w - the TextSink Object.
  94.  *                 x, y - location to start drawing text.
  95.  *                 pos1, pos2 - location of starting and ending points
  96.  *                              in the text buffer.
  97.  *                 highlight - hightlight this text?
  98.  *    Returns: none.
  99.  *
  100.  * This function doesn't actually display anything, it is only a place
  101.  * holder.
  102.  */
  103.  
  104. extern void XawTextSinkDisplayText(
  105. #if NeedFunctionPrototypes
  106.     Widget        /* w */,
  107. #if NeedWidePrototypes
  108.     /* Position */ int    /* x */,
  109.     /* Position    */ int    /* y */,
  110. #else
  111.     Position        /* x */,
  112.     Position        /* y */,
  113. #endif
  114.     XawTextPosition    /* pos1 */,
  115.     XawTextPosition    /* pos2 */,
  116. #if NeedWidePrototypes
  117.     /* Boolean */ int    /* highlight */
  118. #else
  119.     Boolean        /* highlight */
  120. #endif
  121. #endif
  122. );
  123.  
  124. /*    Function Name: XawTextSinkInsertCursor
  125.  *    Description: Places the InsertCursor.
  126.  *    Arguments: w - the TextSink Object.
  127.  *                 x, y - location for the cursor.
  128.  *                 staye - whether to turn the cursor on, or off.
  129.  *    Returns: none.
  130.  *
  131.  * This function doesn't actually display anything, it is only a place
  132.  * holder.
  133.  */
  134.  
  135. extern void XawTextSinkInsertCursor(
  136. #if NeedFunctionPrototypes
  137.     Widget        /* w */,
  138. #if NeedWidePrototypes
  139.     /* Position */ int    /* x */,
  140.     /* Position    */ int    /* y */,
  141.     /* XawTextInsertState */ int /* state */
  142. #else
  143.     Position        /* x */,
  144.     Position        /* y */,
  145.     XawTextInsertState    /* state */
  146. #endif
  147. #endif
  148. );
  149.  
  150. /*    Function Name: XawTextSinkClearToBackground
  151.  *    Description: Clears a region of the sink to the background color.
  152.  *    Arguments: w - the TextSink Object.
  153.  *                 x, y  - location of area to clear.
  154.  *                 width, height - size of area to clear
  155.  *    Returns: void.
  156.  *
  157.  * This function doesn't actually display anything, it is only a place
  158.  * holder.
  159.  */
  160.  
  161. extern void XawTextSinkClearToBackground(
  162. #if NeedFunctionPrototypes
  163.     Widget        /* w */,
  164. #if NeedWidePrototypes
  165.     /* Position */ int    /* x */,
  166.     /* Position */ int    /* y */,
  167.     /* Dimension */ int    /* width */,
  168.     /* Dimension */ int    /* height */
  169. #else
  170.     Position        /* x */,
  171.     Position        /* y */,
  172.     Dimension        /* width */,
  173.     Dimension        /* height */
  174. #endif
  175. #endif
  176. );
  177.  
  178. /*    Function Name: XawTextSinkFindPosition
  179.  *    Description: Finds a position in the text.
  180.  *    Arguments: w - the TextSink Object.
  181.  *                 fromPos - reference position.
  182.  *                 fromX   - reference location.
  183.  *                 width,  - width of section to paint text.
  184.  *                 stopAtWordBreak - returned position is a word break?
  185.  *                 resPos - Position to return.      *** RETURNED ***
  186.  *                 resWidth - Width actually used.   *** RETURNED ***
  187.  *                 resHeight - Height actually used. *** RETURNED ***
  188.  *    Returns: none (see above).
  189.  */
  190.  
  191. extern void XawTextSinkFindPosition(
  192. #if NeedFunctionPrototypes
  193.     Widget        /* w */,
  194.     XawTextPosition    /* fromPos */,
  195.     int            /* fromX */,
  196.     int            /* width */,
  197. #if NeedWidePrototypes
  198.     /* Boolean */ int    /* stopAtWordBreak */,
  199. #else
  200.     Boolean        /* stopAtWordBreak */,
  201. #endif
  202.     XawTextPosition*    /* pos_return */,
  203.     int*        /* width_return */,
  204.     int*        /* height_return */
  205. #endif
  206. );
  207.  
  208. /*    Function Name: XawTextSinkFindDistance
  209.  *    Description: Find the Pixel Distance between two text Positions.
  210.  *    Arguments: w - the TextSink Object.
  211.  *                 fromPos - starting Position.
  212.  *                 fromX   - x location of starting Position.
  213.  *                 toPos   - end Position.
  214.  *                 resWidth - Distance between fromPos and toPos.
  215.  *                 resPos   - Acutal toPos used.
  216.  *                 resHeight - Height required by this text.
  217.  *    Returns: none.
  218.  */
  219.  
  220. extern void XawTextSinkFindDistance (
  221. #if NeedFunctionPrototypes
  222.     Widget        /* w */,
  223.     XawTextPosition    /* fromPos */,
  224.     int            /* fromX */,
  225.     XawTextPosition     /* toPos */,
  226.     int*        /* width_return */,
  227.     XawTextPosition*    /* pos_return */,
  228.     int*        /* height_return */
  229. #endif
  230. );
  231.  
  232. /*    Function Name: XawTextSinkResolve
  233.  *    Description: Resloves a location to a position.
  234.  *    Arguments: w - the TextSink Object.
  235.  *                 pos - a reference Position.
  236.  *                 fromx - a reference Location.
  237.  *                 width - width to move.
  238.  *                 resPos - the resulting position.
  239.  *    Returns: none
  240.  */
  241.  
  242. extern void XawTextSinkResolve(
  243. #if NeedFunctionPrototypes
  244.     Widget        /* w */,
  245.     XawTextPosition    /* fromPos */,
  246.     int            /* fromX */,
  247.     int            /* width */,
  248.     XawTextPosition*    /* pos_return */
  249. #endif
  250. );
  251.  
  252. /*    Function Name: XawTextSinkMaxLines
  253.  *    Description: Finds the Maximum number of lines that will fit in
  254.  *                   a given height.
  255.  *    Arguments: w - the TextSink Object.
  256.  *                 height - height to fit lines into.
  257.  *    Returns: the number of lines that will fit.
  258.  */
  259.  
  260. extern int XawTextSinkMaxLines(
  261. #if NeedFunctionPrototypes
  262.     Widget        /* w */,
  263. #if NeedWidePrototypes
  264.     /* Dimension */ int    /* height */
  265. #else
  266.     Dimension        /* height */
  267. #endif
  268. #endif
  269. );
  270.  
  271. /*    Function Name: XawTextSinkMaxHeight
  272.  *    Description: Finds the Minium height that will contain a given number 
  273.  *                   lines.
  274.  *    Arguments: w - the TextSink Object.
  275.  *                 lines - the number of lines.
  276.  *    Returns: the height.
  277.  */
  278.  
  279. extern int XawTextSinkMaxHeight(
  280. #if NeedFunctionPrototypes
  281.     Widget        /* w */,
  282.     int            /* lines */
  283. #endif
  284. );
  285.  
  286. /*    Function Name: XawTextSinkSetTabs
  287.  *    Description: Sets the Tab stops.
  288.  *    Arguments: w - the TextSink Object.
  289.  *                 tab_count - the number of tabs in the list.
  290.  *                 tabs - the text positions of the tabs.
  291.  *    Returns: none
  292.  */
  293.  
  294. extern void XawTextSinkSetTabs(
  295. #if NeedFunctionPrototypes
  296.     Widget        /* w */,
  297.     int            /* tab_count */,
  298.     int*        /* tabs */
  299. #endif
  300. );
  301.                           
  302. /*    Function Name: XawTextSinkGetCursorBounds
  303.  *    Description: Finds the bounding box for the insert curor (caret).
  304.  *    Arguments: w - the TextSinkObject.
  305.  *                 rect - an X rectance containing the cursor bounds.
  306.  *    Returns: none (fills in rect).
  307.  */
  308.  
  309. extern void XawTextSinkGetCursorBounds(
  310. #if NeedFunctionPrototypes
  311.     Widget        /* w */,
  312.     XRectangle*        /* rect_return */
  313. #endif
  314. );
  315.  
  316. _XFUNCPROTOEND
  317.  
  318. #endif /* _XawTextSrc_h */
  319.