StaticText(3W)
NAME
StaticText − static text widget
SYNOPSIS
#include <Xol/OpenLook.h>
#include <Xol/StaticText.h>
. . .
ANCESTRY
Core-Primitive-StaticText
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.
Keyboard Traversal
The default value of the XtNtraversalOn resource is FALSE.
If XtNtraversalOn is set to TRUE, 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.
Coloration
of the StaticText widget.
Figure 1 Static Text Coloration
Display of Keyboard Mnemonic And Accelerator
The StaticText does not have keyboard mnemonic or keyboard accelerator
capabilities.
RESOURCES
Table 1 StaticText Resource Summary
Name Type Default Access
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 font) SI
XtNfontColor- Pixel (see below) SGI
XtNforeground- Pixel XtDefaultForeground SGI
XtNgravity- OlDefine CenterGravity SGI
XtNheight OlDefine (calculated) SGI
XtNhSpace Dimension 2 SGI
XtNinputFocusColor- Pixel Red SGI
XtNlineSpace int 0 SGI
XtNmappedWhenManaged- Boolean TRUE SGI
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
XtNvSpace Dimension 2 SGI
XtNwidth Dimension (calculated) SGI
XtNwrap Boolean TRUE SGI
XtNx- Position 0 SGI
XtNy- Position 0 SGI
Access: S = XtSetValues G = XtGetValues
I = init time O = other access
† see resources(3W)
XtNalignment
class:XtCAlignment type:OlDefine default:OL_LEFTaccess:SGI
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:XtCFontColor type:Pixel default:XtDefaultForegroundaccess:SGI
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:XtCFontColor type:Pixel default:XtDefaultForegroundaccess:SGI
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:XtCForeground type:Pixel default:XtDefaultForegroundaccess:SGI
Action: defines the foreground color for the widget.
XtNgravity
class:XtCGravity type:OlDefine default:WestGravityaccess:SGI
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.
XtNheight
class:XtCHeight type:OlDefine default:(calculated)access:SGI
Action: Specifies the height of the StaticText window (not including the border). If XtNrecomputeSize is set to TRUE, XtNheight is be set to:
(height of text) + 2(XtNhSpace)
XtNhSpace
class:XtCHSpace type:Dimension default:2access:SGI
Action: Specifies the number of pixels of horizontal padding between the window borders and the displayed string.
XtNlineSpace
class:XtCLineSpace type:int default:0access:SGI
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:XtCRecomputeSize type:Boolean default:TRUEaccess:SGI
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:XtCString type:String default:NULLaccess:SGI
Action: specifies the ( NULL terminated) string to be drawn.
XtNstrip
class:XtCStrip type:Boolean default:TRUEaccess:SGI
Action: controls the stripping of leading and trailing spaces during the layout of the text string.
Values: TRUE, FALSE
Table 2 XtNstrip _ _ OL_CENTER Both leading and trailing spaces stripped. FALSE any None.
XtNvSpace
class:XtCVSpace type:Dimension default:2access:SGI
Action: Specifies the number of pixels of vertical padding between the window borders and the StaticText string.
XtNwidth
class:XtCWidth type:Dimension default:(calculated)access:SGI
Action: Specifies the width of the StaticText window (not including the border). If XtNrecomputeSize is set to TRUE, XtNwidth is set to:
(width of text) + 2(XtNvSpace)
XtNwrap
class:XtCWrap type:Boolean default:TRUEaccess:SGI
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
SEE ALSO
textbuffer(3W), textedit(3W), textfield(3W), textselection(3W), textbuffer(3W), TextEdit(3W), TextField(3W)
Version 3.0.1 — Last change: June 92