## 4.12 Text Widgets

A text widget provides a window that will allow an application to display and edit one or more lines of text. Text widgets provide a minimal set of the common (emacs-like) keyboard editing commands as well as the X11 selection mechanism.

Text widgets also support a set of hardcoded text properties. Current supported text properties are: font, underlining, bitmap/pixmap, background color and foreground color.

Two text widgets are provided in EZwgl, an internal text widget and a composite text widget.

### Widget Info

Symbolic widget type | EZ_WIDGET_TEXT
Default class name | "Text"
Default instance name | "text"

Symbolic widget type | EZ_WIDGET_ITEXT
Default class name | "IText"
Default instance name | "iText"

### Subwidgets Info

Subwidgets of Text are listed below.

            ( iText
     text-->( horizontalScrollbar
            ( verticalScrollbar

### Widget Interface Routines

`void EZ_GetTextWidgetComponents(EZ_Widget *widget, EZ_Widget **itxt,`

`EZ_Widget **hscr, EZ_Widget **vscr );`

return the components of a composite text widget.

`void EZ_TextLoadFile(EZ_Widget *widget,char *fname);`

read a text file into a text widget.

`void EZ_TextClear(EZ_Widget *widget);` clear a text widget.

`int EZ_TextSaveText (EZ_Widget *widget, char *file)`

save the contents of a text widget to a file.

`int EZ_TextBufferModified(EZ_Widget *widget);`

return 1 if buffer has been modifed since last save.

`char *EZ_TextGetBufferString (EZ_Widget *widget);`

returns the text in a text widget.

Editing Commands

    int   EZ_TextSetMarker (EZ_Widget *widget):
    int   EZ_TextGetPosition (EZ_Widget *widget):
    void  EZ_TextGotoPosition (EZ_Widget *widget, int pos):
    char  *EZ_TextGetRegionString (EZ_Widget *widget):

    void EZ_TextNextLine(EZ_Widget *widget):
    void EZ_TextPreviousLine(EZ_Widget *widget):
    void EZ_TextBackwardChar (EZ_Widget *widget):
    void EZ_TextForwardChar (EZ_Widget *widget):

    void EZ_TextForwardWord (EZ_Widget *widget):
    void EZ_TextBackwardWord (EZ_Widget *widget):
    void EZ_TextPreviousPage (EZ_Widget *widget):
    void EZ_TextNextPage (EZ_Widget *widget):

    void EZ_TextEndOfLine (EZ_Widget *widget):
    void EZ_TextBeginningOfLine (EZ_Widget *widget):
    void EZ_TextEndOfBuffer (EZ_Widget *widget):
    void EZ_TextBeginningOfBuffer (EZ_Widget *widget):

    void EZ_TextInsertChar (EZ_Widget *widget, char c):
    void EZ_TextDeletePreviousChar (EZ_Widget *widget):
    void EZ_TextDeleteNextChar (EZ_Widget *widget):
    void EZ_TextInsertNewLine (EZ_Widget *widget):

    void EZ_TextKillEndOfLine (EZ_Widget *widget):
    void EZ_TextKillRegion (EZ_Widget *widget):
    void EZ_TextPasteSelection (EZ_Widget *widget):
    void EZ_TextReDisplay (EZ_Widget *widget):
    void EZ_TextInsertString (EZ_Widget *widget, char *str):

    void EZ_TextSetRegionFont (EZ_Widget *widget, char *fontname):
    void EZ_TextSetRegionForeground (EZ_Widget *widget, char *clr):
    void EZ_TextSetRegionBackground (EZ_Widget *widget, char *clr):
    void EZ_TextSetRegionUnderline (EZ_Widget *widget, int udl):

    void EZ_TextSetRegionProperty (EZ_Widget *widget, EZ_TextProperty *prop):
    void EZ_TextReplaceRegionWithPixmap (EZ_Widget *widget, char *file):
    void EZ_TextInsertStringWithProperty (EZ_Widget *widget, char *str,
                                          EZ_TextProperty *prop):

### Screenshot

### Resources

Config_Option | ResourceName | DefaultValue
EZ_CLASS | class | `"Text"`
|  | or `"IText"`
EZ_NAME | name | `"text"`
|  | or `"iText"`

EZ_X | x |
EZ_Y | y |
EZ_WIDTH | width |
EZ_HEIGHT | height |

EZ_LOCATION | location |
EZ_SIZE | size |
EZ_GEOMETRY | geometry |

EZ_WIDTH_HINT | widthHint |
EZ_HEIGHT_HINT | heightHint |
EZ_SIZE_HINT | sizeHint |

EZ_BORDER_WIDTH | borderWidth | `0` or `2`
EZ_BORDER_TYPE | borderType | `none` or `sunken`
EZ_FOCUS_PAD | focusPad | `0` or `2`

EZ_PADX | padx | `8` or `0`
EZ_PADY | pady | `6` or `0`
EZ_IPADX | iPadx | `0`
EZ_IPADY | iPady | `0`

EZ_EXPAND | expand | `false`
EZ_PROPAGATE | propagate | `true`
EZ_TRANSIENT | transient | `false`

EZ_FONT_ID | fontID | `3`
EZ_FONT_NAME | fontName | `"*fixed*"`

EZ_CURSOR | cursor | `"XC_xterm"`
EZ_BUBBLE_STRING | bubbleString | `null`

EZ_CALLBACK | N/A | `null null`
EZ_MOTION_CALLBACK | N/A | `null null`
EZ_DESTROY_CALLBACK | N/A | `null null`
EZ_EVENT_HANDLER | N/A | `null null`

EZ_FOREGROUND | foreground | `"black"`
EZ_BACKGROUND | background | `"gray74`
EZ_BG_IMAGE_FILE | bgImageFile | `null`
EZ_BG_PIXMAP | N/A | `none`
EZ_HIGHLIGHT_BACKGROUND | highlightBackground |

EZ_BG_IMAGE_FILE_B | bgImageFileB | `null`
EZ_BG_PIXMAP_B | N/A | `none`
EZ_CLIENT_PTR_DATA | N/A | `null`
EZ_CLIENT_INT_DATA | clientIntData | `0`

EZ_DND_DRAG_CURSOR | dndDragCursor | `none`
EZ_DND_BUBBLE_STRING | dndBubbleString | `null`

EZ_SCROLLBAR_WIDTH | scrollbarWidth | `10`
EZ_SCROLLBAR_BORDER_WIDTH | scrollbarBorderWidth | `2`
EZ_HSCROLL_INCREMENT | hScrollIncrement | `1`
EZ_VSCROLL_INCREMENT | vScrollIncrement | `1`

EZ_SELECTION_BACKGROUND | selectionBackground |
EZ_TEXT_BACKGROUND | textBackground |
EZ_TEXT_WIDGET_EDITABLE | textWidgetEditable | `true`
EZ_TEXT_SPACING | textSpacing | `0`
EZ_WRAP_TEXT | wrapText | `1`

EZ_OPTIONAL_HSCROLLBAR | optionalHScrollbar | `true`
EZ_OPTIONAL_VSCROLLBAR | optionalVScrollbar | `true`

HTML Documentation Maintainance:`Arturo Espinosa <arturo@nuclecu.unam.mx>`