XmLabel(3X) UNIX System V XmLabel(3X)
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 OSF/Motif Programmer's Guide for more information
on compound strings. The text can be multilingual, 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 side
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.
In a Label XmNtraversalOn and XmNhighlightOnEnter are forced to False
inside Popup MenuPanes, Pulldown MenuPanes, and OptionMenus. Otherwise
these resources default to False.
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
10/89 Page 1
XmLabel(3X) UNIX System V XmLabel(3X)
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 lowercase or uppercase, 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 | dynamic | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNfontList | XmCFontList | XmFontList | dynamic | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNlabelInsensitivePixmap| XmCLabelInsensitivePixmap| Pixmap | XmUNSPECIFIED_PIXMAP| CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNlabelPixmap | XmCLabelPixmap | Pixmap | XmUNSPECIFIED_PIXMAP| CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNlabelString | XmCXmString | XmString | dynamic | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNlabelType | XmCLabelType | unsigned char | XmSTRING | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNmarginBottom | XmCMarginBottom | Dimension | 0 | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNmarginHeight | XmCMarginHeight | Dimension | 2 | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNmarginLeft | XmCMarginLeft | Dimension | 0 | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNmarginRight | XmCMarginRight | Dimension | 0 | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNmarginTop | XmCMarginTop | Dimension | 0 | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNmarginWidth | XmCMarginWidth | Dimension | 2 | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNmnemonic | XmCMnemonic | KeySym | NULL | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNmnemonicCharSet | XmCMnemonicCharSet | String | dynamic | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNrecomputeSize | XmCRecomputeSize | Boolean | True | CSG |
|_________________________|___________________________|___________________|______________________|________|
|XmNstringDirection | XmCStringDirection | XmStringDirection| dynamic | CSG |
|_________________________|___________________________|___________________|______________________|________|
Page 2 10/89
XmLabel(3X) UNIX System V XmLabel(3X)
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 that describes a set of modifiers and the key that 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 PushButton and
ToggleButton in Pulldown and Popup MenuPanes.
XmNacceleratorText
Specifies the text displayed for the accelerator. The text is
displayed to the side 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_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.
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.
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.
If the parent is a RowColumn whose XmNisAligned resource is True,
XmNalignment is forced to the same value as the RowColumn's
XmNentryAlignment if the RowColumn's XmNrowColumnType is
XmWORK_AREA or if the widget is a subclass of XmLabel. Otherwise,
the default is XmALIGNMENT_CENTER.
XmNfontList
Specifies the font of the text used in the widget. If this value
is NULL at initialization, it is initialized by looking up the
parent hierarchy of the widget for an ancestor that is a subclass
of the XmBulletinBoard, VendorShell, or XmMenuShell widget class.
If such an ancestor is found, the font list is initialized to the
10/89 Page 3
XmLabel(3X) UNIX System V XmLabel(3X)
appropriate default font list of the ancestor widget
(XmNdefaultFontList for VendorShell and XmMenuShell,
XmNlabelFontList or XmNbuttonFontList for XmBulletinBoard). Refer
to XmFontList(3X) for more information on the creation and
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.
If this value is NULL, it is initialized by converting the name of
the widget to a compound string. Refer to XmString(3X) for more
information on the creation and structure of compound strings.
XmNlabelType
Specifies the label type.
⊕ XmSTRING - text displays XmNlabelString.
⊕ XmPIXMAP - icon data in pixmap displays XmNlabelPixmap or
XmNlabelInsensitivePixmap.
XmNmarginBottom
Specifies the amount of spacing between the bottom of the label
text and the top of the bottom margin (specified by
XmNmarginHeight). 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 spacing between the top of the label
(specified by XmNmarginTop) and the bottom edge of the top shadow,
and the amount of spacing between the bottom of the label
(specified by XmNmarginBottom) and the top edge of the bottom
shadow.
XmNmarginLeft
Specifies the amount of spacing between the left edge of the label
text and the right side of the left margin (specified by
XmNmarginWidth). 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.
Whether this actually applies to the left or right side of the
label may depend on the value of XmNstringDirection.
Page 4 10/89
XmLabel(3X) UNIX System V XmLabel(3X)
XmNmarginRight
Specifies the amount of spacing between the right edge of the label
text and the left side of the right margin (specified by
XmNmarginWidth). This may be modified by Label's subclasses. For
example, CascadeButton may increase this field to make room for the
cascade pixmap. Whether this actually applies to the left or right
side of the label may depend on the value of XmNstringDirection.
XmNmarginTop
Specifies the amount of spacing between the top of the label text
and the bottom of the top margin (specified by XmNmarginHeight).
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 spacing between the left side of the label
(specified by XmNmarginLeft) and the right edge of the left shadow,
and the amount of spacing between the right side of the label
(specified by XmNmarginRight) and the left edge of the right
shadow.
XmNmnemonic
Provides the user with an alternate means of selecting a button. A
button in a MenuBar, a Popup MenuPane, or a Pulldown MenuPane can
have a mnemonic.
This resource contains a keysym as listed in the X11 keysym table.
The first character in the label string that exactly matches the
mnemonic in the character set specified in XmNmnemonicCharSet is
underlined when the button is displayed.
When a mnemonic has been specified, the user activates the button
by pressing the mnemonic key while the button is visible. If the
button is a CascadeButton in a MenuBar and the MenuBar does not
have the focus, the user must use the MAlt modifier while pressing
the mnemonic. The user can activate the button by pressing either
the shifted or the unshifted mnemonic key.
XmNmnemonicCharSet
Specifies the character set of the mnemonic for the label. The
default is determined dynamically depending on the current language
environment.
10/89 Page 5
XmLabel(3X) UNIX System V XmLabel(3X)
XmNrecomputeSize
Specifies a Boolean value that indicates whether the widget
attempts to be big enough to contain the label. If True, an
XtSetValues with a resource value that would change the size of the
widget causes the widget to shrink or expand to exactly fit the
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
The default for this resource is determined at creation time. If no
value is specified for this resource and the widget's parent is a
manager, the value is inherited from the parent; otherwise, it defaults
to XmSTRING_DIRECTION_L_TO_R.
Inherited Resources
Label inherits behavior and resources from the following superclasses.
For a complete description of each resource, refer to the man page for
that superclass.
__________________________________________________________________________________________________
XmPrimitive Resource Set
__________________________________________________________________________________________________
Name Class Type Default Access
__________________________________________________________________________________________________
__________________________________________________________________________________________________
XmNbottomShadowColor XmCBottomShadowColor Pixel dynamic CSG
__________________________________________________________________________________________________
XmNbottomShadowPixmap XmCBottomShadowPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
__________________________________________________________________________________________________
XmNforeground XmCForeground Pixel dynamic CSG
__________________________________________________________________________________________________
XmNhelpCallback XmCCallback XtCallbackList NULL C
__________________________________________________________________________________________________
XmNhighlightColor XmCHighlightColor Pixel dynamic CSG
__________________________________________________________________________________________________
XmNhighlightOnEnter XmCHighlightOnEnter Boolean False CSG
__________________________________________________________________________________________________
XmNhighlightPixmap XmCHighlightPixmap Pixmap dynamic CSG
__________________________________________________________________________________________________
XmNhighlightThickness XmCHighlightThickness Dimension 0 CSG
__________________________________________________________________________________________________
XmNnavigationType XmCNavigationType XmNavigationType XmNONE G
__________________________________________________________________________________________________
XmNshadowThickness XmCShadowThickness Dimension 0 CSG
Page 6 10/89
XmLabel(3X) UNIX System V XmLabel(3X)
|_____________________|_______________________|__________________|______________________|________|
|XmNtopShadowColor | XmCTopShadowColor | Pixel | dynamic | CSG |
|_____________________|_______________________|__________________|______________________|________|
|XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | dynamic | CSG |
|_____________________|_______________________|__________________|______________________|________|
|XmNtraversalOn | XmCTraversalOn | Boolean | False | CSG |
|_____________________|_______________________|__________________|______________________|________|
|XmNunitType | XmCUnitType | unsigned char | dynamic | CSG |
|_____________________|_______________________|__________________|______________________|________|
|XmNuserData | XmCUserData | Pointer | NULL | CSG |
|_____________________|_______________________|__________________|______________________|________|
________________________________________________________________________________________________________________
Core Resource Set
________________________________________________________________________________________________________________
Name Class Type Default Access
________________________________________________________________________________________________________________
________________________________________________________________________________________________________________
XmNaccelerators XmCAccelerators XtAccelerators dynamic CSG
________________________________________________________________________________________________________________
XmNancestorSensitive XmCSensitive Boolean dynamic G
________________________________________________________________________________________________________________
XmNbackground XmCBackground Pixel dynamic CSG
________________________________________________________________________________________________________________
XmNbackgroundPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
________________________________________________________________________________________________________________
XmNborderColor XmCBorderColor Pixel XtDefaultForeground CSG
________________________________________________________________________________________________________________
XmNborderPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
________________________________________________________________________________________________________________
XmNborderWidth XmCBorderWidth Dimension 0 CSG
________________________________________________________________________________________________________________
XmNcolormap XmCColormap Colormap dynamic CG
________________________________________________________________________________________________________________
XmNdepth XmCDepth int dynamic CG
________________________________________________________________________________________________________________
XmNdestroyCallback XmCCallback XtCallbackList NULL C
________________________________________________________________________________________________________________
XmNheight XmCHeight Dimension dynamic CSG
________________________________________________________________________________________________________________
XmNinitialResourcesPersistent XmCInitialResourcesPersistent Boolean True C
________________________________________________________________________________________________________________
XmNmappedWhenManaged XmCMappedWhenManaged Boolean True CSG
________________________________________________________________________________________________________________
XmNscreen XmCScreen Screen * dynamic CG
________________________________________________________________________________________________________________
XmNsensitive XmCSensitive Boolean True CSG
________________________________________________________________________________________________________________
XmNtranslations XmCTranslations XtTranslations dynamic CSG
________________________________________________________________________________________________________________
XmNwidth XmCWidth Dimension dynamic CSG
________________________________________________________________________________________________________________
10/89 Page 7
XmLabel(3X) UNIX System V XmLabel(3X)
|XmNx | XmCPosition | Position | 0 | CSG |
|_____________________________|_______________________________|________________|______________________|________|
|XmNy | XmCPosition | Position | 0 | CSG |
|_____________________________|_______________________________|________________|______________________|________|
Callback Information
A pointer to the following structure is passed to each callback:
typedef struct
{
int reason;
XEvent * event;
} XmAnyCallbackStruct;
reason Indicates why the callback was invoked. For this callback, reason
is set to XmCR_HELP.
event Points to the XEvent that triggered the callback.
Translations
XmLabel includes translations from Primitive. The XmLabel translations
are listed below. These translations may not directly correspond to a
translation table.
KHelp: Help()
The translations used by subclasses of XmLabel for menu traversal are
listed below. These translations may not directly correspond to a
translation table.
KLeft: MenuTraverseLeft()
KRight: MenuTraverseRight()
KUp: MenuTraverseUp()
KDown: MenuTraverseDown()
MAny KCancel: MenuEscape()
Action Routines
The XmLabel action routines are described below:
Help():
In a Popup or Pulldown MenuPane, unposts all menus in the menu
hierarchy and, when the shell's keyboard focus policy is
XmEXPLICIT, restores keyboard focus to the tab group that had the
focus before the menu system was entered. Calls the callbacks for
XmNhelpCallback if any exist. If there are no help callbacks for
this widget, this action calls the help callbacks for the nearest
ancestor that has them.
Page 8 10/89
XmLabel(3X) UNIX System V XmLabel(3X)
MenuEscape():
In a MenuBar, disarms the CascadeButton and the menu and, when the
shell's keyboard focus policy is XmEXPLICIT, restores keyboard
focus to the tab group that had the focus before the menu was
entered.
In a toplevel Pulldown MenuPane from a MenuBar, unposts the menu,
disarms the MenuBar CascadeButton and the MenuBar, and, when the
shell's keyboard focus policy is XmEXPLICIT, restores keyboard
focus to the tab group that had the focus before the MenuBar was
entered. In other Pulldown MenuPanes, unposts the menu.
In a Popup MenuPane, unposts the menu and, when the shell's
keyboard focus policy is XmEXPLICIT, restores keyboard focus to the
widget from which the menu was posted.
MenuTraverseDown():
In a vertical menu, disarms the current menu entry and arms the
entry just below it in the MenuPane. This action wraps within the
MenuPane.
In a horizontal menu, if the menu entry is a CascadeButton with a
submenu, posts the MenuPane associated with the CascadeButton.
Otherwise, this action searches for an ancestor menu that is
vertical. If it finds one, it unposts the cascade from the
vertical menu and traverses to the next entry toward the bottom in
the vertical menu. If this entry is a CascadeButton with a
submenu, posts the MenuPane associated with the CascadeButton.
This action wraps within the vertical menu.
MenuTraverseLeft():
In a vertical menu, if the menu's parent is a horizontal menu, this
action unposts the current MenuPane and traverses to the next entry
to the left in the parent menu. If this entry is a CascadeButton
with a submenu, posts the MenuPane associated with the
CascadeButton. This action wraps within the horizontal menu. If
the menu's parent is a vertical menu, this action unposts the
current MenuPane.
In a horizontal menu, disarms the current menu entry and arms the
entry just to the left of it in the menu. This action wraps within
the menu.
MenuTraverseRight():
In a vertical menu, if the menu entry is a CascadeButton with a
submenu, posts the MenuPane associated with the CascadeButton.
Otherwise, this action searches for an ancestor menu that is
horizontal. If it finds one, it unposts the cascade from the
horizontal menu and traverses to the next entry to the right in the
horizontal menu. If this entry is a
10/89 Page 9
XmLabel(3X) UNIX System V XmLabel(3X)
CascadeButton with a submenu, posts the MenuPane associated with
the CascadeButton. This action wraps within the horizontal menu.
In a horizontal menu, disarms the current menu entry and arms the
entry just to the right of it in the menu. This action wraps
within the menu.
MenuTraverseUp():
In a vertical menu, disarms the current menu entry and arms the
entry just above it in the MenuPane. This action wraps within the
MenuPane.
In a horizontal menu, if the menu's parent is a vertical menu, this
action unposts the current MenuPane and traverses to the next entry
toward the top in the parent menu. If this entry is a
CascadeButton with a submenu, posts the MenuPane associated with
the CascadeButton. This action wraps within the vertical menu. If
the menu's parent is a horizontal menu, this action unposts the
current MenuPane.
Virtual Bindings
The bindings for virtual keys are vendor specific. For information about
bindings for virtual buttons and keys, see VirtualBindings(3X).
RELATED INFORMATION
Core(3X), XmCreateLabel(3X), XmFontListCreate(3X), XmStringCreate(3X),
XmStringCreateLtoR(3X) and XmPrimitive(3X).
Page 10 10/89