Name

ExmMenuButton — The MenuButton widget class demonstration widget

Synopsis

#include <Exm/MenuB.h>

DESCRIPTION

ExmMenuButton is a demonstration widget. OSF provides this widget solely to teach programmers how to write their own Motif widgets. OSF does not support this widget in any way.

The source code for the ExmMenuButton widget illustrates how to do the following:

  • Create a menu child widget

  • Install the XmQTmenuSavvy trait

  • Call some of the trait methods of XmQTmenuSystem

ExmMenuButton is similar to the standard Motif toolkit widget XmPushButton. The primary difference is that XmPushButton supports a richer set of actions and callbacks than ExmMenuButton. ExmMenuButton illustrates only the essentials of creating a menu button.

ExmMenuButton is an instantiable widget. ExmMenuButton expects XmRowColumn to be its parent.

ExmMenuButton is a subclass of the ExmString widget. Therefore, ExmMenuButton inherits all of ExmString's resources for rendering compound strings.

When a user activates an ExmMenuButton widget, the widget calls the callback procedure associated with the XmNactivateCallback resource.

Classes

ExmMenuButton inherits behavior and resources from Core, XmPrimitive, ExmSimple, and ExmString.

The class pointer is exmMenuButtonWidgetClass.

The class name is ExmMenuButton.

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, ExmN, XmC or ExmC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm or Exm 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).

ExmMenuButton Resource Set
NameClassTypeDefaultAccess
XmNacceleratorXmCAcceleratorStringNULLCSG
XmNaccleratorTextXmCAcceleratorTextXmStringNULLCSG
XmNactivateCallbackXmCCallbackXtCallbackList CSG
XmNmnemonicXmCMnemonicKeySymXK_VoidSymbolCSG
XmNmnemonicCharSetXmCMnemonicCharSetXmStringCharSetXmFONTLIST_DEFAULT_TAGCSG

XmNaccelerator 

Sets the accelerator on a MenuButton widget in a menu, which activates a visible or invisible, but managed, 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 MenuButtons are supported only in Pulldown and Popup MenuPanes.

XmNacceleratorText 

Specifies the text displayed for the accelerator. The text is displayed adjacent to the label string or pixmap. The direction of its layout depends on the XmNlayoutDirection resource of the widget. Accelerator text for buttons is displayed only for MenuButtons in Pulldown and Popup Menus.

XmNactivateCallback 

Specifies the list of callbacks that is called when MenuButton is activated. MenuButton is activated when the user presses and releases the active mouse button while the pointer is inside that widget. Activating the MenuButton also disarms it. For this callback, the reason is XmCR_ACTIVATE.

XmNmnemonic 

Provides the user with an alternate means of activating a button. A MenuButton 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. 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 XmFONTLIST_DEFAULT_TAG.

Inherited Resources

MenuButton inherits behavior and resources from the following superclasses. For a complete description of each resource, refer to the reference page for that superclass.

ExmString Resource Set
NameClassTypeDefaultAccess
ExmNcompoundStringExmCCompoundStringXmStringNULLCSG
XmNalignmentXmCAlignmentunsigned charXmALIGNMENT_BEGINNINGCSG
XmNrecomputeSizeXmCRecomputeSizeBooleanTrueCSG
XmNrenderTableXmCRenderTableXmRenderTabledynamicCSG

ExmSimple Resource Set
NameClassTypeDefaultAccess
ExmNsimpleShapeExmCSimpleShapeunsigned charExmSHAPE_OVALCSG
XmNmarginHeightXmCMarginHeightDimension4CSG
XmNmarginWidthXmCMarginWidthDimension4CSG

XmPrimitive Resource Set
NameClassTypeDefaultAccess
XmNbottomShadowColorXmCBottomShadowColorPixeldynamicCSG
XmNbottomShadowPixmapXmCBottomShadowPixmapPixmapXmUNSPECIFIED_PIXMAPCSG
XmNconvertCallbackXmCCallbackXtCallbackListNULLC
XmNforegroundXmCForegroundPixeldynamicCSG
XmNhelpCallbackXmCCallbackXtCallbackListNULLC
XmNhighlightColorXmCHighlightColorPixeldynamicCSG
XmNhighlightOnEnterXmCHighlightOnEnterBooleanFalseCSG
XmNhighlightPixmapXmCHighlightPixmapPixmapdynamicCSG
XmNhighlightThicknessXmCHighlightThicknessDimension0CSG
XmNlayoutDirectionXmCLayoutDirectionXmDirectiondynamicCG
XmNnavigationTypeXmCNavigationTypeXmNavigationTypeXmNONECSG
XmNpopupHandlerCallbackXmCCallbackXtCallbackListNULLC
XmNshadowThicknessXmCShadowThicknessDimension2CSG
XmNtopShadowColorXmCTopShadowColorPixeldynamicCSG
XmNtopShadowPixmapXmCTopShadowPixmapPixmapdynamicCSG
XmNtraversalOnXmCTraversalOnBooleanTrueCSG
XmNunitTypeXmCUnitTypeunsigned chardynamicCSG
XmNuserDataXmCUserDataXtPointerNULLCSG

Core Resource Set
NameClassTypeDefaultAccess
XmNacceleratorsXmCAcceleratorsXtAcceleratorsdynamicCSG
XmNancestorSensitiveXmCSensitiveBooleandynamicG
XmNbackgroundXmCBackgroundPixeldynamicCSG
XmNbackgroundPixmapXmCPixmapPixmapXmUNSPECIFIED_PIXMAPCSG
XmNborderColorXmCBorderColorPixelXtDefaultForegroundCSG
XmNborderPixmapXmCPixmapPixmapXmUNSPECIFIED_PIXMAPCSG
XmNborderWidthXmCBorderWidthDimension0CSG
XmNcolormapXmCColormapColormapdynamicCG
XmNdepthXmCDepthintdynamicCG
XmNdestroyCallbackXmCCallbackXtCallbackListNULLC
XmNheightXmCHeightDimensiondynamicCSG
XmNinitialResourcesPersistentXmCInitialResourcesPersistentBooleanTrueC
XmNmappedWhenManagedXmCMappedWhenManagedBooleanTrueCSG
XmNscreenXmCScreenScreen *dynamicCG
XmNsensitiveXmCSensitiveBooleanTrueCSG
XmNtranslationsXmCTranslationsXtTranslationsdynamicCSG
XmNwidthXmCWidthDimensiondynamicCSG
XmNxXmCPositionPosition0CSG
XmNyXmCPositionPosition0CSG

ExmMenuButton provides the following translations:

EnterWindow: 

MenuButtonEnter()

LeaveWindow: 

MenuButtonLeave()

BtnDown: 

BtnDown()

BtnUp: 

BtnUp()

:osfActivate: 

ArmAndActivate()

:osfCancel: 

MenuEscape()

:osfHelp: 

MenuButtonHelp()

~s ~m ~a <Key>Return: 

ArmAndActivate()

~s ~m ~a <Key>space: 

ArmAndActivate()

In addition, ExmMenuButton provides the following traversal translations:

Unmap: 

Unmap()

FocusOut: 

FocusOut()

FocusIn: 

FocusIn()

osfCancel: 

MenuEscape()

osfLeft: 

MenuTraverseLeft()

osfRight: 

MenuTraverseRight()

osfUp: 

MenuTraverseUp()

osfDown: 

MenuTraverseDown()

Action Routines

The ExmMenuButton action routines are

ArmAndActivate(): 

Unposts all menus in the menu hierarchy and, unless the button is already armed, calls the XmNactivateCallback callbacks.

BtnDown(): 

This action unposts any menus posted by the MenuButton's parent menu, disables keyboard traversal for the menu, and enables mouse traversal for the menu. It draws the shadow in the armed state.

BtnUp(): 

This action unposts all menus in the menu hierarchy and activates the MenuButton. It calls the XmNactivateCallback callbacks.

MenuButtonEnter: 

If keyboard traversal is enabled, this action does nothing. Otherwise, it draws the shadow in the armed state and calls the XmNarmCallback callbacks.

MenuButtonHelp(): 

In a Pulldown or Popup MenuPane, unposts all menus in the menu hierarchy and, when the shell's keyboard focus policy is XmEXPLICIT, restores keyboard focus to the widget that had the focus before the menu system was entered. This action 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.

MenuButtonLeave: 

If keyboard traversal is enabled, this action does nothing. Otherwise, it draws the shadow in the unarmed state and calls the XmNdisarmCallback callbacks.

The following actions are handled by the XmRowColumn widget:

  • MenuEscape

  • MenuTraverseDown

  • MenuTraverseLeft

  • MenuTraverseRight

  • MenuTraverseUp

Virtual Bindings

The bindings for virtual keys are vendor specific. For information about bindings for virtual buttons and keys, see VirtualBindings(3).

RELATED

Core(3), ExmSimple(3), ExmString(3), and XmPrimitive(3).