Home | History | Annotate | Line # | Download | only in Xaw
      1 /***********************************************************
      2 
      3 Copyright 1987, 1988, 1994, 1998  The Open Group
      4 
      5 Permission to use, copy, modify, distribute, and sell this software and its
      6 documentation for any purpose is hereby granted without fee, provided that
      7 the above copyright notice appear in all copies and that both that
      8 copyright notice and this permission notice appear in supporting
      9 documentation.
     10 
     11 The above copyright notice and this permission notice shall be included in
     12 all copies or substantial portions of the Software.
     13 
     14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
     18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     20 
     21 Except as contained in this notice, the name of The Open Group shall not be
     22 used in advertising or otherwise to promote the sale, use or other dealings
     23 in this Software without prior written authorization from The Open Group.
     24 
     25 
     26 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
     27 
     28                         All Rights Reserved
     29 
     30 Permission to use, copy, modify, and distribute this software and its
     31 documentation for any purpose and without fee is hereby granted,
     32 provided that the above copyright notice appear in all copies and that
     33 both that copyright notice and this permission notice appear in
     34 supporting documentation, and that the name of Digital not be
     35 used in advertising or publicity pertaining to distribution of the
     36 software without specific, written prior permission.
     37 
     38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
     39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
     40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
     41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
     42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
     43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
     44 SOFTWARE.
     45 
     46 ******************************************************************/
     47 
     48 #ifndef _XawText_h
     49 #define _XawText_h
     50 
     51 #include <X11/Xaw/Simple.h>
     52 
     53 /*
     54 
     55  Class:		textWidgetClass
     56  Class Name:	Text
     57  Superclass:	Simple
     58 
     59  Resources added by the Text widget:
     60 
     61  Name		     Class	     RepType		Default Value
     62  ----		     -----	     -------		-------------
     63  autoFill	    AutoFill	     Boolean		False
     64  bottomMargin	    Margin	     Position		2
     65  displayPosition    TextPosition     XawTextPosition	0
     66  insertPosition	    TextPosition     XawTextPosition	0
     67  justify	    JustifyMode	     JustifyMode	left
     68  leftColumn	    Column	     Column		0
     69  rightColumn	    Column	     Column		0
     70  leftMargin	    Margin	     Position		2
     71  rightMargin	    Margin	     Position		4
     72  positionCallback   Callback	     Callback		NULL
     73  scrollHorizontal   Scroll	     Boolean		False
     74  scrollVertical     Scroll	     Boolean		False
     75  selectTypes        SelectTypes      Pointer            see documentation
     76  textSink	    TextSink	     Widget		NULL
     77  textSource	    TextSource	     Widget		NULL
     78  topMargin	    Margin	     Position		2
     79  unrealizeCallback  Callback	     Callback		NULL
     80  wrap		    Wrap	     XawTextWrapMode	XawTextWrapNever
     81 
     82 */
     83 
     84 typedef long XawTextPosition;
     85 
     86 #ifndef notdef
     87 typedef enum {
     88   XawtextScrollNever,
     89   XawtextScrollWhenNeeded,
     90   XawtextScrollAlways
     91 } XawTextScrollMode;
     92 
     93 typedef enum {
     94   XawtextResizeNever,
     95   XawtextResizeWidth,
     96   XawtextResizeHeight,
     97   XawtextResizeBoth
     98 } XawTextResizeMode;
     99 #endif
    100 
    101 typedef enum {
    102   XawtextWrapNever,
    103   XawtextWrapLine,
    104   XawtextWrapWord
    105 } XawTextWrapMode;
    106 
    107 typedef enum {
    108   XawsdLeft,
    109   XawsdRight
    110 } XawTextScanDirection;
    111 
    112 typedef enum {
    113   XawtextRead,
    114   XawtextAppend,
    115   XawtextEdit
    116 } XawTextEditType;
    117 
    118 typedef enum {
    119   XawselectNull,
    120   XawselectPosition,
    121   XawselectChar,
    122   XawselectWord,
    123   XawselectLine,
    124   XawselectParagraph,
    125   XawselectAll,
    126   XawselectAlphaNumeric
    127 } XawTextSelectType;
    128 
    129 typedef enum {
    130     XawjustifyLeft,
    131     XawjustifyRight,
    132     XawjustifyCenter,
    133     XawjustifyFull
    134 } XawTextJustifyMode;
    135 
    136 typedef struct {
    137     int  firstPos;
    138     int  length;
    139     char *ptr;
    140     unsigned long format;
    141 } XawTextBlock, *XawTextBlockPtr;
    142 
    143 #ifndef OLDXAW
    144 typedef struct {
    145     int line_number;
    146     int column_number;
    147     XawTextPosition insert_position;
    148     XawTextPosition last_position;
    149     Boolean overwrite_mode;
    150 } XawTextPositionInfo;
    151 
    152 typedef struct {
    153     XawTextPosition left, right;
    154     XawTextBlock *block;
    155 } XawTextPropertyInfo;
    156 
    157 typedef struct _XawTextAnchor XawTextAnchor;
    158 typedef struct _XawTextEntity XawTextEntity;
    159 typedef struct _XawTextProperty XawTextProperty;
    160 typedef struct _XawTextPropertyList XawTextPropertyList;
    161 #endif
    162 
    163 #include <X11/Xaw/TextSink.h>
    164 #include <X11/Xaw/TextSrc.h>
    165 
    166 #define XtEtextScrollNever "never"
    167 #define XtEtextScrollWhenNeeded "whenneeded"
    168 #define XtEtextScrollAlways "always"
    169 #define XtEtextResizeNever "never"
    170 #define XtEtextResizeWidth "width"
    171 #define XtEtextResizeHeight "height"
    172 #define XtEtextResizeBoth "both"
    173 
    174 #define XtEtextWrapNever	"never"
    175 #define XtEtextWrapLine		"line"
    176 #define XtEtextWrapWord		"word"
    177 
    178 #define XtNautoFill "autoFill"
    179 #define XtNbottomMargin "bottomMargin"
    180 #define XtNdialogHOffset "dialogHOffset"
    181 #define XtNdialogVOffset "dialogVOffset"
    182 #define XtNdisplayCaret "displayCaret"
    183 #define XtNdisplayPosition "displayPosition"
    184 #define XtNleftMargin "leftMargin"
    185 #define XtNrightMargin "rightMargin"
    186 #define XtNpositionCallback "positionCallback"
    187 #define XtNscrollVertical "scrollVertical"
    188 #define XtNscrollHorizontal "scrollHorizontal"
    189 #define XtNselectTypes "selectTypes"
    190 #define XtNtopMargin "topMargin"
    191 #define XtNwrap "wrap"
    192 
    193 #define XtCColumn		"Column"
    194 #define XtNleftColumn		"leftColumn"
    195 #define XtNrightColumn		"rightColumn"
    196 
    197 #define XtCJustifyMode		XtCJustify
    198 #define XtNjustifyMode		XtNjustify
    199 #define XtEtextJustifyLeft	"left"
    200 #define XtEtextJustifyRight	"right"
    201 #define XtEtextJustifyCenter	"center"
    202 #define XtEtextJustifyFull	"full"
    203 
    204 #define XtCAutoFill "AutoFill"
    205 #define XtCSelectTypes "SelectTypes"
    206 #define XtCWrap "Wrap"
    207 #ifndef notdef
    208 #define XtCScroll		"Scroll"
    209 #endif
    210 
    211 #ifndef _XtStringDefs_h_
    212 #define XtNinsertPosition "insertPosition"
    213 #ifndef notdef
    214 #define XtNresize "resize"
    215 #define XtCResize "Resize"
    216 #endif
    217 #define XtNselection		"selection"
    218 #endif
    219 
    220 /* return Error code for XawTextSearch */
    221 #define XawTextSearchError      (-12345L)
    222 
    223 /* return codes from XawTextReplace */
    224 #define XawReplaceError	       -1
    225 #define XawEditDone		0
    226 #define XawEditError		1
    227 #define XawPositionError	2
    228 
    229 /* XrmQuark is not unsigned long */
    230 #define XawTextFormat(tw,fmt) ((unsigned long)_XawTextFormat(tw) == (fmt))
    231 
    232 extern unsigned long FMT8BIT;
    233 extern unsigned long XawFmt8Bit;
    234 extern unsigned long XawFmtWide;
    235 
    236 extern WidgetClass textWidgetClass;
    237 
    238 typedef struct _TextClassRec *TextWidgetClass;
    239 typedef struct _TextRec      *TextWidget;
    240 
    241 _XFUNCPROTOBEGIN
    242 
    243 XrmQuark _XawTextFormat
    244 (
    245  TextWidget		tw
    246  );
    247 
    248 void XawTextDisplay
    249 (
    250  Widget			w
    251  );
    252 
    253 void XawTextEnableRedisplay
    254 (
    255  Widget			w
    256  );
    257 
    258 void XawTextDisableRedisplay
    259 (
    260  Widget			w
    261  );
    262 
    263 void XawTextSetSelectionArray
    264 (
    265  Widget			w,
    266  XawTextSelectType	*sarray
    267  );
    268 
    269 void XawTextGetSelectionPos
    270 (
    271  Widget			w,
    272  XawTextPosition	*begin_return,
    273  XawTextPosition	*end_return
    274  );
    275 
    276 void XawTextSetSource
    277 (
    278  Widget			w,
    279  Widget			source,
    280  XawTextPosition	top
    281  );
    282 
    283 int XawTextReplace
    284 (
    285  Widget			w,
    286  XawTextPosition	start,
    287  XawTextPosition	end,
    288  XawTextBlock		*text
    289  );
    290 
    291 XawTextPosition XawTextTopPosition
    292 (
    293  Widget			w
    294  );
    295 
    296 XawTextPosition XawTextLastPosition
    297 (
    298  Widget			w
    299  );
    300 
    301 void XawTextSetInsertionPoint
    302 (
    303  Widget			w,
    304  XawTextPosition	position
    305  );
    306 
    307 XawTextPosition XawTextGetInsertionPoint
    308 (
    309  Widget			w
    310  );
    311 
    312 void XawTextUnsetSelection
    313 (
    314  Widget			w
    315  );
    316 
    317 void XawTextSetSelection
    318 (
    319  Widget			w,
    320  XawTextPosition	left,
    321  XawTextPosition	right
    322  );
    323 
    324 void XawTextInvalidate
    325 (
    326  Widget			w,
    327  XawTextPosition	from,
    328  XawTextPosition	to
    329 );
    330 
    331 Widget XawTextGetSource
    332 (
    333  Widget			w
    334  );
    335 
    336 Widget XawTextGetSink
    337 (
    338  Widget			w
    339  );
    340 
    341 XawTextPosition XawTextSearch
    342 (
    343  Widget			w,
    344 #if NeedWidePrototypes
    345  int			dir,
    346 #else
    347  XawTextScanDirection	dir,
    348 #endif
    349  XawTextBlock		*text
    350  );
    351 
    352 void XawTextDisplayCaret
    353 (
    354  Widget			w,
    355 #if NeedWidePrototypes
    356  int			visible
    357 #else
    358  Boolean		visible
    359 #endif
    360  );
    361 
    362 _XFUNCPROTOEND
    363 
    364 /*
    365  * For R3 compatibility only
    366  */
    367 #include <X11/Xaw/AsciiSrc.h>
    368 #include <X11/Xaw/AsciiSink.h>
    369 
    370 #endif /* _XawText_h */
    371