1 /* 2 * $XConsortium: AsciiSrc.h,v 1.13 91/07/22 19:02:47 converse Exp $ 3 * 4 * Copyright 1989 Massachusetts Institute of Technology 5 * 6 * Permission to use, copy, modify, and distribute this software and its 7 * documentation for any purpose and without fee is hereby granted, provided 8 * that the above copyright notice appear in all copies and that both that 9 * copyright notice and this permission notice appear in supporting 10 * documentation, and that the name of M.I.T. not be used in advertising or 11 * publicity pertaining to distribution of the software without specific, 12 * written prior permission. M.I.T. makes no representations about the 13 * suitability of this software for any purpose. It is provided "as is" 14 * without express or implied warranty. 15 * 16 */ 17 18 19 /* 20 * AsciiSrc.h - Public Header file for Ascii Text Source. 21 * 22 * This is the public header file for the Ascii Text Source. 23 * It is intended to be used with the Text widget, the simplest way to use 24 * this text source is to use the AsciiText Object. 25 * 26 * Date: June 29, 1989 27 * 28 * By: Chris D. Peterson 29 * MIT X Consortium 30 * kit@expo.lcs.mit.edu 31 */ 32 33 34 #ifndef _XawAsciiSrc_h 35 #define _XawAsciiSrc_h 36 37 #include <X11/Xaw/TextSrc.h> 38 #include <X11/Xfuncproto.h> 39 40 /* Resources: 41 42 Name Class RepType Default Value 43 ---- ----- ------- ------------- 44 callback Callback Callback (none) 45 dataCompression DataCompression Boolean True 46 length Length int (internal) 47 pieceSize PieceSize int BUFSIZ 48 string String String NULL 49 type Type XawAsciiType XawAsciiString 50 useStringInPlace UseStringInPlace Boolean False 51 52 */ 53 54 /* Class record constants */ 55 56 extern WidgetClass asciiSrcObjectClass; 57 58 typedef struct _AsciiSrcClassRec *AsciiSrcObjectClass; 59 typedef struct _AsciiSrcRec *AsciiSrcObject; 60 61 /* 62 * Just to make people's lives a bit easier. 63 */ 64 65 #define AsciiSourceObjectClass AsciiSrcObjectClass 66 #define AsciiSourceObject AsciiSrcObject 67 68 /* 69 * Resource Definitions. 70 */ 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 {XawAsciiFile, XawAsciiString} XawAsciiType; 88 89 /************************************************************ 90 * 91 * Public routines 92 * 93 ************************************************************/ 94 95 _XFUNCPROTOBEGIN 96 97 /* Function Name: XawAsciiSourceFreeString 98 * Description: Frees the string returned by a get values call 99 * on the string when the source is of type string. 100 * Arguments: w - the AsciiSrc object. 101 * Returns: none. 102 */ 103 104 extern void XawAsciiSourceFreeString( 105 #if NeedFunctionPrototypes 106 Widget /* w */ 107 #endif 108 ); 109 110 /* Function Name: XawAsciiSave 111 * Description: Saves all the pieces into a file or string as required. 112 * Arguments: w - the asciiSrc Object. 113 * Returns: TRUE if the save was successful. 114 */ 115 116 extern Boolean XawAsciiSave( 117 #if NeedFunctionPrototypes 118 Widget /* w */ 119 #endif 120 ); 121 122 /* Function Name: XawAsciiSaveAsFile 123 * Description: Save the current buffer as a file. 124 * Arguments: w - the asciiSrc object. 125 * name - name of the file to save this file into. 126 * Returns: True if the save was successful. 127 */ 128 129 extern Boolean XawAsciiSaveAsFile( 130 #if NeedFunctionPrototypes 131 Widget /* w */, 132 _Xconst char* /* name */ 133 #endif 134 ); 135 136 /* Function Name: XawAsciiSourceChanged 137 * Description: Returns true if the source has changed since last saved. 138 * Arguments: w - the asciiSource object. 139 * Returns: a Boolean (see description). 140 */ 141 142 extern Boolean XawAsciiSourceChanged( 143 #if NeedFunctionPrototypes 144 Widget /* w */ 145 #endif 146 ); 147 148 _XFUNCPROTOEND 149 150 #endif /* _XawAsciiSrc_h - Don't add anything after this line. */ 151 152