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