XMCASCADEBUTTONGADGET(3)
πΈ XmCascadeButtonGadget π
okay bestie, gather round, because we're about to talk about XmCascadeButtonGadget β the CascadeButtonGadget widget class β straight out of the library call manual (that's the (3) energy, iykyk). This is the little guy that makes your menus actually connect to each other. main character energy fr fr.
β¨ SYNOPSIS β¨
#include <Xm/CascadeBG.h>
π¦ DESCRIPTION π¦
okay so first things first: CascadeButtonGadget links two menu panes, like a MenuBar to a menu pane, or an OptionMenu to a menu pane. it's the connective tissue, the group chat of your menu system π
it lives in menu systems and it must have a RowColumn parent, and that parent has to have its XmNrowColumnType resource set to one of these four, no exceptions:
XmMENU_BARXmMENU_POPUPXmMENU_PULLDOWNXmMENU_OPTION
ngl it's also the only gadget that can have a Pulldown menu pane attached to it as a submenu π that's its whole thing, that's the moment. The submenu shows up when this gadget gets activated inside a PopupMenu, a PulldownMenu, or an OptionMenu.
its visuals? depends on where it's at:
- in a Popup or Pulldown menu pane: it can have a label or pixmap plus a cascading indicator
- in an OptionMenu: it can have only a label or a pixmap
and where exactly the PulldownMenu sits relative to the CascadeButton? that's decided by the XmNlayoutDirection resource of the MenuShell. cute, right?
the default behavior depends on what kind of menu system it's living in. by default, BSelect controls the behavior of the CascadeButtonGadget. and if it's chillin' in a PopupMenu system, then BMenu also controls its behavior. which actual mouse button that ends up being? that's determined by its RowColumn parent, not by us. also worth knowing: BMenu performs the BSelect actions in all types of menu systems.
now, a CascadeButtonGadget's visuals are lowkey different from most other button gadgets. when the button gets armed, its visuals go from a 2-D to a 3-D look, and it displays the submenu that's attached to it. and if there's no submenu attached? it just changes its visuals. that's it. that's the whole glow-up β¨
here's the part that's giving patience: when a CascadeButtonGadget inside a Pulldown or Popup menu pane gets armed because the user moved the mouse pointer into the gadget, it does not immediately display its submenu. it waits a short time β because maybe the arming was temporary (user was just passing through, being a tourist πΆ), or maybe the user really wanted the submenu posted. that delay is configurable with XmNmappingDelay.
keyboard time. CascadeButtonGadget provides a single mechanism for activating the gadget from the keyboard, and it's called a keyboard mnemonic. if a mnemonic has been specified for the gadget, the user can activate it by simply typing the mnemonic while the CascadeButtonGadget is visible. and if the CascadeButtonGadget is in a MenuBar and the MenuBar does not have focus, then the MAlt modifier must be pressed together with the mnemonic. mnemonics are typically used to interact with a menu using the keyboard. periodt.
okay and this one's a lil niche but so important: if a CascadeButtonGadget is in a Pulldown or Popup menu pane and there's a submenu attached, then the XmNmarginBottom, XmNmarginLeft, XmNmarginRight, and XmNmarginTop resources may enlarge to accommodate XmNcascadePixmap. and XmNmarginWidth? it defaults to 6 if this resource is in a MenuBar; otherwise it takes LabelGadget's default, which is 2. not me memorizing margin numbers π«Ά
lastly: CascadeButtonGadget uses the XmQTmenuSystem and XmQTspecifyRenderTable traits. slay.
π Classes π
CascadeButtonGadget inherits behavior, resources, and traits from the Object, RectObj, XmGadget, and XmLabelGadget classes. generational talent honestly.
- The class pointer is
xmCascadeButtonGadgetClass. - The class name is
XmCascadeButtonGadget.
π New Resources π
so here's the deal β this next bit is a whole set of widget resources that you, the programmer, use to specify data. you can also set the resource values for the inherited classes to set attributes for this widget. and yes, there's a whole naming ritual, so pay attention bestie:
- To reference a resource by name or by class in a
.Xdefaultsfile: remove theXmNorXmCprefix and use the remaining letters. - To specify one of the defined values for a resource in a
.Xdefaultsfile: remove theXmprefix and use the remaining letters (in either lowercase or uppercase, but include any underscores between words).
and the codes in the access column tell you what you're allowed to do with each resource:
- C β can be set at creation time
- S β can be set by using
XtSetValues - G β can be retrieved by using
XtGetValues - N/A β not applicable
heads up, the original page presents these in a table β we're doing it as a list here so it renders cute in your terminal, but every single value is exactly the same π
π The resources, one by one π
XmNactivateCallback- Class:
XmCCallback - Type:
XtCallbackList - Default:
NULL - Access:
C
- Class:
XmNcascadePixmap- Class:
XmCPixmap - Type:
Pixmap - Default:
dynamic - Access:
CSG
- Class:
XmNcascadingCallback- Class:
XmCCallback - Type:
XtCallbackList - Default:
NULL - Access:
C
- Class:
XmNmappingDelay- Class:
XmCMappingDelay - Type:
int - Default:
180 ms - Access:
CSG
- Class:
XmNsubMenuId- Class:
XmCMenuWidget - Type:
Widget - Default:
NULL - Access:
CSG
- Class:
and now the tea on what each of these actually does π
XmNactivateCallback
Specifies the list of callbacks that is called when the user activates the CascadeButtonGadget, and there is no submenu attached to pop up. The activation occurs when a mouse button is released or when the mnemonic associated with the gadget is typed. The specific mouse button depends on information in the RowColumn parent. The reason sent by the callback is XmCR_ACTIVATE.
XmNcascadePixmap
Specifies the cascade pixmap displayed on one end of the gadget when a CascadeButtonGadget is used within a Popup or Pulldown menu pane and a submenu is attached. The LabelGadget class resources XmNmarginBottom, XmNmarginLeft, XmNmarginRight, and XmNmarginTop may be modified to ensure that room is left for the cascade pixmap. The default cascade pixmap in menus other than option menus is an arrow pointing to the side of the menu where the submenu will appear. The default for the CascadeButtonGadget in an option menu is XmUNSPECIFIED_PIXMAP.
The positioning of the cascade pixmap to either the left or right of the widget, and the direction of the arrow, depend on the XmNlayoutDirection resource of the MenuShell. π«
XmNcascadingCallback
Specifies the list of callbacks that is called just prior to the mapping of the submenu associated with the CascadeButtonGadget. The reason sent by the callback is XmCR_CASCADING.
XmNmappingDelay
Specifies the amount of time, in milliseconds, between when a CascadeButtonGadget becomes armed and when it maps its submenu. This delay is used only when the gadget is within a Popup or Pulldown menu pane.
β οΈ the value must not be negative. fr fr, don't do it.
XmNsubMenuId
Specifies the widget ID for the Pulldown menu pane to be associated with this CascadeButtonGadget. The specified menu pane is displayed when the CascadeButtonGadget becomes armed. The menu pane must have been created with the appropriate parentage depending on the type of menu used. See XmCreatePulldownMenu(3), XmCreatePopupMenu(3), and XmCreateOptionMenu(3) for more information on the menu systems.
π§ Inherited Resources π§
CascadeButtonGadget 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.
π (the superclass tables are coming right up in the next part β don't go anywhere bestie, we're not done) π
β¨ XmLabelGadget Resource Set β¨
okay so before we even get to the CascadeButtonGadget's own drama, bestie, you gotta know that XmCascadeButtonGadget inherits a whole entire wardrobe from XmLabelGadget π
. Every single one of these is available on your gadget, and they're giving exactly what they say on the tin. Here's the full roster β name, class, type, default, and access, no skips, no cap:
XmNacceleratorβ classXmCAccelerator, typeString, defaultNULL, access N/A. This is the accelerator string, the little keyboard shortcut moment.XmNacceleratorTextβ classXmCAcceleratorText, typeXmString, defaultNULL, access N/A. The text that gets displayed for the accelerator. cute, right?XmNalignmentβ classXmCAlignment, typeunsigned char, default dynamic, access CSG. Where the label sits. It's dynamic, so it decides based on vibes (and by vibes we mean the other resources).XmNfontListβ classXmCFontList, typeXmFontList, default dynamic, access CSG. The font list, queen. Dynamic default, so it's inheriting from the ancestor situation.XmNlabelInsensitivePixmapβ classXmCLabelInsensitivePixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, access CSG. The pixmap shown when the gadget is insensitive. it's giving "I can't right now".XmNlabelPixmapβ classXmCLabelPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, access CSG. The pixmap for when it's just vibing normally.XmNlabelStringβ classXmCXmString, typeXmString, default dynamic, access CSG. The actual label text. dynamic default because it comes from the ancestor'sXmNlabelString. iconic.XmNlabelTypeβ classXmCLabelType, typeunsigned char, defaultXmSTRING, access CSG. Tells everyone whether you're a string girlie or a pixmap girlie.XmNmarginBottomβ classXmCMarginBottom, typeDimension, default dynamic, access CSG. Bottom margin. dynamic, so it's doing theXmNmarginHeightthing.XmNmarginHeightβ classXmCMarginHeight, typeDimension, default2, access CSG. The vertical breathing room between the label and the edges. a solid lil 2. π«ΆXmNmarginLeftβ classXmCMarginLeft, typeDimension, default0, access CSG. Left margin. zero, bestie, it's cozy.XmNmarginRightβ classXmCMarginRight, typeDimension, default dynamic, access CSG. Right margin, also dynamic, also doing theXmNmarginWidththing.XmNmarginTopβ classXmCMarginTop, typeDimension, default dynamic, access CSG. Top margin. dynamic. you see the pattern.XmNmarginWidthβ classXmCMarginWidth, typeDimension, default dynamic, access CSG. Horizontal breathing room. dynamic default, comes from the ancestor.XmNmnemonicβ classXmCMnemonic, typeKeySym, defaultNULL, access CSG. The mnemonic key. that lil keyboard moment when you hit the key and it activates. main character energy.XmNmnemonicCharSetβ classXmCMnemonicCharSet, typeString, default dynamic, access CSG. The character set for the mnemonic. dynamic, so it's derived from the ancestor's charset.XmNrecomputeSizeβ classXmCRecomputeSize, typeBoolean, defaultTrue, access CSG. Should it recompute its size when things change?True, obviously. we stay flexible. π₯XmNrenderTableβ classXmCRenderTable, typeXmRenderTable, default dynamic, access CSG. The render table, which is basically the font list's cooler older sibling. dynamic default, inherits from the ancestor.XmNstringDirectionβ classXmCStringDirection, typeXmStringDirection, default dynamic, access CSG. Which way the string reads β left-to-right, right-to-left, etc. dynamic default, because it's pulling from the ancestor's direction.
heads up bestie: thoseN/Aaccess values onXmNacceleratorandXmNacceleratorTextmean you can't just set them at creation or viaXtSetValueslike normal. they're special like that. π
and yeah, every "dynamic" default is dynamic for a reason β it's inherited from the ancestor at creation time. don't @ me, that's just how the widget family works. β¨
β¨ XmGadget Resource Set β¨
okay bestie, this is the big one, the whole gadget glow-up menu π every row is a resource you can set on your XmGadget, with its class, its type, its default, and its access code. no skipping, we're doing all of them.
XmNbackgroundβ classXmCBackgroundΒ· typePixelΒ· default dynamic Β· accessCSGXmNbackgroundPixmapβ classXmCPixmapΒ· typePixmapΒ· defaultXmUNSPECIFIED_PIXMAPΒ· accessCSGXmNbottomShadowColorβ classXmCBottomShadowColorΒ· typePixelΒ· default dynamic Β· accessCSGXmNbottomShadowPixmapβ classXmCBottomShadowPixmapΒ· typePixmapΒ· default dynamic Β· accessCSGXmNhelpCallbackβ classXmCCallbackΒ· typeXtCallbackListΒ· defaultNULLΒ· accessCXmNforegroundβ classXmCForegroundΒ· typePixelΒ· default dynamic Β· accessCSGXmNhighlightColorβ classXmCHighlightColorΒ· typePixelΒ· default dynamic Β· accessCSGXmNhighlightOnEnterβ classXmCHighlightOnEnterΒ· typeBooleanΒ· defaultFalseΒ· accessCSGXmNhighlightPixmapβ classXmCHighlightPixmapΒ· typePixmapΒ· default dynamic Β· accessCSGXmNhighlightThicknessβ classXmCHighlightThicknessΒ· typeDimensionΒ· default0Β· accessCSGXmNlayoutDirectionβ classXmNCLayoutDirectionΒ· typeXmDirectionΒ· default dynamic Β· accessCGXmNnavigationTypeβ classXmCNavigationTypeΒ· typeXmNavigationTypeΒ· defaultXmNONEΒ· accessCSGXmNshadowThicknessβ classXmCShadowThicknessΒ· typeDimensionΒ· default2Β· accessCSGXmNtopShadowColorβ classXmCTopShadowColorΒ· typePixelΒ· default dynamic Β· accessCSGXmNtopShadowPixmapβ classXmCTopShadowPixmapΒ· typePixmapΒ· default dynamic Β· accessCSGXmNtraversalOnβ classXmCTraversalOnΒ· typeBooleanΒ· defaultTrueΒ· accessCSGXmNunitTypeβ classXmCUnitTypeΒ· typeunsigned charΒ· default dynamic Β· accessCSGXmNuserDataβ classXmCUserDataΒ· typeXtPointerΒ· defaultNULLΒ· accessCSG
note thatXmNlayoutDirectionis classXmNCLayoutDirectionβ yes with the extraN, that's not a typo, that's just how it is, we don't make the rules π
πΈ RectObj Resource Set πΈ
and these ones come down from RectObj, the ancestral icon, the blueprint of blueprints β¨ every gadget inherits this energy.
XmNancestorSensitiveβ classXmCSensitiveΒ· typeBooleanΒ· default dynamic Β· accessGXmNborderWidthβ classXmCBorderWidthΒ· typeDimensionΒ· default0Β· accessN/AXmNheightβ classXmCHeightΒ· typeDimensionΒ· default dynamic Β· accessCSGXmNsensitiveβ classXmCSensitiveΒ· typeBooleanΒ· defaultTrueΒ· accessCSGXmNwidthβ classXmCWidthΒ· typeDimensionΒ· default dynamic Β· accessCSGXmNxβ classXmCPositionΒ· typePositionΒ· default0Β· accessCSGXmNyβ classXmCPositionΒ· typePositionΒ· default0Β· accessCSG
XmNborderWidthis accessN/Aβ not settable, not gettable, not the moment. it's just not that girl for direct access π
π¦ Object Resource Set π¦
okay so here's the resource table row that belongs to this set:
XmNdestroyCallbackβ Class:XmCCallback; Type:XtCallbackList; Default:NULL; Access:C
π Callback Information π
When a callback fires, it gets a pointer to this struct, bestie:
typedef struct
{
int reason;
XEvent * event;
} XmAnyCallbackStruct;
reasonβ tells you why the callback was invoked. πeventβ points to theXEventthat triggered the callback, or it'sNULLif this callback wasn't triggered by anXEvent. periodt.
π₯ Behavior π₯
XmCascadeButtonGadget includes behavior from XmGadget. XmCascadeButton includes the menu traversal behavior from XmLabel. Additional XmCascadeButtonGadget behavior is described in the following list (in a Popup menu system, <Btn3> also performs the <Btn1> actions). π
<Btn1Down>β Unposts any menus posted by the parent menu. Arms the CascadeButtonGadget, posts the associated submenu, enables mouse traversal, and, in a MenuBar, arms the MenuBar. If the menu is already active, this event disables keyboard traversal for the menu and returns the menu to mouse traversal mode.<Btn1Up>β Calls the callbacks inXmNcascadingCallback, posts the submenu attached to the CascadeButtonGadget and enables keyboard traversal within the menu. If the CascadeButtonGadget does not have a submenu attached, this action calls the callbacks inXmNactivateCallback, activates the CascadeButtonGadget, and unposts all posted menus in the cascade.<Key><osfActivate>β Calls the callbacks inXmNcascadingCallback, and posts the submenu attached to the CascadeButtonGadget if keyboard traversal is enabled in the menu. If the CascadeButtonGadget does not have a submenu attached, this action calls the callbacks inXmNactivateCallback, activates the CascadeButtonGadget, and unposts all posted menus in the cascade. This action applies only to gadgets in MenuBars, PulldownMenus, and PopupMenus. For a CascadeButtonGadget in an OptionMenu, if the parent is a manager, this action passes the event to the parent.<Key><osfSelect>β Calls the callbacks inXmNcascadingCallback, and posts the submenu attached to the CascadeButtonGadget if keyboard traversal is enabled in the menu. If the CascadeButtonGadget does not have a submenu attached, this action calls the callbacks inXmNactivateCallback, activates the CascadeButtonGadget, and unposts all posted menus in the cascade.<Key><osfHelp>β Unposts all menus in the menu hierarchy and, when the shell's keyboard focus policy isXmEXPLICIT, restores keyboard focus to the widget that had the focus before the menu system was entered. Calls the callbacks forXmNhelpCallbackif any exist. If there are no help callbacks for this widget, this action calls the help callbacks for the nearest ancestor that has them.<Key><osfCancel>β- In a MenuBar, disarms the CascadeButtonGadget and the menu and, when the shell's keyboard focus policy is
XmEXPLICIT, restores keyboard focus to the widget that had the focus before the menu was entered. For a CascadeButtonGadget in an OptionMenu, if the parent is a manager, this action passes the event to the parent. - 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 restores keyboard focus to the widget from which the menu was posted.
- In a MenuBar, disarms the CascadeButtonGadget and the menu and, when the shell's keyboard focus policy is
<Enter>β If keyboard traversal is enabled does nothing. Otherwise, in a MenuBar, unposts any MenuPanes associated with another MenuBar entry, arms the CascadeButtonGadget, and posts the associated submenu. In other menus, arms the CascadeButtonGadget and posts the associated submenu after the delay specified byXmNmappingDelay.<Leave>β If keyboard traversal is enabled does nothing. Otherwise, in a MenuBar, disarms the CascadeButtonGadget if the submenu associated with the CascadeButtonGadget is not currently posted or if there is no submenu associated with the CascadeButtonGadget.- In other menus, if the pointer moves anywhere except into a submenu associated with the CascadeButtonGadget, the CascadeButtonGadget 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(3). π¦
π RELATED π
Object(3)RectObj(3)XmCascadeButtonHighlight(3)XmCreateCascadeButtonGadget(3)XmCreatePulldownMenu(3)XmCreatePopupMenu(3)XmCreateOptionMenu(3)XmGadget(3)XmLabelGadget(3)XmRowColumn(3)XmVaCreateCascadeButtonGadget(3)XmVaCreateManagedCascadeButtonGadget(3)
and that's the whole manual page, bestie! π«Ά the footer says it's the XmCascadeButtonGadget(library call) β no date/version in the snippet, just that library-call energy. slay. π
β¨
π¦ where this page comes from
- alpine 3.24: motif-doc 2.5.2-r0 Β· LGPL-2.1-or-later
- arch rolling: openmotif 2.3.8-4 Β· LGPL-2.1-or-later
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- epel 10: motif-devel 2.3.8-2.el10_2 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- nixos 26.05: motif 2.3.8
- nixpkgs unstable: motif 2.3.8
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms