Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

StaticText(3w)  —  OLIT Widget Set

NAME

StaticText − static text widget

SYNOPSIS

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <Xol/OpenLook.h>
#include <Xol/StaticText.h>
 . . .
Widget my_statictext, my_parent;
String my_name;
ArgList args;
Cardinal num_args;

my_statictext =  XtCreate( my_name, staticTextWidgetClass,

my_parent, args, num_args);

DESCRIPTION

The StaticText widget provides a way to present an uneditable block of text using a few simple layout controls. 

Word Wrap

If the text is too long to fit in the width provided by the StaticText widget, the text may be "wrapped" if the application requests it.  The wrapping occurs at a space between words, if possible, leaving as many words on a line as will fit.  If a word is too long for the width, it is wrapped between characters.  An embedded newline will always cause a wrap. 

Text Clipping

If the text is not wrapped, it will be truncated if it cannot fit in the width of the StaticText widget.  The application can choose whether the truncation occurs on the left, right, or evenly on both sides of each line of the text. 

If the text is too large to fit in the height provided by the StaticText widget, the text is clipped on the bottom.  The clipping falls on a pixel boundary, not between lines, so that it is possible that only the upper part of the last line of text may be visible. 

Space Stripping

The application can choose to have leading spaces, trailing spaces, or both leading and trailing space stripped from the text before display, or can choose to have no stripping done. 

Selecting and Operating on Text

The StaticText widget allows text to be selected in several ways and then copied.  See textselection(3w) for the description of these operations. 

Coloration

When the user uses keyboard traversal to navigate to a StaticText widget, the active text caret is displayed at the beginning of the text or at its last position if it has been moved.  The caret’s color is the XtNinputFocusColor.  The caret is removed when the input focus leaves the StaticText widget. 

of the StaticText widget. 

  Figure 1 Static Text Coloration

Keyboard Traversal

The default value of the XtNtraversalOn resource is FALSE. 

The widget responds to the following keyboard navigation keys:

—NEXT_FIELD moves to the next traversable widget in the window

—PREV_FIELD moves to the previous traversable widget in the window

—NEXTWINDOW moves to the next window in the application

—PREVWINDOW moves to the previous window in the application

—NEXTAPP moves to the first window in the next application

—PREVAPP moves to the first window in the previous application

When the user uses keyboard traversal to navigate to a StaticText widget, the active text caret is displayed.  The caret’s color is the XtNinputFocusColor.  The caret is removed when the input focus leaves the StaticText widget. 

Display of Keyboard Mnemonic And Accelerator

The StaticText does not have keyboard mnemonic or keyboard accelerator
 capabilities.

RESOURCES

  Table 1 StaticText Resource Summary

StaticText           Resource       Set
Name                 Type           Default             Access
 
XtNaccelerator       String         NULL                SGI
XtNacceleratorText   String         Dynamic             SGI
XtNalignment         OlDefine       OL_LEFT             SGI
XtNancestorSensitive Boolean        TRUE                GO
XtNbackground        Pixel          XtDefaultBackground SGI
XtNbackgroundPixmap  Pixmap         (none)              SGI
XtNborderColor       Pixel          XtDefaultForeground SGI
XtNborderPixmap      Pixmap         (none)              SGI
XtNborderWidth       Dimension      0                   SGI
XtNconsumeEvent      XtCallbackList NULL                SGI
XtNdepth             int            (parent’s)          GI
XtNdestroyCallback   XtCallbackList NULL                SI
XtNfont              XFontStruct∗   (OPEN               LOOK
XtNfontColor         Pixel          (see                below)
XtNforeground        Pixel          XtDefaultForeground SGI
XtNgravity           OlDefine       CenterGravity       SGI
XtNheight            OlDefine       (calculated)        SGI
XtNinputFocusColor   Pixel          Red                 SGI
XtNlineSpace         int            0                   SGI
XtNmappedWhenManaged Boolean        TRUE                SGI
XtNmnemonic          unsigned       char                NULL
XtNrecomputeSize     Boolean        TRUE                SGI
XtNreferenceName     String         NULL                SGI
XtNreferenceWidget   Widget         NULL                SGI
XtNsensitive         Boolean        TRUE                GIO
XtNstring            String         NULL                SGI
XtNstrip             Boolean        TRUE                SGI
XtNtraversalOn       Boolean        FALSE               SGI
XtNuserData          XtPointer      NULL                SGI
XtNwidth             Dimension      (calculated)        SGI
XtNwrap              Boolean        TRUE                SGI
XtNx                 Position       0                   SGI
XtNy                 Position       0                   SGI

Access:S = XtSetValues G = XtGetValues
        I = init timeO = other access
† see resources(3W)

XtNalignment

 class:XtCAlignmenttype:OlDefinedefault:OL_LEFTOL_LEFT’u’access:SGISGI’u’

Action: specifies the alignment to be applied when drawing the text. 

Values: OL_LEFT – causes the left sides of the lines to be vertically aligned; OL_CENTER – causes the centers of the lines to be vertically aligned; OL_RIGHT – causes the right sides of the lines to be vertically aligned. 

XtNfont

 class:XtCFontColortype:Pixeldefault:BlackBlack’u’access:SGISGI’u’

Action: identifies the font to be used to display the text. 

Values: any valid return from XtNLoadQueryFont(). 

The default value is chosen to match the scale and screen resolution.  The default value points to a cached font structure; an application should not expect to get this value with a call to XtGetValues() and use it reliably thereafter. 

XtNfontColor

 class:XtCFontColortype:Pixeldefault:BlackBlack’u’access:SGISGI’u’

Action: specifies the font color. 

Values: any pixel value valid for the current display, or
any name from the rgb.txt file

If not set, the color from the XtNforeground resource, if available, is used for the font. 

XtNforeground

 class:XtCForegroundtype:Pixeldefault:BlackBlack’u’access:SGISGI’u’

Action: defines the foreground color for the widget. 

XtNgravity

 class:XtCGravitytype:OlDefinedefault:WestGravityWestGravity’u’access:SGISGI’u’

Action: controls the use of any extra space with the StaticText widget. 

The application can set a width and height to the StaticText widget that exceeds the size needed to display the string.  This resource controls the use of any extra space with the StaticText widget. 

CenterGravity – string is centered vertically and horizontally in the extra space. 

NorthGravity – top edge of the string is aligned with the top edge of the space and centered horizontally. 

SouthGravity – bottom edge of the string is aligned with the bottom edge of the space and centered horizontally. 

EastGravity – right edge of the string is aligned with the right edge of the space and centered vertically. 

WestGravity – left edge of the string is aligned with the left edge of the space and centered vertically. 

NorthWestGravity – top and left edges of the string are aligned with the top and left edges of the space. 

NorthEastGravity – top and right edges of the string are aligned with the top and right edges of the space. 

SouthWestGravity – bottom and left edges of the string are aligned with the bottom and left edges of the space. 

SouthEastGravity – bottom and right edges of the string are aligned with the bottom and right edges of the space. 

XtNlineSpace

 class:XtCLineSpacetype:intdefault:00’u’access:SGISGI’u’

Action: controls the amount of space between lines of text. 

Values: -100 ≤ XtNlineSpace

The spacing is specified as a percentage of the font height, and is the distance between the baseline of one text line and the top of the next font line.  Thus, the distance between successive text baselines, in percentage of the font height, is XtNlineSpace + 100. 

XtNrecomputeSize

 class:XtCRecomputeSizetype:Booleandefault:TRUETRUE’u’access:SGISGI’u’

Action: indicates whether the StaticText widget should calculate its size and automatically set the XtNheight and XtNwidth resources. 

Values: TRUE – the StaticText widget will do normal size calculations that may cause its geometry to change.  FALSE – the StaticText widget will leave its size alone; this may cause truncation of the visible image being shown by the StaticText widget if the fixed size is too small, or may cause centering if the fixed size is too large. 

XtNstring

 class:XtCStringtype:Stringdefault:NULLNULL’u’access:SGISGI’u’

Action: specifies the ( NULL terminated) string to be drawn. 

XtNstrip

 class:XtCStriptype:Booleandefault:TRUETRUE’u’access:SGISGI’u’

Action: controls the stripping of leading and trailing spaces during the layout of the text string. 

Values: TRUE, FALSE

  Table 2 XtNstrip

XtNstrip  XtNalignment Spaces  stripped
=
TRUE      OL_LEFT      Leading spaces
_         _
OL_RIGHT  Trailing     spaces  stripped.
_         _
OL_CENTER Both         leading and
_
FALSE     any          None.

XtNwrap

 class:XtNalignmenttype:Wrapdefault:actionaction’u’access:’u’

Action: controls the wrapping of lines that are too long to fit in the width of the StaticText widget. 

Values: TRUE, FALSE

  Table 3 XtNwrap

XtNwrap   XtNalignment Wrap    action
=
FALSE     OL_LEFT      Clipped on
_         _
OL_RIGHT  Clipped      on      the
_         _
OL_CENTER Clipped      equally on
_
TRUE      any          Long    text
with      each         line    of
having    as           many    words

 

SEE ALSO

textbuffer3w, textedit3w, textfield3w, textselection3w, textbuffer3w, TextEdit3w, TextField3w

Version 3.0  —  Last change: 19 July 91

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026