AsciiSrc.h revision 7a84e134
1/* $Xorg: AsciiSrc.h,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ */
2
3/*
4
5Copyright 1989, 1994, 1998  The Open Group
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of The Open Group shall not be
24used in advertising or otherwise to promote the sale, use or other dealings
25in this Software without prior written authorization from The Open Group.
26
27*/
28/* $XFree86: xc/lib/Xaw/AsciiSrc.h,v 1.7 2001/01/17 19:42:25 dawes Exp $ */
29
30
31/*
32 * AsciiSrc.h - Public Header file for Ascii Text Source.
33 *
34 * This is the public header file for the Ascii Text Source.
35 * It is intended to be used with the Text widget, the simplest way to use
36 * this text source is to use the AsciiText Object.
37 *
38 * Date:    June 29, 1989
39 *
40 * By:      Chris D. Peterson
41 *          MIT X Consortium
42 *          kit@expo.lcs.mit.edu
43 */
44
45
46#ifndef _XawAsciiSrc_h
47#define _XawAsciiSrc_h
48
49#include <X11/Xaw/TextSrc.h>
50
51/* Resources:
52
53 Name		     Class		RepType		Default Value
54 ----		     -----		-------		-------------
55 dataCompression     DataCompression	Boolean		True
56 length		     Length		int		(internal)
57 pieceSize	     PieceSize		int		BUFSIZ
58 string		     String		String		NULL
59 type		     Type		XawAsciiType	XawAsciiString
60 useStringInPlace    UseStringInPlace	Boolean		False
61
62*/
63
64extern WidgetClass asciiSrcObjectClass;
65
66typedef struct _AsciiSrcClassRec *AsciiSrcObjectClass;
67typedef struct _AsciiSrcRec      *AsciiSrcObject;
68
69#define AsciiSourceObjectClass AsciiSrcObjectClass
70#define AsciiSourceObject      AsciiSrcObject
71
72/*
73 * Resource Definitions
74 */
75#define XtCDataCompression "DataCompression"
76#define XtCPieceSize "PieceSize"
77#define XtCType "Type"
78#define XtCUseStringInPlace "UseStringInPlace"
79
80#define XtNdataCompression "dataCompression"
81#define XtNpieceSize "pieceSize"
82#define XtNtype "type"
83#define XtNuseStringInPlace "useStringInPlace"
84
85#define XtRAsciiType "AsciiType"
86
87#define XtEstring "string"
88#define XtEfile "file"
89
90typedef enum {
91  XawAsciiFile,
92  XawAsciiString
93} XawAsciiType;
94
95/*
96 * Public routines
97 */
98
99_XFUNCPROTOBEGIN
100
101/*
102 * Function:
103 *	XawAsciiSourceFreeString
104 *
105 * Parameters:
106 *	w - AsciiSrc object
107 *
108 * Description:
109 *	  Frees the string returned by a get values call
110 *		     on the string when the source is of type string.
111 */
112void XawAsciiSourceFreeString
113(
114 Widget		w
115 );
116
117/*
118 * Function:
119 *	XawAsciiSave
120 *
121 * Arguments:
122 *	w - asciiSrc Object.
123 *
124 * Description:
125 *	Saves all the pieces into a file or string as required.
126 *
127 * Returns:
128 *	True if the save was successful
129 */
130Bool XawAsciiSave
131(
132 Widget		w
133 );
134
135/*
136 * Function:
137 *	XawAsciiSaveAsFile
138 *
139 * Parameters:
140 *	w    - asciiSrc object
141 *	name - name of the file to save this file into
142 *
143 * Description:
144 *	Save the current buffer as a file.
145 *
146 * Returns:
147 *	True if the save was successful
148 */
149Bool XawAsciiSaveAsFile
150(
151 Widget		w,
152 _Xconst char	*name
153 );
154
155/*
156 * Function:
157 *	XawAsciiSourceChanged
158 *
159 * Parameters:
160 *	w - asciiSource object
161 *
162 * Description:
163 *	Returns true if the source has changed since last saved.
164 *
165 * Returns:
166 *	a Boolean (see description)
167 */
168Bool XawAsciiSourceChanged
169(
170 Widget		w
171 );
172
173_XFUNCPROTOEND
174
175#endif /* _XawAsciiSrc_h */
176