XMCASCADEBUTTONGADGET(3)

πŸ“¦
version 2.5.2 Β· 2 versions
, in alpine 3.24, arch rolling, centos-stream 9, epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

🌸 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_BAR
  • XmMENU_POPUP
  • XmMENU_PULLDOWN
  • XmMENU_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 .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).

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
  • XmNcascadePixmap
    • Class: XmCPixmap
    • Type: Pixmap
    • Default: dynamic
    • Access: CSG
  • XmNcascadingCallback
    • Class: XmCCallback
    • Type: XtCallbackList
    • Default: NULL
    • Access: C
  • XmNmappingDelay
    • Class: XmCMappingDelay
    • Type: int
    • Default: 180 ms
    • Access: CSG
  • XmNsubMenuId
    • Class: XmCMenuWidget
    • Type: Widget
    • Default: NULL
    • Access: CSG

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 β€” class XmCAccelerator, type String, default NULL, access N/A. This is the accelerator string, the little keyboard shortcut moment.
  • XmNacceleratorText β€” class XmCAcceleratorText, type XmString, default NULL, access N/A. The text that gets displayed for the accelerator. cute, right?
  • XmNalignment β€” class XmCAlignment, type unsigned 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 β€” class XmCFontList, type XmFontList, default dynamic, access CSG. The font list, queen. Dynamic default, so it's inheriting from the ancestor situation.
  • XmNlabelInsensitivePixmap β€” class XmCLabelInsensitivePixmap, type Pixmap, default XmUNSPECIFIED_PIXMAP, access CSG. The pixmap shown when the gadget is insensitive. it's giving "I can't right now".
  • XmNlabelPixmap β€” class XmCLabelPixmap, type Pixmap, default XmUNSPECIFIED_PIXMAP, access CSG. The pixmap for when it's just vibing normally.
  • XmNlabelString β€” class XmCXmString, type XmString, default dynamic, access CSG. The actual label text. dynamic default because it comes from the ancestor's XmNlabelString. iconic.
  • XmNlabelType β€” class XmCLabelType, type unsigned char, default XmSTRING, access CSG. Tells everyone whether you're a string girlie or a pixmap girlie.
  • XmNmarginBottom β€” class XmCMarginBottom, type Dimension, default dynamic, access CSG. Bottom margin. dynamic, so it's doing the XmNmarginHeight thing.
  • XmNmarginHeight β€” class XmCMarginHeight, type Dimension, default 2, access CSG. The vertical breathing room between the label and the edges. a solid lil 2. 🫢
  • XmNmarginLeft β€” class XmCMarginLeft, type Dimension, default 0, access CSG. Left margin. zero, bestie, it's cozy.
  • XmNmarginRight β€” class XmCMarginRight, type Dimension, default dynamic, access CSG. Right margin, also dynamic, also doing the XmNmarginWidth thing.
  • XmNmarginTop β€” class XmCMarginTop, type Dimension, default dynamic, access CSG. Top margin. dynamic. you see the pattern.
  • XmNmarginWidth β€” class XmCMarginWidth, type Dimension, default dynamic, access CSG. Horizontal breathing room. dynamic default, comes from the ancestor.
  • XmNmnemonic β€” class XmCMnemonic, type KeySym, default NULL, access CSG. The mnemonic key. that lil keyboard moment when you hit the key and it activates. main character energy.
  • XmNmnemonicCharSet β€” class XmCMnemonicCharSet, type String, default dynamic, access CSG. The character set for the mnemonic. dynamic, so it's derived from the ancestor's charset.
  • XmNrecomputeSize β€” class XmCRecomputeSize, type Boolean, default True, access CSG. Should it recompute its size when things change? True, obviously. we stay flexible. πŸ”₯
  • XmNrenderTable β€” class XmCRenderTable, type XmRenderTable, default dynamic, access CSG. The render table, which is basically the font list's cooler older sibling. dynamic default, inherits from the ancestor.
  • XmNstringDirection β€” class XmCStringDirection, type XmStringDirection, 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: those N/A access values on XmNaccelerator and XmNacceleratorText mean you can't just set them at creation or via XtSetValues like 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 β€” class XmCBackground Β· type Pixel Β· default dynamic Β· access CSG
  • XmNbackgroundPixmap β€” class XmCPixmap Β· type Pixmap Β· default XmUNSPECIFIED_PIXMAP Β· access CSG
  • XmNbottomShadowColor β€” class XmCBottomShadowColor Β· type Pixel Β· default dynamic Β· access CSG
  • XmNbottomShadowPixmap β€” class XmCBottomShadowPixmap Β· type Pixmap Β· default dynamic Β· access CSG
  • XmNhelpCallback β€” class XmCCallback Β· type XtCallbackList Β· default NULL Β· access C
  • XmNforeground β€” class XmCForeground Β· type Pixel Β· default dynamic Β· access CSG
  • XmNhighlightColor β€” class XmCHighlightColor Β· type Pixel Β· default dynamic Β· access CSG
  • XmNhighlightOnEnter β€” class XmCHighlightOnEnter Β· type Boolean Β· default False Β· access CSG
  • XmNhighlightPixmap β€” class XmCHighlightPixmap Β· type Pixmap Β· default dynamic Β· access CSG
  • XmNhighlightThickness β€” class XmCHighlightThickness Β· type Dimension Β· default 0 Β· access CSG
  • XmNlayoutDirection β€” class XmNCLayoutDirection Β· type XmDirection Β· default dynamic Β· access CG
  • XmNnavigationType β€” class XmCNavigationType Β· type XmNavigationType Β· default XmNONE Β· access CSG
  • XmNshadowThickness β€” class XmCShadowThickness Β· type Dimension Β· default 2 Β· access CSG
  • XmNtopShadowColor β€” class XmCTopShadowColor Β· type Pixel Β· default dynamic Β· access CSG
  • XmNtopShadowPixmap β€” class XmCTopShadowPixmap Β· type Pixmap Β· default dynamic Β· access CSG
  • XmNtraversalOn β€” class XmCTraversalOn Β· type Boolean Β· default True Β· access CSG
  • XmNunitType β€” class XmCUnitType Β· type unsigned char Β· default dynamic Β· access CSG
  • XmNuserData β€” class XmCUserData Β· type XtPointer Β· default NULL Β· access CSG
note that XmNlayoutDirection is class XmNCLayoutDirection β€” yes with the extra N, 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 β€” class XmCSensitive Β· type Boolean Β· default dynamic Β· access G
  • XmNborderWidth β€” class XmCBorderWidth Β· type Dimension Β· default 0 Β· access N/A
  • XmNheight β€” class XmCHeight Β· type Dimension Β· default dynamic Β· access CSG
  • XmNsensitive β€” class XmCSensitive Β· type Boolean Β· default True Β· access CSG
  • XmNwidth β€” class XmCWidth Β· type Dimension Β· default dynamic Β· access CSG
  • XmNx β€” class XmCPosition Β· type Position Β· default 0 Β· access CSG
  • XmNy β€” class XmCPosition Β· type Position Β· default 0 Β· access CSG
XmNborderWidth is access N/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 the XEvent that triggered the callback, or it's NULL if this callback wasn't triggered by an XEvent. 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 in XmNcascadingCallback, 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 in XmNactivateCallback, activates the CascadeButtonGadget, and unposts all posted menus in the cascade.
  • <Key><osfActivate> β€” Calls the callbacks in XmNcascadingCallback, 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 in XmNactivateCallback, 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 in XmNcascadingCallback, 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 in XmNactivateCallback, 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 is XmEXPLICIT, 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.
  • <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.
  • <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 by XmNmappingDelay.
  • <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). πŸ¦‹



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. πŸ’…βœ¨