XMGADGET(3)
π 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
XmNorXmCprefix and use the letters that are left. - to specify one of the defined values for a resource, drop the
Xmprefix 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 usingXtSetValues,G= retrieved by usingXtGetValues,N/A= not applicable.
and now, the resource set, in all her glory:
π XmGadget Resource Set π
XmNbackgroundβ Class:XmCBackground, Type:Pixel, Default:dynamic, Access:CSGXmNbackgroundPixmapβ Class:XmCPixmap, Type:Pixmap, Default:XmUNSPECIFIED_PIXMAP, Access:CSGXmNbottomShadowColorβ Class:XmCBottomShadowColor, Type:Pixel, Default:dynamic, Access:CSGXmNbottomShadowPixmapβ Class:XmCBottomShadowPixmap, Type:Pixmap, Default:dynamic, Access:CSGXmNhelpCallbackβ Class:XmCCallback, Type:XtCallbackList, Default:NULL, Access:CXmNforegroundβ Class:XmCForeground, Type:Pixel, Default:dynamic, Access:CSGXmNhighlightColorβ Class:XmCHighlightColor, Type:Pixel, Default:dynamic, Access:CSGXmNhighlightOnEnterβ Class:XmCHighlightOnEnter, Type:Boolean, Default:False, Access:CSGXmNhighlightPixmapβ Class:XmCHighlightPixmap, Type:Pixmap, Default:dynamic, Access:CSGXmNhighlightThicknessβ Class:XmCHighlightThickness, Type:Dimension, Default:2, Access:CSGXmNlayoutDirectionβ Class:XmNCLayoutDirection, Type:XmDirection, Default:dynamic, Access:CGXmNnavigationTypeβ Class:XmCNavigationType, Type:XmNavigationType, Default:XmNONE, Access:CSGXmNshadowThicknessβ Class:XmCShadowThickness, Type:Dimension, Default:2, Access:CSGXmNtopShadowColorβ Class:XmCTopShadowColor, Type:Pixel, Default:dynamic, Access:CSGXmNtopShadowPixmapβ Class:XmCTopShadowPixmap, Type:Pixmap, Default:dynamic, Access:CSGXmNtraversalOnβ Class:XmCTraversalOn, Type:Boolean, Default:True, Access:CSGXmNunitTypeβ Class:XmCUnitType, Type:unsigned char, Default:dynamic, Access:CSGXmNuserDataβ Class:XmCUserData, Type:XtPointer, Default:NULL, Access:CSGXmNtoolTipStringβ 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 isXmCR_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 isXmEXPLICIT, this resource is ignored, and the widget is highlighted when it has the focus instead. If the shell's focus policy isXmPOINTERand if this resource isTrue, the highlighting rectangle is drawn when the cursor moves into the widget. If the shell's focus policy isXmPOINTERand if this resource isFalse, the highlighting rectangle is not drawn when the cursor moves into the widget. The default isFalse. 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 typeXmDirection. 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 theXmNnavigationTypeof another widget in the hierarchy isXmEXCLUSIVE_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 theXmNnavigationTypeof another widget in the hierarchy isXmEXCLUSIVE_TAB_GROUP. Sticky, periodt.XmEXCLUSIVE_TAB_GROUPβ indicates that the widget is a tab group and that widgets in the hierarchy whoseXmNnavigationTypeisXmTAB_GROUPare not tab groups. Also:- When a parent widget has an
XmNnavigationTypeofXmEXCLUSIVE_TAB_GROUP, traversal of non-tab-group widgets within the group is based on the order of those widgets in their parent'sXmNchildrenlist. - When the
XmNnavigationTypeof any widget in a hierarchy isXmEXCLUSIVE_TAB_GROUP, traversal of tab groups in the hierarchy proceeds to widgets in the order in which theirXmNnavigationTyperesources were specified asXmEXCLUSIVE_TAB_GROUPorXmSTICKY_TAB_GROUP, whether by creating the widgets with that value, by callingXtSetValues, or by callingXmAddTabGroup.
- When a parent widget has an
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 ofXmManagerand if theXmNunitTyperesource is not explicitly set, it defaults to the unit type of the parent widget. If the widget's parent is not a subclass ofXmManager, the resource has a default unit type ofXmPIXELS. The unit type can also be specified in resource files, with the following format:
<floating value><unit>
where:
unitis <" ", pixels, inches, centimeters, millimeters, points, font units>pixelsis <pix, pixel, pixels>inchesis <in, inch, inches>centimeteris <cm, centimeter, centimeters>millimetersis <mm, millimeter, millimeters>pointsis <pt, point, points>font unitsis <fu, font_unit, font_units>floatis {"+"|"-"}{{<"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 theXmScreenresourcesXmNhorizontalFontUnitandXmNverticalFontUnit.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 theXmScreenresourcesXmNhorizontalFontUnitandXmNverticalFontUnit.
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β theXmStringto display as the toolTip. If this resource isNULL, no tip will be displayed. ToolTips are described inVendorShell(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 isXmCCallback, type isXtCallbackList, default isNULL, and her access isC. 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,reasonis set toXmCR_HELP. like, that's the whole plot twist, that's the reason. πeventβ points to theXEventthat 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. πββοΈπ¨
π RELATED π
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 πβ¨
π¦ 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