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

πŸ’… XmGadget β€” the library call page, but make it make sense πŸ’…

okay bestie, buckle up, because we're reading the XmGadget(library call) manual page together and honestly? it's lowkey iconic. grab a strawberry πŸ“ and let's go.


✨ NAME ✨

XmGadget β€” the Gadget widget class. that's it, that's the name, she's simple and she knows it πŸ’–


✨ SYNOPSIS ✨

#include <Xm/Xm.h>

literally just that. one include. she's not complicated πŸŽ€


✨ DESCRIPTION ✨

so Gadget is a widget class, right, and her whole job is being a supporting superclass for other gadget classes. main character energy but like, supportive main character energy 🫢

the way she handles things:

  • shadow-border drawing and highlighting (the drama, the glow ✨)
  • traversal activation and deactivation
  • and all the various callback lists that gadgets need

no cap, that's the whole gig.

and here's a thing that matters: the color and pixmap resources defined by XmManager are directly used by gadgets. so if you use XtSetValues to change one of those resources on a manager widget, literally all of the gadget children inside that manager change too. all of them. every single one. the whole friend group matches outfits, i don't make the rules πŸ’…


🌈 Classes 🌈

Gadget inherits behavior and resources from Object and RectObj. family tree stays winning πŸ’œ

  • the class pointer is xmGadgetClass
  • the class name is XmGadget

πŸŽ€ New Resources πŸŽ€

here's the part everyone skips and then cries about later, so let's NOT skip it bestie.

these widget resources are how you, the programmer, specify data. you can also set resource values for the inherited classes to set attributes for this widget, so go off πŸ‘‘

quick translation guide for your .Xdefaults file:

  • to reference a resource by name or by class, drop the XmN or XmC prefix and use the letters that are left.
  • to specify one of the defined values for a resource, drop the Xm prefix and use the remaining letters β€” lowercase or uppercase, doesn't matter, but keep any underscores between words.
  • the codes in the access column mean: C = can be set at creation time, S = set by using XtSetValues, G = retrieved by using XtGetValues, N/A = not applicable.

and now, the resource set, in all her glory:

πŸ’– XmGadget Resource Set πŸ’–

  • 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: 2, 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
  • XmNtoolTipString β€” Class: XmCToolTipString, Type: XmString, Default: NULL, Access: CSG

πŸ”₯ what each one actually does πŸ”₯

  • XmNbackground β€” specifies the background color for the gadget. the vibe of the whole thing, basically 🌸
  • XmNbackgroundPixmap β€” specifies a pixmap for tiling the background. important detail: the first tile is placed at the upper left corner of the widget's window. not the middle, not wherever, upper left. periodt ✨
  • XmNbottomShadowColor β€” contains the color to use to draw the bottom and right sides of the border shadow. so the shadow gets a little two-tone moment πŸŽ€
  • XmNbottomShadowPixmap β€” specifies the pixmap to use to draw the bottom and right sides of the border shadow. same corners, but pixmap-flavored πŸ¦‹
  • XmNforeground β€” specifies the foreground drawing color used by Primitive widgets. the ink, bestie πŸ–ŠοΈ
  • XmNhelpCallback β€” specifies the list of callbacks that is called when the help key sequence is pressed. the reason sent by the callback is XmCR_HELP. press help, get help, slay πŸ’–
  • XmNhighlightColor β€” contains the color of the highlighting rectangle.
  • XmNhighlightOnEnter β€” okay bestie, this one is all about that highlighting rectangle. It specifies if the highlighting rectangle is drawn when the cursor moves into the widget. But it's giving conditional, because if the shell's focus policy is XmEXPLICIT, this resource is ignored, and the widget is highlighted when it has the focus instead. If the shell's focus policy is XmPOINTER and if this resource is True, the highlighting rectangle is drawn when the cursor moves into the widget. If the shell's focus policy is XmPOINTER and if this resource is False, the highlighting rectangle is not drawn when the cursor moves into the widget. The default is False. So yeah, it's a whole thing. πŸ’…
  • XmNhighlightPixmap β€” specifies the pixmap used to draw the highlighting rectangle. Iconic.
  • XmNhighlightThickness β€” specifies the thickness of the highlighting rectangle. So you can make it thicc or thin. πŸ‘‘
  • XmNlayoutDirection β€” specifies the direction in which components of the manager (including strings) are laid out. The values are of type XmDirection. If the widget's parent is a manager or shell, the value is inherited from the widget's parent. Otherwise, it is inherited from the closest ancestor vendor or menu shell. It's giving layout vibes. πŸ¦‹
  • XmNnavigationType β€” determines whether the widget is a tab group. The tea:
    • XmNONE β€” indicates that the widget is not a tab group. Not it.
    • XmTAB_GROUP β€” indicates that the widget is a tab group, unless the XmNnavigationType of another widget in the hierarchy is XmEXCLUSIVE_TAB_GROUP. So it's a tab group, but with an asterisk.
    • XmSTICKY_TAB_GROUP β€” indicates that the widget is a tab group, even if the XmNnavigationType of another widget in the hierarchy is XmEXCLUSIVE_TAB_GROUP. Sticky, periodt.
    • XmEXCLUSIVE_TAB_GROUP β€” indicates that the widget is a tab group and that widgets in the hierarchy whose XmNnavigationType is XmTAB_GROUP are not tab groups. Also:
      • When a parent widget has an XmNnavigationType of XmEXCLUSIVE_TAB_GROUP, traversal of non-tab-group widgets within the group is based on the order of those widgets in their parent's XmNchildren list.
      • When the XmNnavigationType of any widget in a hierarchy is XmEXCLUSIVE_TAB_GROUP, traversal of tab groups in the hierarchy proceeds to widgets in the order in which their XmNnavigationType resources were specified as XmEXCLUSIVE_TAB_GROUP or XmSTICKY_TAB_GROUP, whether by creating the widgets with that value, by calling XtSetValues, or by calling XmAddTabGroup.
  • XmNshadowThickness β€” specifies the size of the drawn border shadow. It's giving depth, bestie. 🌈
  • XmNtopShadowColor β€” contains the color to use to draw the top and left sides of the border shadow. Aesthetic.
  • XmNtopShadowPixmap β€” specifies the pixmap to use to draw the top and left sides of the border shadow. So you can have a pattern up in there.
  • XmNtraversalOn β€” specifies traversal activation for this gadget. Turn it on or off, your choice. πŸ’…
  • XmNunitType β€” provides the basic support for resolution independence. It defines the type of units a widget uses with sizing and positioning resources. If the widget's parent is a subclass of XmManager and if the XmNunitType resource is not explicitly set, it defaults to the unit type of the parent widget. If the widget's parent is not a subclass of XmManager, the resource has a default unit type of XmPIXELS. The unit type can also be specified in resource files, with the following format:
<floating value><unit>

where:

  • unit is <" ", pixels, inches, centimeters, millimeters, points, font units>
  • pixels is <pix, pixel, pixels>
  • inches is <in, inch, inches>
  • centimeter is <cm, centimeter, centimeters>
  • millimeters is <mm, millimeter, millimeters>
  • points is <pt, point, points>
  • font units is <fu, font_unit, font_units>
  • float is {"+"|"-"}{{<"0"-"9">}.}<"0"-"9">
Note that the type Dimension must always be positive.

For example,

xmfonts*XmMainWindow.height: 10.4cm
*PostIn.width: 3inches

XmNunitType can have the following values:

  • XmPIXELS β€” all values provided to the widget are treated as normal pixel values.
  • XmMILLIMETERS β€” all values provided to the widget are treated as normal millimeter values.
  • Xm100TH_MILLIMETERS β€” all values provided to the widget are treated as 1/100 of a millimeter.
  • XmCENTIMETERS β€” all values provided to the widget are treated as normal centimeter values.
  • XmINCHES β€” all values provided to the widget are treated as normal inch values.
  • Xm1000TH_INCHES β€” all values provided to the widget are treated as 1/1000 of an inch.
  • XmPOINTS β€” all values provided to the widget are treated as normal point values. A point is a unit used in text processing applications and is defined as 1/72 of an inch.
  • Xm100TH_POINTS β€” all values provided to the widget are treated as 1/100 of a point. A point is a unit used in text processing applications and is defined as 1/72 inch.
  • XmFONT_UNITS β€” all values provided to the widget are treated as normal font units. A font unit has horizontal and vertical components. These are the values of the XmScreen resources XmNhorizontalFontUnit and XmNverticalFontUnit.
  • Xm100TH_FONT_UNITS β€” all values provided to the widget are treated as 1/100 of a font unit. A font unit has horizontal and vertical components. These are the values of the XmScreen resources XmNhorizontalFontUnit and XmNverticalFontUnit.
  • XmNuserData β€” allows the application to attach any necessary specific data to the gadget. This is an internally unused resource. So it's like a little pocket for your app's stuff, but the gadget itself doesn't use it. πŸ“
  • XmNtoolTipString β€” the XmString to display as the toolTip. If this resource is NULL, no tip will be displayed. ToolTips are described in VendorShell(3). So hover text, but make it Xm.

✨ Inherited Resources ✨

Gadget inherits resources from the superclass described in the following table. For a complete description of each resource, refer to the reference page for that superclass.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      β”‚  RectObj Resource Set      β”‚         β”‚        β”‚
β”‚ Name                 β”‚ Class          β”‚ Type      β”‚ Default β”‚ Access β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ XmNancestorSensitive β”‚ XmCSensitive   β”‚ Boolean   β”‚ dynamic β”‚ G      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ XmNborderWidth       β”‚ XmCBorderWidth β”‚ Dimension β”‚ 0       β”‚ N/A    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ XmNheight            β”‚ XmCHeight      β”‚ Dimension β”‚ dynamic β”‚ CSG    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ XmNsensitive         β”‚ XmCSensitive   β”‚ Boolean   β”‚ True    β”‚ CSG    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ XmNwidth             β”‚ XmCWidth       β”‚ Dimension β”‚ dynamic β”‚ CSG    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ XmNx                 β”‚ XmCPosition    β”‚ Position  β”‚ 0       β”‚ CSG    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ XmNy                 β”‚ XmCPosition    β”‚ Position  β”‚ 0       β”‚ CSG    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸŽ€ Object Resource Set πŸŽ€

bestie there's literally one (1) resource in this set, and here she is:

  • XmNdestroyCallback β€” class is XmCCallback, type is XtCallbackList, default is NULL, and her access is C. she's the only one in the whole table and she knows it πŸ’…

πŸ’Œ Callback Information πŸ’Œ

so when this callback fires, what actually shows up at your door? a pointer to this struct, that's what:

typedef struct
{
        int reason;
        XEvent * event;
} XmAnyCallbackStruct;

and here's what's inside, no cap:

  • reason β€” tells you why the callback got invoked. for this callback specifically, reason is set to XmCR_HELP. like, that's the whole plot twist, that's the reason. 😌
  • event β€” points to the XEvent that triggered the callback. the receipts, fr fr. 🫢

✨ Behavior ✨

okay this part is lowkey important so pay attention bestie:

Gadgets cannot have translations associated with them. periodt. that's just not a thing they do.

and because of that little fact, a Gadget's behavior isn't its own business β€” it's determined by the Manager widget that the Gadget got placed into. your Manager is your whole personality, basically. πŸ‘‘

and if focus happens to be sitting on a Gadget? then events get passed to the Gadget by its Manager. the Manager is out here doing the hand-off like a relay race. πŸƒβ€β™€οΈπŸ’¨


go read these next, they're the friend group:


and that's the whole page, gorgeous πŸ’– this one's from the XmGadget(library call) collection β€” the source is XmGadget, it's the library-call flavor of the manual, so go be iconic with your gadgets now. mwah πŸŽ€βœ¨