Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XmLabel(3Xm) — RISC iX 1.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Core(3Xm)

XmCreateLabel(3Xm)

XmFontListCreate(3Xm)

XmPrimitive(3Xm)

XmStringCreate(3Xm)

XmStringCreateLtoR(3Xm)

XmLabel(3Xm)  —  UNIX Programmer’s Manual

NAME

XmLabel — the Label widget class. 

SYNOPSIS

#include <Xm/Label.h>

DESCRIPTION

Label is an instantiable widget and is also used as a superclass for other button widgets, such as PushButton and ToggleButton.  The Label widget does not accept any button or key input, and the help callback is the only callback defined.  Label also receives enter and leave events. 

Label can contain either text or a pixmap.  Label text is a compound string.  Refer to the Programmer’s Guide for more information on compound strings.  The text can be multidirectional, multiline, and/or multifont.  When a Label is insensitive, its text is stippled, or the user supplied insensitive pixmap is displayed. 

Label supports both accelerators and mnemonics primarily for use in Label subclass widgets that are contained in menus.  Mnemonics are available in a  menu system when the button is visible.  Accelerators in a menu system are accessible even when the button is not visible.  The Label widget displays the mnemonic by underlining the first matching character in the text string.  The accelerator is displayed as a text string to the right of the label text or pixmap. 

Label consists of many margin fields surrounding the text or pixmap.  These margin fields are resources that may be set by the user, but Label subclasses also modify some of these fields.  The subclasses tend to modify the XmNmarginLeft, XmNmarginRight, XmNmarginTop, and XmNmarginBottom resources and leave the XmNmarginWidth and XmNmarginHeight resources as set by the application. 

Classes

Label inherits behavior and resources from Core and XmPrimitive Classes. 

The class pointer is xmLabelWidgetClass. 

The class name is XmLabel. 

New Resources

The following table defines a set of widget resources used by the programmer to specify data.  The programmer can also set the resource values for the inherited classes to set attributes for this widget.  To reference a resource by name or by class in a .Xdefaults file, remove the XmN or XmC prefix and use the remaining letters.  To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm prefix and use the remaining letters (in either lower case or upper case, but include any underscores between words).  The codes in the access column indicate if the given resource can be set at creation time (C), set by using XtSetValues (S), retrieved by using XtGetValues (G), or is not applicable (N/A). 

XmLabel Resource Set
Name Class Type Default Access
XmNaccelerator XmCAccelerator String NULL CSG
XmNacceleratorText XmCAcceleratorText XmString NULL CSG
XmNalignment XmCAlignment unsigned char XmALIGNMENT_CENTER CSG
XmNfontList XmCFontList XmFontList "Fixed" CSG
XmNlabelInsensitivePixmap XmCLabelInsensitivePixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNlabelPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNlabelString XmCXmString XmString NULL CSG
XmNlabelType XmCLabelType unsigned char XmSTRING CSG
XmNmarginBottom XmCMarginBottom short 0 CSG
XmNmarginHeight XmCMarginHeight short 2 CSG
XmNmarginLeft XmCMarginLeft short 0 CSG
XmNmarginRight XmCMarginRight short 0 CSG
XmNmarginTop XmCMarginTop short 0 CSG
XmNmarginWidth XmCMarginWidth short 2 CSG
XmNmnemonic XmCMnemonic char ‘\0’ CSG
XmNrecomputeSize XmCRecomputeSize Boolean True CSG
XmNstringDirection XmCStringDirection XmStringDirection XmSTRING_DIRECTION_L_TO_R CSG

XmNaccelerator
Sets the accelerator on a button widget in a menu, which activates a visible or invisible button from the keyboard. This resource is a string which describes a set of modifiers and the key which may be used to select the button. The format of this string is identical to that used by the translations manager, with the exception that only a single event may be specified and only KeyPress events are allowed. 

Accelerators for buttons are supported only for certain buttons in certain menu widgets, namely for PushButton and ToggleButton in Pulldown and Popup MenuPanes. 

XmNacceleratorText
Specifies the text displayed for the accelerator.  The text is displayed to the right of the label string or pixmap.  Accelerator text for buttons is displayed only for PushButtons and ToggleButtons in Pulldown and Popup Menus.

XmNalignment
Specifies the label alignment for text or pixmap.

•XmALIGNMENT_CENTER (center alignment) — causes the centers of the lines of text to be vertically aligned in the center of the widget window.  For a pixmap, its center is vertically aligned with the center of the widget window. 

•XmALIGNMENT_END (right alignment) — causes the right sides of the lines of text to be vertically aligned with the right edge of the widget window.  For a pixmap, its right side is vertically aligned with the right edge of the widget window. 

•XmALIGNMENT_BEGINNING (left alignment) — causes the left sides of the lines of text to be vertically aligned with the left edge of the widget window.  For a pixmap, its left side is vertically aligned with the left edge of the widget window. 

The above descriptions for text are correct when XmNstringDirection is XmSTRING_DIRECTION_L_TO_R.  When that resource is XmSTRING_DIRECTION_R_TO_L, the descriptions for XmALIGNMENT_BEGINNING and XmALIGNMENT_END are switched. 

XmNfontList
Specifies the font of the text used in the widget. Refer to XmFontListCreate(3Xm) for more information on the creation and the structure of a font list. 

XmNlabelInsensitivePixmap
Specifies a pixmap used as the button face if XmNlabelType is XmPIXMAP and the button is insensitive. 

XmNlabelPixmap
Specifies the pixmap when XmNlabelType is XmPIXMAP. 

XmNlabelString
Specifies the compound string when the XmNlabelType is XmSTRING.  Refer to XmStringCreate(3Xm) or XmStringCreateLtoR(3Xm) for more information on the creation and the structure of compound strings. 

XmNlabelType
Specifies the label type.


u

3
XmSTRING — text displays XmNlabelString. 


u

3
XmPIXMAP — icon data in pixmap displays XmNlabelInsensitivePixmap. 

XmNmarginBottom
Specifies the amount of spacing that is to be left, after the bottom margin (XmNmarginHeight) of the widget, before the label is drawn.  This may be modified by Label’s subclasses.  For example, CascadeButton may increase this field to make room for the cascade pixmap. 

XmNmarginHeight
Specifies the amount of blank space  between the bottom edge of the top shadow  and the label, and the top edge of the bottom shadow and the label.

XmNmarginLeft
Specifies the amount of spacing that is to be left, after the left margin (XmNmarginWidth) of the widget, before the label is drawn.  This may be modified by Label’s subclasses.  For example, ToggleButton may increase this field to make room for the toggle indicator and for spacing between the indicator and label. 

XmNmarginRight
Specifies the amount of spacing that is to be left, after the right margin (XmNmarginWidth) of the widget, before the label is drawn.  This may be modified by Label’s subclasses.  For example, CascadeButton may increase this field to make room for the cascade pixmap. 

XmNmarginTop
Specifies the  amount of spacing that is to be left, after the top margin (XmNmarginHeight) of the widget, before the label is drawn.  This may be modified by Label’s subclasses.  For example, CascadeButton may increase this field to make room for the cascade pixmap. 

XmNmarginWidth
Specifies the amount of blank space between the right edge of the left shadow and the label, and the left edge of the right shadow and the label.

XmNmnemonic
Provides the user with alternate means for selecting a button. The buttons must be visible for mnemonics to work. Buttons, which are in either a MenuBar, a Popup MenuPane, or a Pulldown MenuPane, are allowed to have a mnemonic.

This resource contains a single character. The first character in the label string that exactly matches the mnemonic is underlined when the button is displayed. 

When a mnemonic is specified for a MenuBar button, the user activates the mnemonic by pressing the meta key and the specified mnemonic key simultaneously. All other mnemonics are activated by pressing the specified mnemonic. Mnemonics are case insensitive; the character underlined can be a modified key, but the key pressed should always be unmodified. 

XmNrecomputeSize
Specifies a Boolean value that indicates whether or not the widget always attempts to be big enough to contain the label.  If True, an XtSetValues with a new label string or pixmap, accelerator text, margins, font, or label type causes the widget to shrink or expand to exactly fit the new label string or pixmap.  If False, the widget never attempts to change size on its own. 

XmNstringDirection
Specifies the direction in which the string is to be drawn.  The following are the values:

•XmSTRING_DIRECTION_L_TO_R — left to right. 

•XmSTRING_DIRECTION_R_TO_L — right to left. 

Inherited Resources

Label inherits behavior and resources from the following superclasses.  For a complete description of these resources, refer to the man page for that superclass. 

XmPrimitive Resource Set
Name Class Type Default Access
XmNbottomShadowColor XmCForeground Pixel dynamic CSG
XmNbottomShadowPixmap XmCBottomShadowPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNforeground XmCForeground Pixel dynamic CSG
XmNhelpCallback XmCCallback XtCallbackList NULL C
XmNhighlightColor XmCForeground Pixel Black CSG
XmNhighlightOnEnter XmCHighlightOnEnter Boolean False CSG
XmNhighlightPixmap XmCHighlightPixmap Pixmap dynamic CSG
XmNhighlightThickness XmCHighlightThickness short 0 CSG
XmNshadowThickness XmCShadowThickness short 0 CSG
XmNtopShadowColor XmCBackground Pixel dynamic CSG
XmNtopShadowPixmap XmCTopShadowPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNtraversalOn XmCTraversalOn Boolean False CSG
XmNunitType XmCUnitType unsigned char XmPIXELS CSG
XmNuserData XmCUserData caddr_t NULL CSG

Core Resource Set
Name Class Type Default Access
XmNaccelerators XmCAccelerators XtTranslations NULL CSG
XmNancestorSensitive XmCSensitive Boolean True G
XmNbackground XmCBackground Pixel dynamic CSG
XmNbackgroundPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNborderColor XmCBorderColor Pixel Black CSG
XmNborderPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNborderWidth XmCBorderWidth Dimension 0 CSG
XmNcolormap XmCColormap Colormap XtCopyFromParent CG
XmNdepth XmCDepth int XtCopyFromParent CG
XmNdestroyCallback XmCCallback XtCallbackList NULL C
XmNheight XmCHeight Dimension 0 CSG
XmNmappedWhenManaged XmCMappedWhenManaged Boolean True CSG
XmNscreen XmCScreen Pointer XtCopyScreen CG
XmNsensitive XmCSensitive Boolean True CSG
XmNtranslations XmCTranslations XtTranslations NULL CSG
XmNwidth XmCWidth Dimension 0 CSG
XmNx XmCPosition Position 0 CSG
XmNy XmCPosition Position 0 CSG

Callback Information

The following structure is returned with each callback:

typedef struct
{
intreason;
XEvent∗ event;
} XmAnyCallbackStruct;

reasonIndicates why the callback was invoked.  For this callback, reason is set to XmCR_HELP. 

eventPoints to the XEvent that triggered the callback. 

Behavior

Default Translations

<EnterWindow>: Enter()
<LeaveWindow>: Leave()

Keyboard Traversal

For information on keyboard traversal, see the man page for XmPrimitive(3Xm) and its sections on behavior and default translations. 

RELATED INFORMATION

Core(3Xm), XmCreateLabel(3Xm), XmFontListCreate(3Xm), XmPrimitive(3Xm), XmStringCreate(3Xm), and XmStringCreateLtoR(3Xm). 

7th Edition

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