XMMENUSHELL(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

πŸ’– XmMenuShell(3) πŸ’–

okay so bestie, meet XmMenuShell β€” the MenuShell widget class. It's a custom OverrideShell widget, and it's literally built to hold Popup or Pulldown menu panes. The vibes? Immaculate. Let's go 🫢


✨ NAME ✨

XmMenuShell β€” The MenuShell widget class πŸ‘‘

🌸 SYNOPSIS 🌸

#include <Xm/MenuShell.h>

πŸ’… DESCRIPTION πŸ’…

The MenuShell widget is a custom OverrideShell widget. An OverrideShell widget bypasses mwm when displaying itself. It is designed specifically to contain Popup or Pulldown menu panes.

Most application writers never encounter this widget if they use the menu-system convenience functions, XmCreatePopupMenu or XmCreatePulldownMenu, to create a Popup or Pulldown menu pane. The convenience functions automatically create a MenuShell widget as the parent of the menu pane. However, if the convenience functions are not used, the application programmer must create the required MenuShell. In this case, it is important to note that the parent of the MenuShell depends on the type of menu system being built.

  • If the MenuShell is for the top-level Popup menu pane, the MenuShell's parent must be the widget from which the Popup menu pane is popped up.
  • If the MenuShell is for a menu pane that is pulled down from a Popup or another Pulldown menu pane, the MenuShell's parent must be the Popup or Pulldown menu pane.
  • If the MenuShell is for a menu pane that is pulled down from a MenuBar, the MenuShell's parent must be the MenuBar.
  • If the MenuShell is for a Pulldown menu pane in an OptionMenu, the MenuShell's parent must be the OptionMenu's parent.

Setting XmNheight, XmNwidth, or XmNborderWidth for either a MenuShell or its child sets that resource to the same value in both the parent and the child. An application should always specify these resources for the child, not the parent.

For the managed child of a MenuShell, regardless of the value of the shell's XmNallowShellResize, setting XmNx or XmNy sets the corresponding resource of the parent but does not change the child's position relative to the parent. XtGetValues for the child's XmNx or XmNy yields the value of the corresponding resource in the parent. The x and y-coordinates of the child's upper left outside corner relative to the parent's upper left inside corner are both 0 (zero) minus the value of XmNborderWidth.

MenuShell uses the XmQTmenuSystem trait and holds the XmQTspecifyRenderTable trait.

πŸŽ€ Classes πŸŽ€

MenuShell inherits behavior, resources, and traits from Core, Composite, Shell, and OverrideShell.

The class pointer is xmMenuShellWidgetClass.

The class name is XmMenuShell.

✨ New Resources ✨

MenuShell overrides the XmNallowShellResize resource in Shell. 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).

πŸ’– XmMenuShell Resource Set πŸ’–

  • XmNbuttonFontList β€” Class: XmCButtonFontList Β· Type: XmFontList Β· Default: dynamic Β· Access: CSG
  • XmNbuttonRenderTable β€” Class: XmCButtonRenderTable Β· Type: XmRenderTable Β· Default: NULL Β· Access: CSG
  • XmNdefaultFontList β€” Class: XmCDefaultFontList Β· Type: XmFontList Β· Default: dynamic Β· Access: CG
  • XmNlabelFontList β€” Class: XmCLabelFontList Β· Type: XmFontList Β· Default: dynamic Β· Access: CSG
  • XmNlabelRenderTable β€” Class: XmCLabelRenderTable Β· Type: XmRenderTable Β· Default: NULL Β· Access: CSG
  • XmNlayoutDirection β€” Class: XmCLayoutDirection Β· Type: XmDirection Β· Default: XmLEFT_TO_RIGHT Β· Access: CG
  • XmNanimate β€” Class: XmCAnimate Β· Type: Boolean Β· Default: False Β· Access: CG

πŸ¦‹ Resource Descriptions πŸ¦‹

  • XmNbuttonFontList β€” Specifies the font list used for button descendants. See the XmNbuttonRenderTable resource.
  • XmNbuttonRenderTable β€” Specifies the render table used for MenuShell's button descendants. If this value is NULL at initialization and if the value of XmNdefaultFontList is not NULL, XmNbuttonRenderTable is initialized to the value of XmNdefaultFontList. If the value of XmNdefaultFontList is NULL, XmNbuttonRenderTable is initialized by looking up the parent hierarchy of the widget for an ancestor that holds the XmQTspecifyRenderTable trait. If such an ancestor is found, XmNbuttonRenderTable is initialized to the XmBUTTON_RENDER_TABLE value of the ancestor widget. If no such ancestor is found, the default is implementation dependent. Refer to XmRenderTable(3) for more information on the creation and structure of a render table.
  • XmNdefaultFontList β€” Specifies a default font list for MenuShell's descendants. This resource is obsolete and exists for compatibility with earlier releases. It has been replaced by XmNbuttonFontList and XmNlabelFontList.
  • XmNlabelFontList β€” Specifies the font list used for label descendants. See the XmNlabelRenderTable resource.
  • XmNlabelRenderTable β€” Specifies the render table used for MenuShell's label descendants (Labels and LabelGadgets). If this value is NULL at initialization and if the value of XmNdefaultFontList is not NULL, XmNlabelRenderTable is initialized to the value of XmNdefaultFontList. If the value of XmNdefaultFontList is NULL, the parent hierarchy of the widget is searched for an ancestor that holds the XmQTspecifyRenderTable trait. If such an ancestor is found, XmNlabelRenderTable is initialized to the XmLABEL_RENDER_TABLE value of the ancestor widget. If no such ancestor is found, the default is implementation dependent. Refer to XmRenderTable(3) for more information on the creation and structure of a render table.
  • XmNlayoutDirection β€” Specifies the direction in which the subwidgets, children of a widget, or other visual components are to be laid out. This policy will apply as the default layout policy for all descendants of this MenuShell.
  • XmNanimate β€” Controls whether menus will post in an animated fashion.

πŸ¦‹ Inherited Resources πŸ¦‹

MenuShell 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 programmer can set the resource values for these 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).

πŸ’… Shell Resource Set πŸ’…

okay bestie, here's the whole Shell resource set, every single one, no skips, no cap. For each one I'm giving you the name, the class, the type, the default, and the access code β€” exactly like the original says, just with way more ✨energy✨.

  • XmNallowShellResize β€” class XmCAllowShellResize, type Boolean, default True, access G. she's permissive and she's defaulting to yes πŸ’š
  • XmNcreatePopupChildProc β€” class XmCCreatePopupChildProc, type XtCreatePopupChildProc, default NULL, access CSG.
  • XmNgeometry β€” class XmCGeometry, type String, default NULL, access CSG. a whole string, and it starts out empty, iconic
  • XmNoverrideRedirect β€” class XmCOverrideRedirect, type Boolean, default True, access CSG. πŸ¦‹
  • XmNpopdownCallback β€” class XmCCallback, type XtCallbackList, default NULL, access C.
  • XmNpopupCallback β€” class XmCCallback, type XtCallbackList, default NULL, access C.
  • XmNsaveUnder β€” class XmCSaveUnder, type Boolean, default True, access CSG. defaults to True, saving that under, we love a prepared queen 🌸
  • XmNvisual β€” class XmCVisual, type Visual *, default CopyFromParent, access CSG. note the literal star in the type, bestie, it's Visual *, do not lose the star ⭐
fr fr, those little access letters (G, CSG, C) are part of the table and I'm keeping them exactly as they came, no edits, no opinions, no guessing πŸ’€

✨ Composite Resource Set ✨

and now the Composite resource set, only three of them, short and sweet, main character energy πŸ‘‘

  • XmNchildren β€” class XmCReadOnly, type WidgetList, default NULL, access G. read-only and giving nothing but a NULL default πŸŽ€
  • XmNinsertPosition β€” class XmCInsertPosition, type XtOrderProc, default NULL, access CSG.
  • XmNnumChildren β€” class XmCReadOnly, type Cardinal, default 0, access G. zero, as in no children yet, we're manifesting 🫢
and yes, XmNchildren and XmNnumChildren are both read-only (G), while XmNinsertPosition is CSG β€” that's literally what the table says, iykyk 🧚

🌈 Core Resource Set 🌈

okay bestie, here's the whole core resource lineup β€” every single one, no skips, I promise πŸ’– Each bullet gives you the resource name, its class, its type, its default, and its access. That's the whole vibe check, five for five, every time.

  • XmNaccelerators β€” class XmCAccelerators, type XtAccelerators, default dynamic, access CSG ✨
  • XmNancestorSensitive β€” class XmCSensitive, type Boolean, default dynamic, access G
  • XmNbackground β€” class XmCBackground, type Pixel, default dynamic, access CSG πŸŽ€
  • XmNbackgroundPixmap β€” class XmCPixmap, type Pixmap, default XmUNSPECIFIED_PIXMAP, access CSG
  • XmNborderColor β€” class XmCBorderColor, type Pixel, default XtDefaultForeground, access CSG
  • XmNborderPixmap β€” class XmCPixmap, type Pixmap, default XmUNSPECIFIED_PIXMAP, access CSG
  • XmNborderWidth β€” class XmCBorderWidth, type Dimension, default 0, access CSG
  • XmNcolormap β€” class XmCColormap, type Colormap, default dynamic, access CG 🌸
  • XmNdepth β€” class XmCDepth, type int, default dynamic, access CG
  • XmNdestroyCallback β€” class XmCCallback, type XtCallbackList, default NULL, access C
  • XmNheight β€” class XmCHeight, type Dimension, default dynamic, access CSG
  • XmNinitialResourcesPersistent β€” class XmCInitialResourcesPersistent, type Boolean, default True, access C πŸ’…
  • XmNmappedWhenManaged β€” class XmCMappedWhenManaged, type Boolean, default True, access CSG
  • XmNscreen β€” class XmCScreen, type Screen *, default dynamic, access CG πŸ¦‹
  • XmNsensitive β€” class XmCSensitive, type Boolean, default True, access CSG
  • XmNtranslations β€” class XmCTranslations, type XtTranslations, default dynamic, 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 ⭐

✨ Translations ✨

The XmMenuShell translations live in the little list right below, and honestly? iconic. πŸ‘‘

So the key names here follow the X standard key event translation table syntax β€” that's the exact format Motif uses to say which widget actions go with which key. If you want the quick-and-dirty overview of how that format works, go peek at VirtualBindings(3). And if you want the whole deep dive, fr fr, the place to be is the X Toolkit Instrinsics Documentation (yes, that spelling, I'm just relaying it bestie, don't come for me 😭).

<BtnDown>:
          ClearTraversal()

<BtnUp>:  MenuShellPopdownDone()

πŸŽ€ Action Routines πŸŽ€

And these are the XmMenuShell action routines β€” the actual moves πŸ’…

  • ClearTraversal() β€” Disables keyboard traversal for the menu, enables mouse traversal, and unposts any menus that were posted by this menu. Basically: keyboard's out, mouse is in, and any menu this one popped up gets taken back down. 🫢
  • MenuShellPopdownDone() β€” Unposts the whole menu hierarchy, and when the shell's keyboard focus policy is XmEXPLICIT, it restores focus right back to the widget that had focus before the menu system was ever entered. So it's giving "rewind, put it back exactly how you found it" energy. πŸ”₯

okay bestie, this one is THE un-post button and it behaves differently depending on where it lives, so pay attention πŸ’…

  • In a top-level Pulldown MenuPane from a MenuBar β€” it unposts the menu, disarms the MenuBar CascadeButton and the MenuBar, and, when the shell's keyboard focus policy is XmEXPLICIT, it restores keyboard focus to the widget that had the focus before the MenuBar was entered. it's giving "put it back exactly how you found it" ✨
  • In other Pulldown MenuPanes β€” this action just unposts the menu. that's it. that's the whole job 🫢
  • In a Popup MenuPane β€” it unposts the menu, and, when the shell's keyboard focus policy is XmEXPLICIT, it restores keyboard focus to the widget from which the menu was posted πŸ”₯

✨ Virtual Bindings ✨

ngl, the bindings for virtual keys are vendor specific β€” so like, don't come for me, every vendor does their own thing πŸ™ˆ

for the deets on bindings for virtual buttons and keys, go read VirtualBindings(3). iconic reference, go look πŸ‘‘


the whole friend group, no cap:


and that's a wrap on the whole page, bestie πŸŽ€ this one's from the XmMenuShell(library call) family β€” that footer is literally the source/version tag, so if you're citing it, that's your receipt πŸ’– go forth and post and unpost those menus like the main character you are βœ¨πŸ‘‘