Home | History | Annotate | Line # | Download | only in Xaw
      1 /*
      2 
      3 Copyright 1989, 1994, 1998  The Open Group
      4 
      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
      9 documentation.
     10 
     11 The above copyright notice and this permission notice shall be included in
     12 all copies or substantial portions of the Software.
     13 
     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.
     20 
     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.
     24 
     25 */
     26 
     27 
     28 /*
     29  * AsciiSrc.h - Public Header file for Ascii Text Source.
     30  *
     31  * This is the public header file for the Ascii Text Source.
     32  * It is intended to be used with the Text widget, the simplest way to use
     33  * this text source is to use the AsciiText Object.
     34  *
     35  * Date:    June 29, 1989
     36  *
     37  * By:      Chris D. Peterson
     38  *          MIT X Consortium
     39  *          kit (at) expo.lcs.mit.edu
     40  */
     41 
     42 
     43 #ifndef _XawAsciiSrc_h
     44 #define _XawAsciiSrc_h
     45 
     46 #include <X11/Xaw/TextSrc.h>
     47 
     48 /* Resources:
     49 
     50  Name		     Class		RepType		Default Value
     51  ----		     -----		-------		-------------
     52  dataCompression     DataCompression	Boolean		True
     53  length		     Length		int		(internal)
     54  pieceSize	     PieceSize		int		BUFSIZ
     55  string		     String		String		NULL
     56  type		     Type		XawAsciiType	XawAsciiString
     57  useStringInPlace    UseStringInPlace	Boolean		False
     58 
     59 */
     60 
     61 extern WidgetClass asciiSrcObjectClass;
     62 
     63 typedef struct _AsciiSrcClassRec *AsciiSrcObjectClass;
     64 typedef struct _AsciiSrcRec      *AsciiSrcObject;
     65 
     66 #define AsciiSourceObjectClass AsciiSrcObjectClass
     67 #define AsciiSourceObject      AsciiSrcObject
     68 
     69 /*
     70  * Resource Definitions
     71  */
     72 #define XtCDataCompression "DataCompression"
     73 #define XtCPieceSize "PieceSize"
     74 #define XtCType "Type"
     75 #define XtCUseStringInPlace "UseStringInPlace"
     76 
     77 #define XtNdataCompression "dataCompression"
     78 #define XtNpieceSize "pieceSize"
     79 #define XtNtype "type"
     80 #define XtNuseStringInPlace "useStringInPlace"
     81 
     82 #define XtRAsciiType "AsciiType"
     83 
     84 #define XtEstring "string"
     85 #define XtEfile "file"
     86 
     87 typedef enum {
     88   XawAsciiFile,
     89   XawAsciiString
     90 } XawAsciiType;
     91 
     92 /*
     93  * Public routines
     94  */
     95 
     96 _XFUNCPROTOBEGIN
     97 
     98 /*
     99  * Function:
    100  *	XawAsciiSourceFreeString
    101  *
    102  * Parameters:
    103  *	w - AsciiSrc object
    104  *
    105  * Description:
    106  *	  Frees the string returned by a get values call
    107  *		     on the string when the source is of type string.
    108  */
    109 void XawAsciiSourceFreeString
    110 (
    111  Widget		w
    112  );
    113 
    114 /*
    115  * Function:
    116  *	XawAsciiSave
    117  *
    118  * Arguments:
    119  *	w - asciiSrc Object.
    120  *
    121  * Description:
    122  *	Saves all the pieces into a file or string as required.
    123  *
    124  * Returns:
    125  *	True if the save was successful
    126  */
    127 Bool XawAsciiSave
    128 (
    129  Widget		w
    130  );
    131 
    132 /*
    133  * Function:
    134  *	XawAsciiSaveAsFile
    135  *
    136  * Parameters:
    137  *	w    - asciiSrc object
    138  *	name - name of the file to save this file into
    139  *
    140  * Description:
    141  *	Save the current buffer as a file.
    142  *
    143  * Returns:
    144  *	True if the save was successful
    145  */
    146 Bool XawAsciiSaveAsFile
    147 (
    148  Widget		w,
    149  _Xconst char	*name
    150  );
    151 
    152 /*
    153  * Function:
    154  *	XawAsciiSourceChanged
    155  *
    156  * Parameters:
    157  *	w - asciiSource object
    158  *
    159  * Description:
    160  *	Returns true if the source has changed since last saved.
    161  *
    162  * Returns:
    163  *	a Boolean (see description)
    164  */
    165 Bool XawAsciiSourceChanged
    166 (
    167  Widget		w
    168  );
    169 
    170 _XFUNCPROTOEND
    171 
    172 #endif /* _XawAsciiSrc_h */
    173