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 _XawText_h
497a84e134Smrg#define _XawText_h
507a84e134Smrg
517a84e134Smrg#include <X11/Xaw/Simple.h>
527a84e134Smrg
537a84e134Smrg/*
547a84e134Smrg
55421c997bSmrg Class:		textWidgetClass
567a84e134Smrg Class Name:	Text
577a84e134Smrg Superclass:	Simple
587a84e134Smrg
597a84e134Smrg Resources added by the Text widget:
607a84e134Smrg
617a84e134Smrg Name		     Class	     RepType		Default Value
627a84e134Smrg ----		     -----	     -------		-------------
637a84e134Smrg autoFill	    AutoFill	     Boolean		False
647a84e134Smrg bottomMargin	    Margin	     Position		2
657a84e134Smrg displayPosition    TextPosition     XawTextPosition	0
667a84e134Smrg insertPosition	    TextPosition     XawTextPosition	0
677a84e134Smrg justify	    JustifyMode	     JustifyMode	left
687a84e134Smrg leftColumn	    Column	     Column		0
697a84e134Smrg rightColumn	    Column	     Column		0
707a84e134Smrg leftMargin	    Margin	     Position		2
717a84e134Smrg rightMargin	    Margin	     Position		4
727a84e134Smrg positionCallback   Callback	     Callback		NULL
737a84e134Smrg scrollHorizontal   Scroll	     Boolean		False
747a84e134Smrg scrollVertical     Scroll	     Boolean		False
757a84e134Smrg selectTypes        SelectTypes      Pointer            see documentation
767a84e134Smrg textSink	    TextSink	     Widget		NULL
777a84e134Smrg textSource	    TextSource	     Widget		NULL
787a84e134Smrg topMargin	    Margin	     Position		2
797a84e134Smrg unrealizeCallback  Callback	     Callback		NULL
807a84e134Smrg wrap		    Wrap	     XawTextWrapMode	XawTextWrapNever
817a84e134Smrg
827a84e134Smrg*/
837a84e134Smrg
847a84e134Smrgtypedef long XawTextPosition;
857a84e134Smrg
867a84e134Smrg#ifndef notdef
877a84e134Smrgtypedef enum {
887a84e134Smrg  XawtextScrollNever,
897a84e134Smrg  XawtextScrollWhenNeeded,
907a84e134Smrg  XawtextScrollAlways
917a84e134Smrg} XawTextScrollMode;
927a84e134Smrg
937a84e134Smrgtypedef enum {
947a84e134Smrg  XawtextResizeNever,
957a84e134Smrg  XawtextResizeWidth,
967a84e134Smrg  XawtextResizeHeight,
977a84e134Smrg  XawtextResizeBoth
987a84e134Smrg} XawTextResizeMode;
997a84e134Smrg#endif
1007a84e134Smrg
1017a84e134Smrgtypedef enum {
1027a84e134Smrg  XawtextWrapNever,
1037a84e134Smrg  XawtextWrapLine,
1047a84e134Smrg  XawtextWrapWord
1057a84e134Smrg} XawTextWrapMode;
1067a84e134Smrg
1077a84e134Smrgtypedef enum {
1087a84e134Smrg  XawsdLeft,
1097a84e134Smrg  XawsdRight
1107a84e134Smrg} XawTextScanDirection;
1117a84e134Smrg
1127a84e134Smrgtypedef enum {
1137a84e134Smrg  XawtextRead,
1147a84e134Smrg  XawtextAppend,
1157a84e134Smrg  XawtextEdit
1167a84e134Smrg} XawTextEditType;
1177a84e134Smrg
1187a84e134Smrgtypedef enum {
1197a84e134Smrg  XawselectNull,
1207a84e134Smrg  XawselectPosition,
1217a84e134Smrg  XawselectChar,
1227a84e134Smrg  XawselectWord,
1237a84e134Smrg  XawselectLine,
1247a84e134Smrg  XawselectParagraph,
1257a84e134Smrg  XawselectAll,
1267a84e134Smrg  XawselectAlphaNumeric
1277a84e134Smrg} XawTextSelectType;
1287a84e134Smrg
1297a84e134Smrgtypedef enum {
1307a84e134Smrg    XawjustifyLeft,
1317a84e134Smrg    XawjustifyRight,
1327a84e134Smrg    XawjustifyCenter,
1337a84e134Smrg    XawjustifyFull
1347a84e134Smrg} XawTextJustifyMode;
1357a84e134Smrg
1367a84e134Smrgtypedef struct {
1377a84e134Smrg    int  firstPos;
1387a84e134Smrg    int  length;
1397a84e134Smrg    char *ptr;
1407a84e134Smrg    unsigned long format;
1417a84e134Smrg} XawTextBlock, *XawTextBlockPtr;
1427a84e134Smrg
1437a84e134Smrg#ifndef OLDXAW
1447a84e134Smrgtypedef struct {
1457a84e134Smrg    int line_number;
1467a84e134Smrg    int column_number;
1477a84e134Smrg    XawTextPosition insert_position;
1487a84e134Smrg    XawTextPosition last_position;
1497a84e134Smrg    Boolean overwrite_mode;
1507a84e134Smrg} XawTextPositionInfo;
1517a84e134Smrg
1527a84e134Smrgtypedef struct {
1537a84e134Smrg    XawTextPosition left, right;
1547a84e134Smrg    XawTextBlock *block;
1557a84e134Smrg} XawTextPropertyInfo;
1567a84e134Smrg
1577a84e134Smrgtypedef struct _XawTextAnchor XawTextAnchor;
1587a84e134Smrgtypedef struct _XawTextEntity XawTextEntity;
1597a84e134Smrgtypedef struct _XawTextProperty XawTextProperty;
1607a84e134Smrgtypedef struct _XawTextPropertyList XawTextPropertyList;
1617a84e134Smrg#endif
1627a84e134Smrg
1637a84e134Smrg#include <X11/Xaw/TextSink.h>
1647a84e134Smrg#include <X11/Xaw/TextSrc.h>
1657a84e134Smrg
1667a84e134Smrg#define XtEtextScrollNever "never"
1677a84e134Smrg#define XtEtextScrollWhenNeeded "whenneeded"
1687a84e134Smrg#define XtEtextScrollAlways "always"
1697a84e134Smrg#define XtEtextResizeNever "never"
1707a84e134Smrg#define XtEtextResizeWidth "width"
1717a84e134Smrg#define XtEtextResizeHeight "height"
1727a84e134Smrg#define XtEtextResizeBoth "both"
1737a84e134Smrg
1747a84e134Smrg#define XtEtextWrapNever	"never"
1757a84e134Smrg#define XtEtextWrapLine		"line"
1767a84e134Smrg#define XtEtextWrapWord		"word"
1777a84e134Smrg
1787a84e134Smrg#define XtNautoFill "autoFill"
1797a84e134Smrg#define XtNbottomMargin "bottomMargin"
1807a84e134Smrg#define XtNdialogHOffset "dialogHOffset"
1817a84e134Smrg#define XtNdialogVOffset "dialogVOffset"
1827a84e134Smrg#define XtNdisplayCaret "displayCaret"
1837a84e134Smrg#define XtNdisplayPosition "displayPosition"
1847a84e134Smrg#define XtNleftMargin "leftMargin"
1857a84e134Smrg#define XtNrightMargin "rightMargin"
1867a84e134Smrg#define XtNpositionCallback "positionCallback"
1877a84e134Smrg#define XtNscrollVertical "scrollVertical"
1887a84e134Smrg#define XtNscrollHorizontal "scrollHorizontal"
1897a84e134Smrg#define XtNselectTypes "selectTypes"
1907a84e134Smrg#define XtNtopMargin "topMargin"
1917a84e134Smrg#define XtNwrap "wrap"
1927a84e134Smrg
1937a84e134Smrg#define XtCColumn		"Column"
1947a84e134Smrg#define XtNleftColumn		"leftColumn"
1957a84e134Smrg#define XtNrightColumn		"rightColumn"
1967a84e134Smrg
1977a84e134Smrg#define XtCJustifyMode		XtCJustify
1987a84e134Smrg#define XtNjustifyMode		XtNjustify
1997a84e134Smrg#define XtEtextJustifyLeft	"left"
2007a84e134Smrg#define XtEtextJustifyRight	"right"
2017a84e134Smrg#define XtEtextJustifyCenter	"center"
2027a84e134Smrg#define XtEtextJustifyFull	"full"
2037a84e134Smrg
2047a84e134Smrg#define XtCAutoFill "AutoFill"
2057a84e134Smrg#define XtCSelectTypes "SelectTypes"
2067a84e134Smrg#define XtCWrap "Wrap"
2077a84e134Smrg#ifndef notdef
2087a84e134Smrg#define XtCScroll		"Scroll"
2097a84e134Smrg#endif
2107a84e134Smrg
2117a84e134Smrg#ifndef _XtStringDefs_h_
2127a84e134Smrg#define XtNinsertPosition "insertPosition"
2137a84e134Smrg#ifndef notdef
2147a84e134Smrg#define XtNresize "resize"
2157a84e134Smrg#define XtCResize "Resize"
2167a84e134Smrg#endif
2177a84e134Smrg#define XtNselection		"selection"
2187a84e134Smrg#endif
2197a84e134Smrg
2207a84e134Smrg/* return Error code for XawTextSearch */
2217a84e134Smrg#define XawTextSearchError      (-12345L)
2227a84e134Smrg
2237a84e134Smrg/* return codes from XawTextReplace */
2247a84e134Smrg#define XawReplaceError	       -1
2257a84e134Smrg#define XawEditDone		0
2267a84e134Smrg#define XawEditError		1
2277a84e134Smrg#define XawPositionError	2
2287a84e134Smrg
2297a84e134Smrg/* XrmQuark is not unsigned long */
2307a84e134Smrg#define XawTextFormat(tw,fmt) ((unsigned long)_XawTextFormat(tw) == (fmt))
2317a84e134Smrg
2327a84e134Smrgextern unsigned long FMT8BIT;
2337a84e134Smrgextern unsigned long XawFmt8Bit;
2347a84e134Smrgextern unsigned long XawFmtWide;
2357a84e134Smrg
2367a84e134Smrgextern WidgetClass textWidgetClass;
2377a84e134Smrg
2387a84e134Smrgtypedef struct _TextClassRec *TextWidgetClass;
2397a84e134Smrgtypedef struct _TextRec      *TextWidget;
2407a84e134Smrg
2417a84e134Smrg_XFUNCPROTOBEGIN
2427a84e134Smrg
2437a84e134SmrgXrmQuark _XawTextFormat
2447a84e134Smrg(
2457a84e134Smrg TextWidget		tw
2467a84e134Smrg );
2477a84e134Smrg
2487a84e134Smrgvoid XawTextDisplay
2497a84e134Smrg(
2507a84e134Smrg Widget			w
2517a84e134Smrg );
2527a84e134Smrg
2537a84e134Smrgvoid XawTextEnableRedisplay
2547a84e134Smrg(
2557a84e134Smrg Widget			w
2567a84e134Smrg );
2577a84e134Smrg
2587a84e134Smrgvoid XawTextDisableRedisplay
2597a84e134Smrg(
2607a84e134Smrg Widget			w
2617a84e134Smrg );
2627a84e134Smrg
2637a84e134Smrgvoid XawTextSetSelectionArray
2647a84e134Smrg(
2657a84e134Smrg Widget			w,
2667a84e134Smrg XawTextSelectType	*sarray
2677a84e134Smrg );
2687a84e134Smrg
2697a84e134Smrgvoid XawTextGetSelectionPos
2707a84e134Smrg(
2717a84e134Smrg Widget			w,
2727a84e134Smrg XawTextPosition	*begin_return,
2737a84e134Smrg XawTextPosition	*end_return
2747a84e134Smrg );
2757a84e134Smrg
2767a84e134Smrgvoid XawTextSetSource
2777a84e134Smrg(
2787a84e134Smrg Widget			w,
2797a84e134Smrg Widget			source,
2807a84e134Smrg XawTextPosition	top
2817a84e134Smrg );
2827a84e134Smrg
2837a84e134Smrgint XawTextReplace
2847a84e134Smrg(
2857a84e134Smrg Widget			w,
2867a84e134Smrg XawTextPosition	start,
2877a84e134Smrg XawTextPosition	end,
2887a84e134Smrg XawTextBlock		*text
2897a84e134Smrg );
2907a84e134Smrg
2917a84e134SmrgXawTextPosition XawTextTopPosition
2927a84e134Smrg(
2937a84e134Smrg Widget			w
2947a84e134Smrg );
2957a84e134Smrg
2967a84e134SmrgXawTextPosition XawTextLastPosition
2977a84e134Smrg(
2987a84e134Smrg Widget			w
2997a84e134Smrg );
3007a84e134Smrg
3017a84e134Smrgvoid XawTextSetInsertionPoint
3027a84e134Smrg(
3037a84e134Smrg Widget			w,
3047a84e134Smrg XawTextPosition	position
3057a84e134Smrg );
3067a84e134Smrg
3077a84e134SmrgXawTextPosition XawTextGetInsertionPoint
3087a84e134Smrg(
3097a84e134Smrg Widget			w
3107a84e134Smrg );
3117a84e134Smrg
3127a84e134Smrgvoid XawTextUnsetSelection
3137a84e134Smrg(
3147a84e134Smrg Widget			w
3157a84e134Smrg );
3167a84e134Smrg
3177a84e134Smrgvoid XawTextSetSelection
3187a84e134Smrg(
3197a84e134Smrg Widget			w,
3207a84e134Smrg XawTextPosition	left,
3217a84e134Smrg XawTextPosition	right
3227a84e134Smrg );
3237a84e134Smrg
3247a84e134Smrgvoid XawTextInvalidate
3257a84e134Smrg(
3267a84e134Smrg Widget			w,
3277a84e134Smrg XawTextPosition	from,
3287a84e134Smrg XawTextPosition	to
3297a84e134Smrg);
3307a84e134Smrg
3317a84e134SmrgWidget XawTextGetSource
3327a84e134Smrg(
3337a84e134Smrg Widget			w
3347a84e134Smrg );
3357a84e134Smrg
3367a84e134SmrgWidget XawTextGetSink
3377a84e134Smrg(
3387a84e134Smrg Widget			w
3397a84e134Smrg );
3407a84e134Smrg
3417a84e134SmrgXawTextPosition XawTextSearch
3427a84e134Smrg(
3437a84e134Smrg Widget			w,
3447a84e134Smrg#if NeedWidePrototypes
3457a84e134Smrg int			dir,
3467a84e134Smrg#else
3477a84e134Smrg XawTextScanDirection	dir,
3487a84e134Smrg#endif
3497a84e134Smrg XawTextBlock		*text
3507a84e134Smrg );
3517a84e134Smrg
3527a84e134Smrgvoid XawTextDisplayCaret
3537a84e134Smrg(
3547a84e134Smrg Widget			w,
3557a84e134Smrg#if NeedWidePrototypes
3567a84e134Smrg int			visible
3577a84e134Smrg#else
3587a84e134Smrg Boolean		visible
3597a84e134Smrg#endif
3607a84e134Smrg );
3617a84e134Smrg
3627a84e134Smrg_XFUNCPROTOEND
3637a84e134Smrg
3647a84e134Smrg/*
3655b16253fSmrg * For R3 compatibility only
3667a84e134Smrg */
3677a84e134Smrg#include <X11/Xaw/AsciiSrc.h>
3687a84e134Smrg#include <X11/Xaw/AsciiSink.h>
3697a84e134Smrg
3707a84e134Smrg#endif /* _XawText_h */
371