Text.h revision 7a84e134
17a84e134Smrg/* $Xorg: Text.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $ */
27a84e134Smrg
37a84e134Smrg/***********************************************************
47a84e134Smrg
57a84e134SmrgCopyright 1987, 1988, 1994, 1998  The Open Group
67a84e134Smrg
77a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its
87a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that
97a84e134Smrgthe above copyright notice appear in all copies and that both that
107a84e134Smrgcopyright notice and this permission notice appear in supporting
117a84e134Smrgdocumentation.
127a84e134Smrg
137a84e134SmrgThe above copyright notice and this permission notice shall be included in
147a84e134Smrgall copies or substantial portions of the Software.
157a84e134Smrg
167a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
177a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
187a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
197a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
207a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
217a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
227a84e134Smrg
237a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be
247a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings
257a84e134Smrgin this Software without prior written authorization from The Open Group.
267a84e134Smrg
277a84e134Smrg
287a84e134SmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
297a84e134Smrg
307a84e134Smrg                        All Rights Reserved
317a84e134Smrg
327a84e134SmrgPermission to use, copy, modify, and distribute this software and its
337a84e134Smrgdocumentation for any purpose and without fee is hereby granted,
347a84e134Smrgprovided that the above copyright notice appear in all copies and that
357a84e134Smrgboth that copyright notice and this permission notice appear in
367a84e134Smrgsupporting documentation, and that the name of Digital not be
377a84e134Smrgused in advertising or publicity pertaining to distribution of the
387a84e134Smrgsoftware without specific, written prior permission.
397a84e134Smrg
407a84e134SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
417a84e134SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
427a84e134SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
437a84e134SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
447a84e134SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
457a84e134SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
467a84e134SmrgSOFTWARE.
477a84e134Smrg
487a84e134Smrg******************************************************************/
497a84e134Smrg/* $XFree86: xc/lib/Xaw/Text.h,v 1.14 2001/01/17 19:42:34 dawes Exp $ */
507a84e134Smrg
517a84e134Smrg#ifndef _XawText_h
527a84e134Smrg#define _XawText_h
537a84e134Smrg
547a84e134Smrg#include <X11/Xaw/Simple.h>
557a84e134Smrg
567a84e134Smrg/*
577a84e134Smrg
587a84e134Smrg Class: 	textWidgetClass
597a84e134Smrg Class Name:	Text
607a84e134Smrg Superclass:	Simple
617a84e134Smrg
627a84e134Smrg Resources added by the Text widget:
637a84e134Smrg
647a84e134Smrg Name		     Class	     RepType		Default Value
657a84e134Smrg ----		     -----	     -------		-------------
667a84e134Smrg autoFill	    AutoFill	     Boolean		False
677a84e134Smrg bottomMargin	    Margin	     Position		2
687a84e134Smrg displayPosition    TextPosition     XawTextPosition	0
697a84e134Smrg insertPosition	    TextPosition     XawTextPosition	0
707a84e134Smrg justify	    JustifyMode	     JustifyMode	left
717a84e134Smrg leftColumn	    Column	     Column		0
727a84e134Smrg rightColumn	    Column	     Column		0
737a84e134Smrg leftMargin	    Margin	     Position		2
747a84e134Smrg rightMargin	    Margin	     Position		4
757a84e134Smrg positionCallback   Callback	     Callback		NULL
767a84e134Smrg scrollHorizontal   Scroll	     Boolean		False
777a84e134Smrg scrollVertical     Scroll	     Boolean		False
787a84e134Smrg selectTypes        SelectTypes      Pointer            see documentation
797a84e134Smrg textSink	    TextSink	     Widget		NULL
807a84e134Smrg textSource	    TextSource	     Widget		NULL
817a84e134Smrg topMargin	    Margin	     Position		2
827a84e134Smrg unrealizeCallback  Callback	     Callback		NULL
837a84e134Smrg wrap		    Wrap	     XawTextWrapMode	XawTextWrapNever
847a84e134Smrg
857a84e134Smrg*/
867a84e134Smrg
877a84e134Smrgtypedef long XawTextPosition;
887a84e134Smrg
897a84e134Smrg#ifndef notdef
907a84e134Smrgtypedef enum {
917a84e134Smrg  XawtextScrollNever,
927a84e134Smrg  XawtextScrollWhenNeeded,
937a84e134Smrg  XawtextScrollAlways
947a84e134Smrg} XawTextScrollMode;
957a84e134Smrg
967a84e134Smrgtypedef enum {
977a84e134Smrg  XawtextResizeNever,
987a84e134Smrg  XawtextResizeWidth,
997a84e134Smrg  XawtextResizeHeight,
1007a84e134Smrg  XawtextResizeBoth
1017a84e134Smrg} XawTextResizeMode;
1027a84e134Smrg#endif
1037a84e134Smrg
1047a84e134Smrgtypedef enum {
1057a84e134Smrg  XawtextWrapNever,
1067a84e134Smrg  XawtextWrapLine,
1077a84e134Smrg  XawtextWrapWord
1087a84e134Smrg} XawTextWrapMode;
1097a84e134Smrg
1107a84e134Smrgtypedef enum {
1117a84e134Smrg  XawsdLeft,
1127a84e134Smrg  XawsdRight
1137a84e134Smrg} XawTextScanDirection;
1147a84e134Smrg
1157a84e134Smrgtypedef enum {
1167a84e134Smrg  XawtextRead,
1177a84e134Smrg  XawtextAppend,
1187a84e134Smrg  XawtextEdit
1197a84e134Smrg} XawTextEditType;
1207a84e134Smrg
1217a84e134Smrgtypedef enum {
1227a84e134Smrg  XawselectNull,
1237a84e134Smrg  XawselectPosition,
1247a84e134Smrg  XawselectChar,
1257a84e134Smrg  XawselectWord,
1267a84e134Smrg  XawselectLine,
1277a84e134Smrg  XawselectParagraph,
1287a84e134Smrg  XawselectAll,
1297a84e134Smrg  XawselectAlphaNumeric
1307a84e134Smrg} XawTextSelectType;
1317a84e134Smrg
1327a84e134Smrgtypedef enum {
1337a84e134Smrg    XawjustifyLeft,
1347a84e134Smrg    XawjustifyRight,
1357a84e134Smrg    XawjustifyCenter,
1367a84e134Smrg    XawjustifyFull
1377a84e134Smrg} XawTextJustifyMode;
1387a84e134Smrg
1397a84e134Smrgtypedef struct {
1407a84e134Smrg    int  firstPos;
1417a84e134Smrg    int  length;
1427a84e134Smrg    char *ptr;
1437a84e134Smrg    unsigned long format;
1447a84e134Smrg} XawTextBlock, *XawTextBlockPtr;
1457a84e134Smrg
1467a84e134Smrg#ifndef OLDXAW
1477a84e134Smrgtypedef struct {
1487a84e134Smrg    int line_number;
1497a84e134Smrg    int column_number;
1507a84e134Smrg    XawTextPosition insert_position;
1517a84e134Smrg    XawTextPosition last_position;
1527a84e134Smrg    Boolean overwrite_mode;
1537a84e134Smrg} XawTextPositionInfo;
1547a84e134Smrg
1557a84e134Smrgtypedef struct {
1567a84e134Smrg    XawTextPosition left, right;
1577a84e134Smrg    XawTextBlock *block;
1587a84e134Smrg} XawTextPropertyInfo;
1597a84e134Smrg
1607a84e134Smrgtypedef struct _XawTextAnchor XawTextAnchor;
1617a84e134Smrgtypedef struct _XawTextEntity XawTextEntity;
1627a84e134Smrgtypedef struct _XawTextProperty XawTextProperty;
1637a84e134Smrgtypedef struct _XawTextPropertyList XawTextPropertyList;
1647a84e134Smrg#endif
1657a84e134Smrg
1667a84e134Smrg#include <X11/Xaw/TextSink.h>
1677a84e134Smrg#include <X11/Xaw/TextSrc.h>
1687a84e134Smrg
1697a84e134Smrg#define XtEtextScrollNever "never"
1707a84e134Smrg#define XtEtextScrollWhenNeeded "whenneeded"
1717a84e134Smrg#define XtEtextScrollAlways "always"
1727a84e134Smrg#define XtEtextResizeNever "never"
1737a84e134Smrg#define XtEtextResizeWidth "width"
1747a84e134Smrg#define XtEtextResizeHeight "height"
1757a84e134Smrg#define XtEtextResizeBoth "both"
1767a84e134Smrg
1777a84e134Smrg#define XtEtextWrapNever	"never"
1787a84e134Smrg#define XtEtextWrapLine		"line"
1797a84e134Smrg#define XtEtextWrapWord		"word"
1807a84e134Smrg
1817a84e134Smrg#define XtNautoFill "autoFill"
1827a84e134Smrg#define XtNbottomMargin "bottomMargin"
1837a84e134Smrg#define XtNdialogHOffset "dialogHOffset"
1847a84e134Smrg#define XtNdialogVOffset "dialogVOffset"
1857a84e134Smrg#define XtNdisplayCaret "displayCaret"
1867a84e134Smrg#define XtNdisplayPosition "displayPosition"
1877a84e134Smrg#define XtNleftMargin "leftMargin"
1887a84e134Smrg#define XtNrightMargin "rightMargin"
1897a84e134Smrg#define XtNpositionCallback "positionCallback"
1907a84e134Smrg#define XtNscrollVertical "scrollVertical"
1917a84e134Smrg#define XtNscrollHorizontal "scrollHorizontal"
1927a84e134Smrg#define XtNselectTypes "selectTypes"
1937a84e134Smrg#define XtNtopMargin "topMargin"
1947a84e134Smrg#define XtNwrap "wrap"
1957a84e134Smrg
1967a84e134Smrg#define XtCColumn		"Column"
1977a84e134Smrg#define XtNleftColumn		"leftColumn"
1987a84e134Smrg#define XtNrightColumn		"rightColumn"
1997a84e134Smrg
2007a84e134Smrg#define XtCJustifyMode		XtCJustify
2017a84e134Smrg#define XtNjustifyMode		XtNjustify
2027a84e134Smrg#define XtEtextJustifyLeft	"left"
2037a84e134Smrg#define XtEtextJustifyRight	"right"
2047a84e134Smrg#define XtEtextJustifyCenter	"center"
2057a84e134Smrg#define XtEtextJustifyFull	"full"
2067a84e134Smrg
2077a84e134Smrg#define XtCAutoFill "AutoFill"
2087a84e134Smrg#define XtCSelectTypes "SelectTypes"
2097a84e134Smrg#define XtCWrap "Wrap"
2107a84e134Smrg#ifndef notdef
2117a84e134Smrg#define XtCScroll		"Scroll"
2127a84e134Smrg#endif
2137a84e134Smrg
2147a84e134Smrg#ifndef _XtStringDefs_h_
2157a84e134Smrg#define XtNinsertPosition "insertPosition"
2167a84e134Smrg#ifndef notdef
2177a84e134Smrg#define XtNresize "resize"
2187a84e134Smrg#define XtCResize "Resize"
2197a84e134Smrg#endif
2207a84e134Smrg#define XtNselection		"selection"
2217a84e134Smrg#endif
2227a84e134Smrg
2237a84e134Smrg/* return Error code for XawTextSearch */
2247a84e134Smrg#define XawTextSearchError      (-12345L)
2257a84e134Smrg
2267a84e134Smrg/* return codes from XawTextReplace */
2277a84e134Smrg#define XawReplaceError	       -1
2287a84e134Smrg#define XawEditDone		0
2297a84e134Smrg#define XawEditError		1
2307a84e134Smrg#define XawPositionError	2
2317a84e134Smrg
2327a84e134Smrg/* XrmQuark is not unsigned long */
2337a84e134Smrg#define XawTextFormat(tw,fmt) ((unsigned long)_XawTextFormat(tw) == (fmt))
2347a84e134Smrg
2357a84e134Smrgextern unsigned long FMT8BIT;
2367a84e134Smrgextern unsigned long XawFmt8Bit;
2377a84e134Smrgextern unsigned long XawFmtWide;
2387a84e134Smrg
2397a84e134Smrgextern WidgetClass textWidgetClass;
2407a84e134Smrg
2417a84e134Smrgtypedef struct _TextClassRec *TextWidgetClass;
2427a84e134Smrgtypedef struct _TextRec      *TextWidget;
2437a84e134Smrg
2447a84e134Smrg_XFUNCPROTOBEGIN
2457a84e134Smrg
2467a84e134SmrgXrmQuark _XawTextFormat
2477a84e134Smrg(
2487a84e134Smrg TextWidget		tw
2497a84e134Smrg );
2507a84e134Smrg
2517a84e134Smrgvoid XawTextDisplay
2527a84e134Smrg(
2537a84e134Smrg Widget			w
2547a84e134Smrg );
2557a84e134Smrg
2567a84e134Smrgvoid XawTextEnableRedisplay
2577a84e134Smrg(
2587a84e134Smrg Widget			w
2597a84e134Smrg );
2607a84e134Smrg
2617a84e134Smrgvoid XawTextDisableRedisplay
2627a84e134Smrg(
2637a84e134Smrg Widget			w
2647a84e134Smrg );
2657a84e134Smrg
2667a84e134Smrgvoid XawTextSetSelectionArray
2677a84e134Smrg(
2687a84e134Smrg Widget			w,
2697a84e134Smrg XawTextSelectType	*sarray
2707a84e134Smrg );
2717a84e134Smrg
2727a84e134Smrgvoid XawTextGetSelectionPos
2737a84e134Smrg(
2747a84e134Smrg Widget			w,
2757a84e134Smrg XawTextPosition	*begin_return,
2767a84e134Smrg XawTextPosition	*end_return
2777a84e134Smrg );
2787a84e134Smrg
2797a84e134Smrgvoid XawTextSetSource
2807a84e134Smrg(
2817a84e134Smrg Widget			w,
2827a84e134Smrg Widget			source,
2837a84e134Smrg XawTextPosition	top
2847a84e134Smrg );
2857a84e134Smrg
2867a84e134Smrgint XawTextReplace
2877a84e134Smrg(
2887a84e134Smrg Widget			w,
2897a84e134Smrg XawTextPosition	start,
2907a84e134Smrg XawTextPosition	end,
2917a84e134Smrg XawTextBlock		*text
2927a84e134Smrg );
2937a84e134Smrg
2947a84e134SmrgXawTextPosition XawTextTopPosition
2957a84e134Smrg(
2967a84e134Smrg Widget			w
2977a84e134Smrg );
2987a84e134Smrg
2997a84e134SmrgXawTextPosition XawTextLastPosition
3007a84e134Smrg(
3017a84e134Smrg Widget			w
3027a84e134Smrg );
3037a84e134Smrg
3047a84e134Smrgvoid XawTextSetInsertionPoint
3057a84e134Smrg(
3067a84e134Smrg Widget			w,
3077a84e134Smrg XawTextPosition	position
3087a84e134Smrg );
3097a84e134Smrg
3107a84e134SmrgXawTextPosition XawTextGetInsertionPoint
3117a84e134Smrg(
3127a84e134Smrg Widget			w
3137a84e134Smrg );
3147a84e134Smrg
3157a84e134Smrgvoid XawTextUnsetSelection
3167a84e134Smrg(
3177a84e134Smrg Widget			w
3187a84e134Smrg );
3197a84e134Smrg
3207a84e134Smrgvoid XawTextSetSelection
3217a84e134Smrg(
3227a84e134Smrg Widget			w,
3237a84e134Smrg XawTextPosition	left,
3247a84e134Smrg XawTextPosition	right
3257a84e134Smrg );
3267a84e134Smrg
3277a84e134Smrgvoid XawTextInvalidate
3287a84e134Smrg(
3297a84e134Smrg Widget			w,
3307a84e134Smrg XawTextPosition	from,
3317a84e134Smrg XawTextPosition	to
3327a84e134Smrg);
3337a84e134Smrg
3347a84e134SmrgWidget XawTextGetSource
3357a84e134Smrg(
3367a84e134Smrg Widget			w
3377a84e134Smrg );
3387a84e134Smrg
3397a84e134SmrgWidget XawTextGetSink
3407a84e134Smrg(
3417a84e134Smrg Widget			w
3427a84e134Smrg );
3437a84e134Smrg
3447a84e134SmrgXawTextPosition XawTextSearch
3457a84e134Smrg(
3467a84e134Smrg Widget			w,
3477a84e134Smrg#if NeedWidePrototypes
3487a84e134Smrg int			dir,
3497a84e134Smrg#else
3507a84e134Smrg XawTextScanDirection	dir,
3517a84e134Smrg#endif
3527a84e134Smrg XawTextBlock		*text
3537a84e134Smrg );
3547a84e134Smrg
3557a84e134Smrgvoid XawTextDisplayCaret
3567a84e134Smrg(
3577a84e134Smrg Widget			w,
3587a84e134Smrg#if NeedWidePrototypes
3597a84e134Smrg int			visible
3607a84e134Smrg#else
3617a84e134Smrg Boolean		visible
3627a84e134Smrg#endif
3637a84e134Smrg );
3647a84e134Smrg
3657a84e134Smrg_XFUNCPROTOEND
3667a84e134Smrg
3677a84e134Smrg/*
3687a84e134Smrg * For R3 compatability only
3697a84e134Smrg */
3707a84e134Smrg#include <X11/Xaw/AsciiSrc.h>
3717a84e134Smrg#include <X11/Xaw/AsciiSink.h>
3727a84e134Smrg
3737a84e134Smrg#endif /* _XawText_h */
374