Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

STATICTEXT WIDGET(3W)  —  OLIT

WIDGET CLASS NAME

StaticText

SYNOPSIS

#include <Intrinsic.h>
#include <StringDefs.h>
#include <OpenLook.h>
#include <StaticText.h>

widget = XtCreateWidget(name, staticTextWidgetClass, ...);

DESCRIPTION

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

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—In Width

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.  Text Clipping—In Height

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.  Stripping of Spaces

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 the Text

The StaticText widget allows text to be selected in several ways and then copied.  See Text Selection earlier in this manual for the description of these operations. 
StaticText Coloration

The diagram Static Text Coloration illustrates the resources that affect the coloration of the StaticText widget. 

RESOURCES

StaticText Resource Set
                Name            Type     Default   Access XtNancestorSensitive         Boolean        TRUE       G∗
       XtNbackground           Pixel       White  SGI†
 XtNbackgroundPixmap          Pixmap      (none)  SGI†
      XtNborderColor           Pixel       Black  SGI†
     XtNborderPixmap          Pixmap      (none)  SGI†
      XtNborderWidth       Dimension           0      SGI
            XtNdepth             int  (parent’s)       GI
  XtNdestroyCallback  XtCallbackList        NULL       SI
             XtNfont   XFontStruct ∗  (OPEN LOOK font)       SI
        XtNfontColor           Pixel  (see below)      SGI
       XtNforeground           Pixel       Black  SGI†
StaticText Resource Set (cont.)
                Name       Type       Default  Access
          XtNgravity   OlDefine   WestGravity     SGI
           XtNheight   OlDefine  (calculated)     SGI
        XtNlineSpace        int             0     SGI XtNmappedWhenManaged    Boolean          TRUE     SGI
    XtNrecomputeSize    Boolean          TRUE     SGI
        XtNsensitive    Boolean          TRUE     GI∗
           XtNstring     String          NULL     SGI
            XtNstrip    Boolean          TRUE     SGI
         XtNuserData  XtPointer          NULL     SGI
            XtNwidth  Dimension  (calculated)     SGI
             XtNwrap    Boolean          TRUE     SGI
                XtNx   Position             0     SGI
                XtNy   Position             0     SGI XtNalignment

Range of Values:

OL_LEFT/"left"
OL_CENTER/"center"
OL_RIGHT/"right"

This specifies the alignment to be applied when drawing the text, as described below:

OL_LEFTcauses the left sides of the lines to be vertically aligned;

OL_CENTER
causes the centers of the lines to be vertically aligned;

OL_RIGHTcauses the right sides of the lines to be vertically aligned. 

XtNfont

Range of Values:

(any valid return from XLoadQueryFont())

Default:

(chosen to match the scale and screen resolution)

This resource identifies the font to be used to display the text. 

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

Range of Values:

(any Pixel value valid for the current display)/(any name from the rgb.txt file)

Default:

value of XtNforeground

This resource specifies the color for the font.  If not set, the color from the XtNforeground resource, if available, is used for the font.  See the note about the interaction of this resource with other color resources under the description of the XtNbackground resource in CORE(3W).  XtNforeground

This resource defines the foreground color for the widget. 

See the note about the interaction of this resource with other color resources under the description of the XtNbackground resource in CORE(3W).  XtNgravity

Range of Values:

CenterGravity
NorthGravity
SouthGravity
EastGravity
WestGravity
NorthWestGravity
NorthEastGravity
SouthWestGravity
SouthEastGravity

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
The string is centered vertically and horizontally in the extra space.

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

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

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

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

NorthWest
The top and left edges of the string are aligned with the top and left edges of the space.

NorthEast
The top and right edges of the string are aligned with the top and right edges of the space.

SouthWest
The bottom and left edges of the string are aligned with the bottom and left edges of the space.

SouthEast
The bottom and right edges of the string are aligned with the bottom and right edges of the space.

XtNlineSpace

Range of Values:

-100 ≤ XtNlineSpace

This resource controls the amount of space between lines of text.  It 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

XtNrecomputeSize

Range of Values:

TRUE
FALSE

This resource indicates whether the StaticText widget should calculate its size and automatically set the XtNheight and XtNwidth resources.  If set to TRUE, the StaticText widget will do normal size calculations that may cause its geometry to change.  If set to 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

This resource is the string that will be drawn.  The string must be null terminated.  XtNstrip

Range of Values:

TRUE
FALSE

This resource controls the stripping of leading and trailing spaces during the layout of the text string.  XtNstrip XtNalignment Spaces stripped
 
TRUE       OL_LEFT      Leading spaces stripped.
           OL_RIGHT     Trailing spaces stripped.
           OL_CENTER    Both leading and trailing spaces stripped. FALSE       any         None
 
XtNwrap

Range of Values:

TRUE
FALSE

This resource controls the wrapping of lines that are too long to fit in the width of the StaticText widget.  XtNwrap XtNalignment Wrap action
 
FALSE   OL_LEFT         Clipped on the right
        OL_RIGHTClipped on the left
        OL_CENTERClipped equally on both left and right TRUE  any           Long text is broken at spaces between words
                           so that each line of the displayed text has
                            as many words as can fit.

Sun Release 4.0  —  Last change: 1/8/90

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