XmCascadeButton(Xm) 6 January 1993 XmCascadeButton(Xm) Name XmCascadeButton - the CascadeButton widget class Syntax #include <Xm/CascadeB.h> Description CascadeButton links two MenuPanes or a MenuBar to a MenuPane. It is used in menu systems and must have a RowColumn parent with its XmNrowColumnType resource set to XmMENUBAR, XmMENUPOPUP or XmMENUPULLDOWN. It is the only widget that can have a Pulldown MenuPane attached to it as a submenu. The submenu is displayed when this widget is activated within a MenuBar, a PopupMenu, or a PulldownMenu. Its visuals can include a label or pixmap and a cascading indicator when it is in a Popup or Pull- down MenuPane; or, it can include only a label or a pixmap when it is in a MenuBar. The default behavior associated with a CascadeButton depends on the type of menu system in which it resides. By default, BSelect controls the behavior of the CascadeButton. In addition, BMenu controls the behavior of the CascadeButton if it resides in a PopupMenu system. The actual mouse button used is determined by its RowColumn parent. A CascadeButton's visuals differ from most other button gadgets. When the button becomes armed, its visuals change from a 2-D to a 3-D look, and it displays the submenu that has been attached to it. If no submenu is attached, it simply changes its visuals. When a CascadeButton within a Pulldown or Popup MenuPane is armed as the result of the user moving the mouse pointer into the widget, it does not immediately display its submenu. Instead, it waits a short amount of time to see if the arming was temporary (that is, the user was simply passing through the widget), or whether the user really wanted the sub- menu posted. This time delay is configurable via XmNmappingDelay. CascadeButton provides a single mechanism for activating the widget from the keyboard. This mechanism is referred to as a keyboard mnemonic. If a mnemonic has been specified for the widget, the user may activate the CascadeButton by simply typing the mnemonic while the CascadeButton is visible. If the CascadeButton is in a MenuBar and the MenuBar does not have the focus, the MAlt modifier must be pressed with the mnemonic. Mnemonics are typically used to interact with a menu via the keyboard interface. If in a Pulldown or Popup MenuPane and there is a submenu attached, the XmNmarginBottom, XmNmarginLeft, XmNmarginRight, and XmNmarginTop resources may enlarge to accommodate XmNcascadePixmap. XmNmarginWidth defaults to 6 if this resource is in a MenuBar; otherwise, it takes Label's default, which is 2. Classes CascadeButton inherits behavior and resources from Core, XmPrimitive, and XmLabel classes. The class pointer is xmCascadeButtonWidgetClass. The class name is XmCascadeButton. New resources The following table defines a set of widget resources used by the pro- grammer to specify data. The programmer can also set the resource values for the inherited classes to set attributes for this widget. To refer- ence 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). XmCascadeButton resource set ____________________________________________________________________________ Name Class Type Default Access ____________________________________________________________________________ XmNactivate- XmCCallback XtCallbackList NULL C Callback XmNcascadePixmap XmCPixmap Pixmap dynamic CSG XmNcascading- XmCCallback XtCallbackList NULL C Callback XmNmappingDelay XmCMappingDelay int 180 ms CSG XmNsubMenuId XmCMenuWidget Widget NULL CSG XmNactivateCallback Specifies the list of callbacks that is called when the user activates the CascadeButton widget, and there is no submenu attached to pop up. The activation occurs by releasing a mouse button or by typing the mnemonic associated with the widget. The specific mouse button depends on information in the RowColumn parent. The reason sent by the callback is XmCRACTIVATE. XmNcascadePixmap Specifies the cascade pixmap displayed on one end of the widget when a CascadeButton is used within a Popup or Pulldown MenuPane and a submenu is attached. The Label class resources XmNmargin- Bottom, XmNmarginLeft, XmNmarginRight, and XmNmarginTop may be modified to ensure that room is left for the cascade pixmap. The default cascade pixmap is an arrow pointing to the side of the menu where the submenu will appear. XmNcascadingCallback Specifies the list of callbacks that is called just prior to the mapping of the submenu associated with CascadeButton. The reason sent by the callback is XmCRCASCADING. XmNmappingDelay Specifies the amount of time, in milliseconds, between when a CascadeButton becomes armed and when it maps its submenu. This delay is used only when the widget is within a Popup or Pulldown MenuPane. The value must not be negative. XmNsubMenuId Specifies the widget ID for the Pulldown MenuPane to be associ- ated with this CascadeButton. The specified MenuPane is dis- played when the CascadeButton becomes armed. The MenuPane must have been created with the appropriate parentage depending on the type of menu used. See XmCreateMenuBar(Xm), XmCreatePulldown- Menu(Xm), and XmCreatePopupMenu(Xm) for more information on the menu systems. Inherited resources CascadeButton inherits behavior and resources from the following superc- lasses. For a complete description of each resource, refer to the man page for that superclass. XmLabel resource set _____________________________________________________________________________ Name Class Type Default Access _____________________________________________________________________________ XmNaccelerator XmCAccelerator String NULL N/A XmNacceleratorText XmCAcceleratorText XmString NULL N/A XmNalignment XmCAlignment unsigned char dynamic CSG XmNfontList XmCFontList XmFontList dynamic CSG XmNlabelInsensitive-XmCLabelInsensitive-Pixmap XmUNSPECIFIED-CSG Pixmap Pixmap _PIXMAP XmNlabelPixmap XmCLabelPixmap Pixmap XmUNSPECIFIED-CSG _PIXMAP XmNlabelString XmCXmString XmString dynamic CSG XmNlabelType XmCLabelType unsigned char XmSTRING CSG XmNmarginBottom XmCMarginBottom Dimension dynamic CSG XmNmarginHeight XmCMarginHeight Dimension 2 CSG XmNmarginLeft XmCMarginLeft Dimension 0 CSG XmNmarginRight XmCMarginRight Dimension dynamic CSG XmNmarginTop XmCMarginTop Dimension dynamic CSG XmNmarginWidth XmCMarginWidth Dimension dynamic CSG XmNmnemonic XmCMnemonic KeySym NULL CSG XmNmnemonicCharSet XmCMnemonicCharSet String XmFONTLIST_- CSG DEFAULT_TAG XmNrecomputeSize XmCRecomputeSize Boolean True CSG XmNstringDirection XmCStringDirection XmStringDirectiondynamic CSG XmPrimitive resource set ____________________________________________________________________________ Name Class Type Default Access ____________________________________________________________________________ XmNbottomShadow- XmCBottomShadow- Pixel dynamic CSG Color Color XmNbottom- XmCBottom- Pixmap XmUNSPECIFIED_- CSG Shadowixmap ShadowPixmap PIXMAP XmNforeground XmCForeground Pixel dynamic CSG XmNhelpCallback XmCCallback XtCallbackList NULL C XmNhighlightColor XmCHighlightColor Pixel dynamic CSG XmNhighlightOn- XmCHighlightOn- Boolean False CSG Enter Enter XmNhighlightPixmap XmCHighlightPixmapPixmap dynamic CSG XmNhighlight- XmCHighlight- Dimension 0 CSG Thickness Thickness XmNnavigationType XmCNavigationType XmNavigationType XmNONE CSG XmNshadowThickness XmCShadowThicknessDimension 2 CSG XmNtopShadowColor XmCTopShadowColor Pixel dynamic CSG XmNtopShadowPixmap XmCTopShadowPixmapPixmap dynamic CSG XmNtraversalOn XmCTraversalOn Boolean dynamic G XmNunitType XmCUnitType unsigned char dynamic CSG XmNuserData XmCUserData XtPointer NULL CSG Core resource set ____________________________________________________________________________ Name Class Type Default Access ____________________________________________________________________________ XmNaccelerators XmCAccelerators XtAccelerators dynamic CSG XmNancestor- XmCSensitive Boolean dynamic G Sensitive XmNbackground XmCBackground Pixel dynamic CSG XmNbackground- XmCPixmap Pixmap XmUNSPECIFIED- CSG Pixmap _PIXMAP XmNborderColor XmCBorderColor Pixel XtDefault- CSG Foreground XmNborderPixmap XmCPixmap Pixmap XmUNSPECIFIED- CSG _PIXMAP 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 XmNinitial- XmCInitial- Boolean True C Resources- Resources- Persistent Persistent XmNmappedWhen- XmCMappedWhen- Boolean True CSG Managed Managed XmNscreen XmCScreen Screen * dynamic CG XmNsensitive XmCSensitive Boolean True CSG XmNtranslations XmCTranslations XtTranslations dynamic CSG XmNwidth XmCWidth Dimension dynamic CSG 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. event Points to the XEvent that triggered the callback or is NULL if this callback was not triggered due to an XEvent. Translations XmCascadeButton includes translations from Primitive. XmCascadeButton includes the menu traversal translations from XmLabel. These transla- tions may not directly correspond to a translation table. Note that altering translations in #override or #augment mode is unde- fined. The translations for a CascadeButton in a MenuBar are listed below. These translations may not directly correspond to a translation table. BSelect Press: MenuBarSelect() BSelect Release: DoSelect() KActivate: KeySelect() KSelect: KeySelect() KHelp: Help() MAny KCancel: CleanupMenuBar() The translations for a CascadeButton in a PullDown or Popup MenuPane are listed below. In a Popup menu system, BMenu also performs the BSelect actions. These translations may not directly correspond to a translation table. BSelect Press: StartDrag() BSelect Release: DoSelect() KActivate: KeySelect() KSelect: KeySelect() KHelp: Help() MAny KCancel: CleanupMenuBar() Action routines The XmCascadeButton action routines are described below: CleanupMenuBar(): In a MenuBar, disarms the CascadeButton and the menu and, when the shell's keyboard focus policy is XmEXPLICT, restores keyboard focus to the widget 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 XmEXPLICT, 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 key- board focus policy is XmEXPLICT, restores keyboard focus to the widget from which the menu was posted. DoSelect(): Calls the callbacks in XmNcascadingCallback, posts the submenu attached to the CascadeButton and enables keyboard traversal within the menu. If the CascadeButton does not have a submenu attached, calls the callbacks in XmNactivateCallback, the Cas- cadeButton is activated and all posted menus in the cascade are unposted. Help(): Unposts all menus in the menu hierarchy and, when the shell's keyboard focus policy is XmEXPLICT, restores keyboard focus to the widget 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. KeySelect(): Calls the callbacks in XmNcascadingCallback, and posts the sub- menu attached to the CascadeButton if keyboard traversal is enabled in the menu. If the CascadeButton does not have a sub- menu attached, calls the callbacks in XmNactivateCallback, the CascadeButton is activated and all posted menus in the cascade are unposted. MenuBarSelect(): Unposts any menus posted by the parent menu. Arms both the Cas- cadeButton and the MenuBar, posts the associated submenu, and enables mouse traversal. If the menu is already active, this event disables keyboard traversal for the menu and returns the menu to mouse traversal mode. StartDrag(): Arms the CascadeButton, posts the associated submenu, and enables mouse traversal. If the menu is already active, this event dis- ables keyboard traversal for the menu and returns the menu to mouse traversal mode. Additional behavior Posting a submenu calls the XmNcascadingCallback callbacks. This widget has the additional behavior described below: <EnterWindow>: If keyboard traversal is enabled does nothing. Otherwise, in a MenuBar that is armed, unposts any MenuPanes associated with another MenuBar entry, arms the CascadeButton, and posts the associated submenu. In other menus, arms the CascadeButton and posts the associated submenu after the delay specified by XmNmappingDelay. <LeaveWindow>: If keyboard traversal is enabled does nothing. Otherwise, in a MenuBar that is armed, disarms the CascadeButton if the submenu associated with the CascadeButton is not currently posted or if there is no submenu associated with the CascadeButton. In other menus, if the pointer moves anywhere except into a sub- menu associated with the CascadeButton, the CascadeButton is disarmed and its submenu is unposted. Virtual bindings The bindings for virtual keys are vendor specific. For information about bindings for virtual buttons and keys, see VirtualBindings(Xm). See also Core(Xm), XmCascadeButtonHighlight(Xm), XmCreateCascadeButton(Xm), XmCreateMenuBar(Xm), XmCreatePulldownMenu(Xm), XmCreatePopupMenu(Xm), XmLabel(Xm), XmPrimitive(Xm) and XmRowColumn(Xm).