master
ブランチ master
ShaderPlayground / deps / xlibre / include / X11 / Xaw / TextSrcP.h
6.9 KB、258行 生 Blame 履歴
1/***********************************************************
2
3Copyright 1987, 1988, 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
26Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28 All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
45
46******************************************************************/
47
48#ifndef _XawTextSrcP_h
49#define _XawTextSrcP_h
50
51/*
52 * TextSrc Object Private Data
53 */
54#include <X11/Xfuncproto.h>
55
56#include <X11/Xaw/TextSrc.h>
57#include <X11/Xaw/TextP.h> /* This source works with the Text widget */
58
59_XFUNCPROTOBEGIN
60
61#ifndef OLDXAW
62struct _XawTextAnchor {
63 XawTextPosition position;
64 XawTextEntity *entities, *cache;
65};
66
67#define XAW_TENTF_HIDE 0x0001
68#define XAW_TENTF_READ 0x0002
69#define XAW_TENTF_REPLACE 0x0004
70struct _XawTextEntity {
71 short type;
72 short flags;
73 XawTextEntity *next;
74 XtPointer data;
75 XawTextPosition offset; /* from the anchor */
76 Cardinal length;
77 XrmQuark property;
78};
79#endif
80
81#if 0 /* no longer used */
82/* New fields for the TextSrc object class */
83typedef struct {
84 XtPointer next_extension;
85 XrmQuark record_type;
86 long version;
87 Cardinal record_size;
88 int (*Input)();
89} TextSrcExtRec, *TextSrcExt;
90#endif
91
92typedef XawTextPosition (*_XawSrcReadProc)
93 (Widget, XawTextPosition, XawTextBlock*, int);
94
95typedef int (*_XawSrcReplaceProc)
96 (Widget, XawTextPosition, XawTextPosition, XawTextBlock*);
97
98typedef XawTextPosition (*_XawSrcScanProc)
99 (Widget, XawTextPosition, XawTextScanType, XawTextScanDirection,
100 int, Bool);
101
102typedef XawTextPosition (*_XawSrcSearchProc)
103 (Widget, XawTextPosition, XawTextScanDirection, XawTextBlock*);
104
105typedef void (*_XawSrcSetSelectionProc)
106 (Widget, XawTextPosition, XawTextPosition, Atom);
107
108typedef Boolean (*_XawSrcConvertSelectionProc)
109 (Widget, Atom*, Atom*, Atom*, XtPointer*, unsigned long*, int*);
110
111typedef struct _TextSrcClassPart {
112 _XawSrcReadProc Read;
113 _XawSrcReplaceProc Replace;
114 _XawSrcScanProc Scan;
115 _XawSrcSearchProc Search;
116 _XawSrcSetSelectionProc SetSelection;
117 _XawSrcConvertSelectionProc ConvertSelection;
118#ifndef OLDXAW
119 XtPointer extension;
120#endif
121} TextSrcClassPart;
122
123/* Full class record */
124typedef struct _TextSrcClassRec {
125 ObjectClassPart object_class;
126 TextSrcClassPart textSrc_class;
127} TextSrcClassRec;
128
129extern TextSrcClassRec textSrcClassRec;
130
131#ifndef OLDXAW
132typedef struct _XawTextUndo XawTextUndo;
133#endif
134
135/* New fields for the TextSrc object */
136typedef struct {
137 /* resources */
138 XawTextEditType edit_mode;
139 XrmQuark text_format; /* 2 formats: FMT8BIT for Ascii
140 FMTWIDE for ISO 10646 */
141#ifndef OLDXAW
142 XtCallbackList callback; /* A callback list to call when the
143 source is changed */
144 Boolean changed;
145 Boolean enable_undo;
146
147 /* private state */
148 Boolean undo_state; /* to protect undo manipulation */
149 XawTextUndo *undo;
150 WidgetList text; /* TextWidget's using this source */
151 Cardinal num_text;
152 XtCallbackList property_callback;
153 XawTextAnchor **anchors;
154 int num_anchors;
155 XtPointer pad[1]; /* for future use and keep binary compatibility */
156#endif
157} TextSrcPart;
158
159/* Full instance record */
160typedef struct _TextSrcRec {
161 ObjectPart object;
162 TextSrcPart textSrc;
163} TextSrcRec;
164
165/*
166 * Semiprivate declarations of functions used in other modules
167 */
168char* _XawTextWCToMB
169(
170 Display *display,
171 wchar_t *wstr,
172 int *len_in_out
173 );
174
175wchar_t* _XawTextMBToWC
176(
177 Display *display,
178 char *str,
179 int *len_in_out
180 );
181
182#ifndef OLDXAW
183XawTextAnchor *XawTextSourceAddAnchor
184(
185 Widget source,
186 XawTextPosition position
187 );
188
189XawTextAnchor *XawTextSourceFindAnchor
190(
191 Widget source,
192 XawTextPosition position
193 );
194
195XawTextAnchor *XawTextSourceNextAnchor
196(
197 Widget source,
198 XawTextAnchor *anchor
199 );
200
201XawTextAnchor *XawTextSourcePrevAnchor
202(
203 Widget source,
204 XawTextAnchor *anchor
205 );
206
207XawTextAnchor *XawTextSourceRemoveAnchor
208(
209 Widget source,
210 XawTextAnchor *anchor
211 );
212
213Bool XawTextSourceAnchorAndEntity
214(
215 Widget w,
216 XawTextPosition position,
217 XawTextAnchor **anchor_return,
218 XawTextEntity **entity_return
219 );
220
221XawTextEntity *XawTextSourceAddEntity
222(
223 Widget source,
224 int type,
225 int flags,
226 XtPointer data,
227 XawTextPosition position,
228 Cardinal length,
229 XrmQuark property
230 );
231
232void XawTextSourceClearEntities
233(
234 Widget w,
235 XawTextPosition left,
236 XawTextPosition right
237 );
238#endif
239
240#if 0 /* no longer used */
241typedef XawTextPosition (*_XawTextPositionFunc)();
242#endif
243
244#define XtInheritInput ((_XawTextPositionFunc)_XtInherit)
245#define XtInheritRead ((_XawSrcReadProc)_XtInherit)
246#define XtInheritReplace ((_XawSrcReplaceProc)_XtInherit)
247#define XtInheritScan ((_XawSrcScanProc)_XtInherit)
248#define XtInheritSearch ((_XawSrcSearchProc)_XtInherit)
249#define XtInheritSetSelection ((_XawSrcSetSelectionProc)_XtInherit)
250#define XtInheritConvertSelection ((_XawSrcConvertSelectionProc)_XtInherit)
251#if 0
252#define XtTextSrcExtVersion 1
253#define XtTextSrcExtTypeString "XT_TEXTSRC_EXT"
254#endif
255
256_XFUNCPROTOEND
257
258#endif /* _XawTextSrcP_h */