1/*
2
3Copyright 1989, 1994, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in 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@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
61extern WidgetClass asciiSrcObjectClass;
62
63typedef struct _AsciiSrcClassRec *AsciiSrcObjectClass;
64typedef 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
87typedef 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 */
109void 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 */
127Bool 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 */
146Bool 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 */
165Bool XawAsciiSourceChanged
166(
167 Widget		w
168 );
169
170_XFUNCPROTOEND
171
172#endif /* _XawAsciiSrc_h */
173