The LabelGadget widget class
Format
#include <Xm/LabelG.h>
DESCRIPTION
LabelGadget is an instantiable widget and is also used as a superclass for other button gadgets, such as PushButtonGadget and ToggleButtonGadget.
LabelGadget can contain either text or a pixmap. LabelGadget text is a compound string. Refer to the Motif Programmer's Guide for more information on compound strings. The text can be multilingual, multiline, and/or multifont. When a LabelGadget is insensitive, its text is stippled, or the user-supplied insensitive pixmap is displayed.
LabelGadget supports both accelerators and mnemonics primarily for use in LabelGadget 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 LabelGadget displays the mnemonic by underlining the first matching character in the text string. The accelerator is displayed as a text string adjacent to the label text or pixmap, depending on the layout direction.
LabelGadget consists of many margin fields surrounding the text or pixmap. These margin fields are resources that may be set by the user, but LabelGadget subclasses and Manager parents also modify some of these fields. They tend to modify the XmNmarginLeft, XmNmarginRight, XmNmarginTop, and XmNmarginBottom resources and leave the XmNmarginWidth and XmNmarginHeight resources as set by the application.
LabelGadget takes into account XmNshadowThickness in determining its layout but does not draw the shadow. That is, if XmNshadowThickness is greater than 0 (zero), LabelGadget leaves space for the shadow, but the shadow does not appear.
In a LabelGadget, XmNtraversalOn and XmNhighlightOnEnter are forced to False inside Popup menu panes, Pulldown menu panes, and OptionMenus. Otherwise these resources default to False.
LabelGadget uses the XmQTmenuSystem and XmQTspecifyRenderTable traits, and holds the XmQTaccessTextual, XmQTcareParentVisual, XmQTmenuSavvy, and XmQTtransfer traits.
LabelGadget and it subclasses, except when used in a menu system, support dragging of the label contents from the LabelGadget. However, the label contents are draggable only if the XmNenableUnselectableDrag resource of XmDisplay is set to True.
As a source of data, LabelGadget and its subclasses support the following targets and associated conversions of data to these targets:
When XmNlabelType is XmPIXMAP, the targets include PIXMAP.
As a source of data, LabelGadget also supports the following standard Motif targets:
LabelGadget inherits behavior, resources, and traits from Object, RectObj and XmGadget.
The class pointer is xmLabelGadgetClass.
The class name is XmLabelGadget.
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 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).
XmLabelGadget 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 |
XmNrenderTable | XmCRenderTable | XmRenderTable | dynamic | CSG |
XmNstringDirection | XmCStringDirection | XmStringDirection | dynamic | CSG |
Accelerators for buttons are supported only for PushButtonGadgets and ToggleButtonGadgets in Pulldown and Popup menus.
The preceding descriptions for text are correct when XmNlayoutDirection is XmLEFT_TO_RIGHT. When that resource is XmRIGHT_TO_LEFT, 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 gadget is a subclass of XmLabelGadget. Otherwise, the default is XmALIGNMENT_CENTER.
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 CascadeButtonGadget 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.
LabelGadget inherits behavior and resources from the superclasses described in the following tables. For a complete description of each resource, refer to the reference page for that superclass.
XmGadget Resource Set | ||||
Name | Class | Type | Default | Access |
XmNbackground | XmCBackground | Pixel | dynamic | CSG |
XmNbackgroundPixmap | XmCPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
XmNbottomShadowColor | XmCBottomShadowColor | Pixel | dynamic | CSG |
XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap | dynamic | CSG |
XmNhelpCallback | XmCCallback | XtCallbackList | NULL | C |
XmNforeground | XmCForeground | Pixel | dynamic | CSG |
XmNhighlightColor | XmCHighlightColor | Pixel | dynamic | CSG |
XmNhighlightOnEnter | XmCHighlightOnEnter | Boolean | False | CSG |
XmNhighlightPixmap | XmCHighlightPixmap | Pixmap | dynamic | CSG |
XmNhighlightThickness | XmCHighlightThickness | Dimension | 0 | CSG |
XmNlayoutDirection | XmNCLayoutDirection | XmDirection | dynamic | CG |
XmNnavigationType | XmCNavigationType | XmNavigationType | XmNONE | CSG |
XmNshadowThickness | XmCShadowThickness | Dimension | 0 | CSG |
XmNtopShadowColor | XmCTopShadowColor | Pixel | dynamic | CSG |
XmNtopShadowPixmap | XmCTopShadowPixmap | Pixmap | dynamic | CSG |
XmNtraversalOn | XmCTraversalOn | Boolean | False | CSG |
XmNunitType | XmCUnitType | unsigned char | dynamic | CSG |
XmNuserData | XmCUserData | XtPointer | NULL | CSG |
RectObj Resource Set | ||||
Name | Class | Type | Default | Access |
XmNancestorSensitive | XmCSensitive | Boolean | dynamic | G |
XmNborderWidth | XmCBorderWidth | Dimension | 0 | N/A |
XmNheight | XmCHeight | Dimension | dynamic | CSG |
XmNsensitive | XmCSensitive | Boolean | True | CSG |
XmNwidth | XmCWidth | Dimension | dynamic | CSG |
XmNx | XmCPosition | Position | 0 | CSG |
XmNy | XmCPosition | Position | 0 | CSG |
Object Resource Set | ||||
Name | Class | Type | Default | Access |
XmNdestroyCallback | XmCCallback | XtCallbackList | NULL | C |
XmLabelGadget includes behavior from XmGadget. Additional XmLabelGadget behavior is described in the following list:
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 widget 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.
If the current menu item is in a MenuPane, then this action disarms the current menu item and arms the item below it. This action wraps within the MenuPane. The direction of the wrapping depends on the XmNlayoutDirection resource.
In MenuPanes, if the current menu item is not at the left edge of a MenuPane, this action disarms the current item and arms the item to its left. If the current menu item is at the left edge of a submenu attached to a MenuBar item, then this action unposts the submenu and traverses to the MenuBar item to the left, wrapping if necessary. If that MenuBar item has a submenu, it posts the submenu and arms the first traversable item in the submenu. If the current menu item is at the left edge of a submenu not directly attached to a MenuBar item, then this action unposts the current submenu only.
In Popup or Torn-off MenuPanes, when the current menu item is at the left edge, this action wraps within the MenuPane. If the current menu item is at the left edge of the MenuPane and not in the top row, this action wraps to the rightmost menu item in the row above. If the current menu item is in the upper, leftmost corner, this action wraps to the tear-off control, if present, or else it wraps to the bottom, rightmost menu item in the MenuPane. The preceding description applies when the XmNlayoutDirection horizontal direction is XmLEFT_TO_RIGHT. If the XmNlayoutDirection horizontal direction is XmRIGHT_TO_LEFT, then the following applies.
If the current menu item is in a MenuBar, then this action disarms the current item and arms the MenuBar item to the left. This action wraps within the MenuBar.
In MenuPanes, if the current menu item is a CascadeButton, then this action posts its associated submenu. If the current menu item is not a CascadeButton and is not at the left edge of a MenuPane, this action disarms the current item and arms the item to its left, wrapping if necessary. If the current menu item is not a CascadeButton and is at the left edge of a submenu that is a descendent of a MenuBar, then this action unposts all submenus and traverses to the MenuBar item to the left. If that MenuBar item has a submenu, it posts the submenu and arms the submenu's first traversable item.
In Popup or Torn-off menus, if the current menu item is not a CascadeButton and is at the left edge of a row (except the bottom row), this action wraps to the rightmost menu item in the row below. If the current menu item is not a CascadeButton and is in the bottom, leftmost corner of a Popup or Pulldown MenuPane, this action wraps to the tear-off control, if present, or else it wraps to the top, rightmost menu item of the MenuPane.
In MenuPanes, if the current menu item is a CascadeButton, then this action posts its associated submenu. If the current menu item is not a CascadeButton and is not at the right edge of a MenuPane, this action disarms the current item and arms the item to its right, wrapping if necessary. If the current menu item is not a CascadeButton and is at the right edge of a submenu that is a descendent of a MenuBar, then this action unposts all submenus and traverses to the MenuBar item to the right. If that MenuBar item has a submenu, it posts the submenu and arms the submenu's first traversable item.
In Popup or Torn-off menus, if the current menu item is not a CascadeButton and is at the right edge of a row (except the bottom row), this action wraps to the leftmost menu item in the row below. If the current menu item is not a CascadeButton and is in the bottom, rightmost corner of a Popup or Pulldown MenuPane, this action wraps to the tear-off control, if present, or else it wraps to the top, leftmost menu item of the MenuPane. The preceding description applies when the XmNlayoutDirection horizontal direction is XmLEFT_TO_RIGHT. If the XmNlayoutDirection horizontal direction is XmRIGHT_TO_LEFT, then the following applies.
When the current menu item is in a MenuBar, then this action disarms the current item and arms the MenuBar item to the right. This action wraps within the MenuBar.
In MenuPanes, if the current menu item is not at the right edge of a MenuPane, this action disarms the current item and arms the item to its right. If the current menu item is at the right edge of a submenu attached to a MenuBar item, then this action unposts the submenu and traverses to the MenuBar item to the right, wrapping if necessary. If that MenuBar item has a submenu, it posts the submenu and arms the first traversable item in the submenu. If the current menu item is at the right edge of a submenu not directly attached to a MenuBar item, then this action unposts the current submenu only.
In Popup or Torn-off MenuPanes, when the current menu item is at the right edge, this action wraps within the MenuPane. If the current menu item is at the right edge of the MenuPane and not in the top row, this action wraps to the leftmost menu item in the row above. If the current menu item is in the upper, rightmost corner, this action wraps to the tear-off control, if present, or else it wraps to the bottom, leftmost menu item in the MenuPane.
The bindings for virtual keys are vendor specific. For information about bindings for virtual buttons and keys, see VirtualBindings (3).
RELATED
Object (3), RectObj (3), XmCreateLabelGadget (3), XmFontListCreate (3), XmStringCreate (3), XmStringCreateLtoR (3), and XmGadget (3).