TextSrcP.h revision 7a84e134
17a84e134Smrg/*
27a84e134Smrg* $Xorg: TextSrcP.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $
37a84e134Smrg*/
47a84e134Smrg
57a84e134Smrg
67a84e134Smrg/***********************************************************
77a84e134Smrg
87a84e134SmrgCopyright 1987, 1988, 1994, 1998  The Open Group
97a84e134Smrg
107a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its
117a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that
127a84e134Smrgthe above copyright notice appear in all copies and that both that
137a84e134Smrgcopyright notice and this permission notice appear in supporting
147a84e134Smrgdocumentation.
157a84e134Smrg
167a84e134SmrgThe above copyright notice and this permission notice shall be included in
177a84e134Smrgall copies or substantial portions of the Software.
187a84e134Smrg
197a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
207a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
217a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
227a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
237a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
247a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
257a84e134Smrg
267a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be
277a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings
287a84e134Smrgin this Software without prior written authorization from The Open Group.
297a84e134Smrg
307a84e134Smrg
317a84e134SmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
327a84e134Smrg
337a84e134Smrg                        All Rights Reserved
347a84e134Smrg
357a84e134SmrgPermission to use, copy, modify, and distribute this software and its
367a84e134Smrgdocumentation for any purpose and without fee is hereby granted,
377a84e134Smrgprovided that the above copyright notice appear in all copies and that
387a84e134Smrgboth that copyright notice and this permission notice appear in
397a84e134Smrgsupporting documentation, and that the name of Digital not be
407a84e134Smrgused in advertising or publicity pertaining to distribution of the
417a84e134Smrgsoftware without specific, written prior permission.
427a84e134Smrg
437a84e134SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
447a84e134SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
457a84e134SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
467a84e134SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
477a84e134SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
487a84e134SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
497a84e134SmrgSOFTWARE.
507a84e134Smrg
517a84e134Smrg******************************************************************/
527a84e134Smrg/* $XFree86: xc/lib/Xaw/TextSrcP.h,v 1.14 2001/12/14 19:54:45 dawes Exp $ */
537a84e134Smrg
547a84e134Smrg#ifndef _XawTextSrcP_h
557a84e134Smrg#define _XawTextSrcP_h
567a84e134Smrg
577a84e134Smrg/*
587a84e134Smrg * TextSrc Object Private Data
597a84e134Smrg */
607a84e134Smrg#include <X11/Xfuncproto.h>
617a84e134Smrg
627a84e134Smrg#include <X11/Xaw/TextSrc.h>
637a84e134Smrg#include <X11/Xaw/TextP.h>	/* This source works with the Text widget */
647a84e134Smrg
657a84e134Smrg_XFUNCPROTOBEGIN
667a84e134Smrg
677a84e134Smrg#ifndef OLDXAW
687a84e134Smrgstruct _XawTextAnchor {
697a84e134Smrg    XawTextPosition position;
707a84e134Smrg    XawTextEntity *entities, *cache;
717a84e134Smrg};
727a84e134Smrg
737a84e134Smrg#define	XAW_TENTF_HIDE		0x0001
747a84e134Smrg#define XAW_TENTF_READ		0x0002
757a84e134Smrg#define XAW_TENTF_REPLACE	0x0004
767a84e134Smrgstruct _XawTextEntity {
777a84e134Smrg    short type;
787a84e134Smrg    short flags;
797a84e134Smrg    XawTextEntity *next;
807a84e134Smrg    XtPointer data;
817a84e134Smrg    XawTextPosition offset;	/* from the anchor */
827a84e134Smrg    Cardinal length;
837a84e134Smrg    XrmQuark property;
847a84e134Smrg};
857a84e134Smrg#endif
867a84e134Smrg
877a84e134Smrg#if 0	/* no longer used */
887a84e134Smrg/* New fields for the TextSrc object class */
897a84e134Smrgtypedef struct {
907a84e134Smrg  XtPointer		next_extension;
917a84e134Smrg  XrmQuark		record_type;
927a84e134Smrg  long			version;
937a84e134Smrg  Cardinal		record_size;
947a84e134Smrg  int			(*Input)();
957a84e134Smrg} TextSrcExtRec, *TextSrcExt;
967a84e134Smrg#endif
977a84e134Smrg
987a84e134Smrgtypedef XawTextPosition (*_XawSrcReadProc)
997a84e134Smrg     (Widget, XawTextPosition, XawTextBlock*, int);
1007a84e134Smrg
1017a84e134Smrgtypedef int (*_XawSrcReplaceProc)
1027a84e134Smrg     (Widget, XawTextPosition, XawTextPosition, XawTextBlock*);
1037a84e134Smrg
1047a84e134Smrgtypedef XawTextPosition (*_XawSrcScanProc)
1057a84e134Smrg     (Widget, XawTextPosition, XawTextScanType, XawTextScanDirection,
1067a84e134Smrg      int, Bool);
1077a84e134Smrg
1087a84e134Smrgtypedef XawTextPosition (*_XawSrcSearchProc)
1097a84e134Smrg     (Widget, XawTextPosition, XawTextScanDirection, XawTextBlock*);
1107a84e134Smrg
1117a84e134Smrgtypedef void (*_XawSrcSetSelectionProc)
1127a84e134Smrg     (Widget, XawTextPosition, XawTextPosition, Atom);
1137a84e134Smrg
1147a84e134Smrgtypedef Boolean (*_XawSrcConvertSelectionProc)
1157a84e134Smrg     (Widget, Atom*, Atom*, Atom*, XtPointer*, unsigned long*, int*);
1167a84e134Smrg
1177a84e134Smrgtypedef struct _TextSrcClassPart {
1187a84e134Smrg    _XawSrcReadProc Read;
1197a84e134Smrg    _XawSrcReplaceProc Replace;
1207a84e134Smrg    _XawSrcScanProc Scan;
1217a84e134Smrg    _XawSrcSearchProc Search;
1227a84e134Smrg    _XawSrcSetSelectionProc SetSelection;
1237a84e134Smrg    _XawSrcConvertSelectionProc ConvertSelection;
1247a84e134Smrg#ifndef OLDXAW
1257a84e134Smrg    XtPointer extension;
1267a84e134Smrg#endif
1277a84e134Smrg} TextSrcClassPart;
1287a84e134Smrg
1297a84e134Smrg/* Full class record */
1307a84e134Smrgtypedef struct _TextSrcClassRec {
1317a84e134Smrg    ObjectClassPart     object_class;
1327a84e134Smrg    TextSrcClassPart	textSrc_class;
1337a84e134Smrg} TextSrcClassRec;
1347a84e134Smrg
1357a84e134Smrgextern TextSrcClassRec textSrcClassRec;
1367a84e134Smrg
1377a84e134Smrg#ifndef OLDXAW
1387a84e134Smrgtypedef struct _XawTextUndo XawTextUndo;
1397a84e134Smrg#endif
1407a84e134Smrg
1417a84e134Smrg/* New fields for the TextSrc object */
1427a84e134Smrgtypedef struct {
1437a84e134Smrg    /* resources */
1447a84e134Smrg    XawTextEditType	edit_mode;
1457a84e134Smrg    XrmQuark text_format;		/* 2 formats: FMT8BIT for Ascii
1467a84e134Smrg					   FMTWIDE for ISO 10646 */
1477a84e134Smrg#ifndef OLDXAW
1487a84e134Smrg    XtCallbackList callback;		/* A callback list to call when the
1497a84e134Smrg					   source is changed */
1507a84e134Smrg    Boolean changed;
1517a84e134Smrg    Boolean enable_undo;
1527a84e134Smrg
1537a84e134Smrg    /* private state */
1547a84e134Smrg    Boolean undo_state;			/* to protect undo manipulation */
1557a84e134Smrg    XawTextUndo *undo;
1567a84e134Smrg    WidgetList text;			/* TextWidget's using this source */
1577a84e134Smrg    Cardinal num_text;
1587a84e134Smrg    XtCallbackList property_callback;
1597a84e134Smrg    XawTextAnchor **anchors;
1607a84e134Smrg    int num_anchors;
1617a84e134Smrg    XtPointer pad[1];	/* for future use and keep binary compatability */
1627a84e134Smrg#endif
1637a84e134Smrg} TextSrcPart;
1647a84e134Smrg
1657a84e134Smrg/* Full instance record */
1667a84e134Smrgtypedef struct _TextSrcRec {
1677a84e134Smrg    ObjectPart	object;
1687a84e134Smrg    TextSrcPart	textSrc;
1697a84e134Smrg} TextSrcRec;
1707a84e134Smrg
1717a84e134Smrg/*
1727a84e134Smrg * Semiprivate declarations of functions used in other modules
1737a84e134Smrg */
1747a84e134Smrgchar* _XawTextWCToMB
1757a84e134Smrg(
1767a84e134Smrg Display	*display,
1777a84e134Smrg wchar_t	*wstr,
1787a84e134Smrg int		*len_in_out
1797a84e134Smrg );
1807a84e134Smrg
1817a84e134Smrgwchar_t* _XawTextMBToWC
1827a84e134Smrg(
1837a84e134Smrg Display	*display,
1847a84e134Smrg char		*str,
1857a84e134Smrg int		*len_in_out
1867a84e134Smrg );
1877a84e134Smrg
1887a84e134Smrg#ifndef OLDXAW
1897a84e134SmrgXawTextAnchor *XawTextSourceAddAnchor
1907a84e134Smrg(
1917a84e134Smrg Widget			source,
1927a84e134Smrg XawTextPosition	position
1937a84e134Smrg );
1947a84e134Smrg
1957a84e134SmrgXawTextAnchor *XawTextSourceFindAnchor
1967a84e134Smrg(
1977a84e134Smrg Widget			source,
1987a84e134Smrg XawTextPosition	position
1997a84e134Smrg );
2007a84e134Smrg
2017a84e134SmrgXawTextAnchor *XawTextSourceNextAnchor
2027a84e134Smrg(
2037a84e134Smrg Widget			 source,
2047a84e134Smrg XawTextAnchor		*anchor
2057a84e134Smrg );
2067a84e134Smrg
2077a84e134SmrgXawTextAnchor *XawTextSourcePrevAnchor
2087a84e134Smrg(
2097a84e134Smrg Widget			 source,
2107a84e134Smrg XawTextAnchor		*anchor
2117a84e134Smrg );
2127a84e134Smrg
2137a84e134SmrgXawTextAnchor *XawTextSourceRemoveAnchor
2147a84e134Smrg(
2157a84e134Smrg Widget			 source,
2167a84e134Smrg XawTextAnchor		*anchor
2177a84e134Smrg );
2187a84e134Smrg
2197a84e134SmrgBool XawTextSourceAnchorAndEntity
2207a84e134Smrg(
2217a84e134Smrg Widget			  w,
2227a84e134Smrg XawTextPosition	  position,
2237a84e134Smrg XawTextAnchor		**anchor_return,
2247a84e134Smrg XawTextEntity		**entity_return
2257a84e134Smrg );
2267a84e134Smrg
2277a84e134SmrgXawTextEntity *XawTextSourceAddEntity
2287a84e134Smrg(
2297a84e134Smrg Widget			source,
2307a84e134Smrg int			type,
2317a84e134Smrg int			flags,
2327a84e134Smrg XtPointer		data,
2337a84e134Smrg XawTextPosition	position,
2347a84e134Smrg Cardinal		length,
2357a84e134Smrg XrmQuark		property
2367a84e134Smrg );
2377a84e134Smrg
2387a84e134Smrgvoid XawTextSourceClearEntities
2397a84e134Smrg(
2407a84e134Smrg Widget			w,
2417a84e134Smrg XawTextPosition	left,
2427a84e134Smrg XawTextPosition	right
2437a84e134Smrg );
2447a84e134Smrg#endif
2457a84e134Smrg
2467a84e134Smrg#if 0	/* no longer used */
2477a84e134Smrgtypedef XawTextPosition (*_XawTextPositionFunc)();
2487a84e134Smrg#endif
2497a84e134Smrg
2507a84e134Smrg#define XtInheritInput			((_XawTextPositionFunc)_XtInherit)
2517a84e134Smrg#define XtInheritRead			((_XawSrcReadProc)_XtInherit)
2527a84e134Smrg#define XtInheritReplace		((_XawSrcReplaceProc)_XtInherit)
2537a84e134Smrg#define XtInheritScan			((_XawSrcScanProc)_XtInherit)
2547a84e134Smrg#define XtInheritSearch			((_XawSrcSearchProc)_XtInherit)
2557a84e134Smrg#define XtInheritSetSelection		((_XawSrcSetSelectionProc)_XtInherit)
2567a84e134Smrg#define XtInheritConvertSelection     ((_XawSrcConvertSelectionProc)_XtInherit)
2577a84e134Smrg#if 0
2587a84e134Smrg#define XtTextSrcExtVersion	      1
2597a84e134Smrg#define XtTextSrcExtTypeString        "XT_TEXTSRC_EXT"
2607a84e134Smrg#endif
2617a84e134Smrg
2627a84e134Smrg_XFUNCPROTOEND
2637a84e134Smrg
2647a84e134Smrg#endif /* _XawTextSrcP_h */
265