Application Header file Class Header file Class Class Name Superclass |
<X11/XawPlus/Label.h> <X11/XawPlus/LabelP.h> labelWidgetClass Label Simple |
A Label widget is a text string or bitmap displayed within a rectangular region of the screen. The label may contain multiple lines of Latin1 characters. The Label widget will allow its string to be left, right, or center justified. Normally, this widget can be neither selected nor directly edited by the user. It is intended for use as an output device only.
Since the core extension class Add3dExt is inserted, the Label widget has the additional resources highlightColor, shadowColor and buttonBorderWidth. The default background color is now grey75. The bitmap and leftBitmap resources also provides support of XPM styled pixmaps.
XawPlus has now two additional pixmap resources: clipMask and leftClipMask. This is the result of cleaning up the conversion mechanism of XPM styled pixmaps. The behavior is different to the previous versions of XawPlus. If you want to use XPM pixmaps with the background color None both pixmap resources has to be set: bitmap and clipMask or leftBitmap and leftClipMask.
XawPlus has now a truncate mechanism for label strings, which are too long for the labels window. Label now truncate those strings from the left or from the right side, dependent on the resource truncLeftSide. Default is to truncate from the right side. It is possible to deactivate this mechanism with the the resource truncateLabel. This feature is not very useful for multiline labels and therefore not supported.
When creating a Label 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 |
ADD3DEXT: | |||
highlightColor shadowColor buttonBorderWidth |
Background Background Width |
Pixel Pixel Dimension |
grey90 grey40 2 |
SIMPLE: | |||
cursor cursorName pointerColor pointerColorBackground insensitiveBorder |
Cursor Cursor Foreground Background Insensitive |
Cursor String Pixel Pixel Pixmap |
None NULL XtDefaultForeground XtDefaultBackground NULL |
LABEL: | |||
internalHeight internalWidth justify resize truncateLabel truncLeftSide font encoding foreground label leftBitmap leftClipMask bitmap clipMask |
Height Width Justify Resize Truncate Truncate Font Encoding Foreground Label LeftBitmap LeftBitmap Pixmap Pixmap |
Dimension Dimension XtJustify Boolean Boolean Boolean XFontStruct* uchar Pixel String Bitmap ClipMask Bitmap ClipMask |
2 4 XtJustifyCenter True True False XtDefaultFont XawTextEncoding8bit XtDefaultForeground NULL None None None None |
internalHeight, internalWidth |
These resources defines the internal border width between the label string or the bitmap and the border of this widget. |
justify | Defines how to jusify a label string in a label widget (left, right or centered). |
resize | Defines how to handle a resize event after creation of the widget. Default is to handle every resize event and to justify the labels interiors. |
truncateLabel | Defines what to do with a label string, if it is too long. Default is to truncate the string until it fits into the widgets window. |
truncateLeftSide | Defines to truncate a too long label string from the left side. In this case the strings starts with two dots and the end of the string remains visible. Default ist to cut it from the right side. |
font | With this resource it is possible to set any available font to display the label text. |
encoding | Two types of encoding are available, the default 8 bit encoding and the 16 bit encoding (unicode). |
foreground | This is the foreground color, used to display a label text. |
label | Defines the label text. It is not possible to use both a label and a bitmap, but it is possible to use a label with a leftBitmap. |
leftBitmap | This resource defines a bitmap or a XPM styled pixmap, placed left of the label text. XPM pixmaps are detected through their filename extension .xpm. |
leftClipMask | This resource defines a bitmap or a XPM styled pixmap, used as a clip mask for the leftBitmap resource. If the background color of an XPM pixmap is defined as None, it is usable as bitmap and as a clip mask. Otherwise the user needs a second bitmap, if a clip mask is required. |
bitmap | Defines a bitmap or a XPM styled pixmap to display in the label widget. It is not possible to use a bitmap together with a label or a leftBitmap. |
clipMask | This resource defines a bitmap or a XPM styled pixmap, used as a clip mask for the bitmap resource. |
Since XawPlus 2.1 there is a new public function to control the truncate mechanism. In Label the truncate mechanism is only activated, if it is a Label itself and not the superclass of another widget. The reason is, that derived widgets have another idea how to place the label interiors correctly.
void TruncateLabelString(lw, usableWidth)
LabelWidget lw;
int usableWidth;
lw | Specifies the Label widget. |
usableWidth | Specifies the usable window width inside of the label. |