The Text Widget
Author: Roland Krause 2002, roland_krause@freenet.de
Description: Documentation to XawPlus

### _________________________________________________________XawPlus

### The Text Widget

Application Header file Class Header file Class Class Name Superclass | <X11/XawPlus/Text.h> <X11/XawPlus/TextP.h> textWidgetClass Text Simple

The Text widget is the glue that binds all the other pieces together, it maintains the internal state of the displayed text, and acts as a mediator between the text source and the text sink.

This section lists the resources that are actually part of the Text widget, and explains the functionality provided by each.

Note that the Text widget itself is not very useful. It is meant for subclassing to create other more specific text widgets like AsciiText.

### Differences between Xaw and XawPlus

Since the 3D extensions of Simple are inserted, the Text widget has the additional (but at this time not used) resources highlightColor, shadowColor and buttonBorderWidth. The default background color is now grey75. The vertical scrollbar is always placed on the right side of the text window, if it is visible.

### Resources

When creating a Text widget instance, the following resources are retrieved from the argument list of XtSetValues() or XtVaSetValues() or from the resource database:

Name | Class | Type | Default Value
OBJECT: |  |  |
destroyCallback | Callback | Pointer | NULL
RECTANGLE: |  |  |
borderWidth height sensitive width x y | BorderWidth Height Sensitive Width Position Position | Dimension Dimension Boolean Dimension Position Position | 0 12 True 12 0 0
CORE: |  |  |
border background mappedWhenManaged | BorderColor Background MappedWhenManaged | Pixel Pixel Boolean | XtDefaultForeground grey75 True
SIMPLE: |  |  |
cursor cursorName pointerColor pointerColorBackground insensitiveBorder international highlightColor shadowColor buttonBorderWidth | Cursor Cursor Foreground Background Insensitive International Background Background Width | Cursor String Pixel Pixel Pixmap Boolean Pixel Pixel Dimension | None NULL XtDefaultForeground XtDefaultBackground NULL False grey90 grey40 2
TEXT: |  |  |
autoFill bottomMargin topMargin leftMargin rightMargin displayPosition insertPosition resize scrollHorizontal scrollVertical selectTypes textSink textSource unrealizeCallback wrap displayCaret | AutoFill Margin Margin Margin Margin TextPosition TextPosition Resize Scroll Scroll SelectTypes TextSink TextSource Callback Wrap Output | Boolean Position Position Position Position XawTextPosition XawTextPosition XawTextResizeMode XawTextScrollMode XawTextScrollMode Pointer Widget Widget Callback XawTextWrapMode Boolean | False 2 2 2 4 0 0 XawTextResizeNever XawtextScrollNever XawtextScrollNever see documentation NULL NULL NULL XawTextWrapNever True

autoFill | If this resource is True the text widget will automatically break a line when the user attempts to type into the right margin. The attribute has no effect on files or text inserted into the text widget. It only checks to see if the action should be taken when a user enters a new character via the insert-character action.
bottomMargin, topMargin, leftMargin, rightMargin | The amount of space, in pixels, between the edge of the window and the corresponding edge of the text within the window. If there is a scrollbar active on this edge, then this is the space between the text and the scrollbar.
displayPosition | The position in the text buffer of the character that is currently displayed in the upper left hand corner of the text display.
insertPosition | This is the position of the insert point. It is expressed in characters from the beginning of the file. The cursor will always be forced to be on the screen. This resource may therefore be used to scroll the text display to a certain character position
resize | Controls whether or not the text widget attempts to resize itself when it is no lonber able to display the full text buffer in the associated window. Any attempt by the text widget to resize itself is always subject to the constraints imposed by its parent. The Value XawTextResizeNever, XawTextResizeWidth, XawTextResizeHeight and XawTextResizeBoth are all acceptable for this resource. A converter is registered for this resource that will convert the following strings: never, heght, width and both.
scrollHorizontal, scrollVertical | These resources control the the placement of scrollbars on the right and bottom edge of the text widget. These resources accept the values XawtextScrollAlways, XawtextScrollWhenNeeded and XawtextScrollNever. A converter is registered for this resource that will convert the strings always, never and whenNeeded into the corresponding values. If XawtextScrollWhenNeeded is specified, the appropriate scrollbar will only appear when there is text in the buffer that is not able to fit within the bounds of the widgets window. The scrollbar will disappear when the text again fits within the window.
selectTypes | Specifies the selection type array that is used when multi-click is activated. See Text Selection for Application Programmers for details.
textSink, textSource | These are the TextSink and the TextSource objects used by this widgets. When using the Text widget these must be set by the application programmer.
unrealizeCallback | A list of callback functions which will be executed when the text widget is unrealized.
wrap | When a text in any line is wider than the window there are several possible actions. This resource allows the user to decide what will happen. The accepted values for this resource are XawtextWrapNever, XawtextWrapLine and XawtextWrapWord. With XawtextWrapLine all text that is beyond the right edge of the window will be display on the next line. With XawtextWrapWord the same action occurs but the text is broken at a word boundary if possible. If no wrapping is enabled then the text will extend off the edge of the window and a small rectangle will be painted in the right margin to alert the user that this line is too long. A converter is registered for this resource that will convert the strings never, word and line.
displayCaret | Whether ot not to display the text insertion point.

### XawPlus_________________________________________________________