XMDRAWNBUTTON(3)
π XmDrawnButton π
okay bestie, welcome to the XmDrawnButton page β it's a library call, and it's genuinely one of the cutest little widgets in the whole Motif family. let's get into it. π
β¨ NAME β¨
XmDrawnButton β The DrawnButton widget class
β¨ SYNOPSIS β¨
#include <Xm/DrawnB.h>
β¨ DESCRIPTION β¨
so like. picture this. the DrawnButton widget is literally an empty widget window that's surrounded by a shadow border. that's it. that's the whole vibe. it hands the application developer a graphics area β a little canvas, a blank stage, a moment of silence before the art β and that area gets PushButton input semantics. so you draw whatever you want in there, and it still behaves like a button. iconic behavior honestly. π
callback types are defined for widget exposure and widget resize, so your app can redraw or reposition its graphics whenever it needs to. slay.
β οΈ important one, bestie: if the DrawnButton widget has a highlight and shadow thickness, the application should not draw in that area. periodt.
and the way to avoid drawing in the highlight and shadow area? create the graphics context with a clipping rectangle for drawing in the widget. the clipping rectangle should take into account the size of the widget's highlight thickness and shadow. that's the move. π«Ά
DrawnButton uses the XmQTmenuSystem and XmQTspecifyRenderTable traits, and holds the XmQTactivatable trait.
πΈ Classes πΈ
DrawnButton inherits behavior, resources, and traits from the Core, Primitive, and XmLabel classes. (yes, it's a whole family tree and DrawnButton is the main character at the bottom of it.)
The class pointer is xmDrawnButtonWidgetClass.
The class name is XmDrawnButton.
π New Resources π
okay so here's the resource table, but make it group chat. the following set of widget resources is 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 β yes, the underscores stay, don't come for them).
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).
π XmDrawnButton Resource Set π
XmNactivateCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNarmCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNdisarmCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNexposeCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNmultiClickβ classXmCMultiClick, typeunsigned char, defaultdynamic, accessCSGXmNpushButtonEnabledβ classXmCPushButtonEnabled, typeBoolean, defaultFalse, accessCSGXmNresizeCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNshadowTypeβ classXmCShadowType, typeunsigned char, defaultXmSHADOW_ETCHED_IN, accessCSG
π¦ and here's what each one actually does π¦
XmNactivateCallbackβ Specifies the list of callbacks that is called when the widget becomes selected. The reason sent by the callback isXmCR_ACTIVATE. This callback uses theXmQTactivatabletrait. β¨XmNarmCallbackβ Specifies the list of callbacks that is called when the widget becomes armed. The reason sent by the callback isXmCR_ARM. π₯XmNdisarmCallbackβ Specifies the list of callbacks that is called when the widget becomes disarmed. The reason sent by the callback isXmCR_DISARM.XmNexposeCallbackβ Specifies the list of callbacks that is called when the widget receives an exposure event. The reason sent by the callback isXmCR_EXPOSE. πXmNmultiClickβ okay so this one is about double clicks, and the vibes are specific. If a button click is followed by another button click within the time span specified by the display's multiclick time, and this resource is set toXmMULTICLICK_DISCARD, the second click is not processed. If this resource is set toXmMULTICLICK_KEEP, the event is processed andclick_countis incremented in the callback structure. When the button is not in a menu, the default value isXmMULTICLICK_KEEP.XmNpushButtonEnabledβ Enables or disables the 3-dimensional shadow drawing as in PushButton. that's literally it, it's the 3D toggle. πXmNresizeCallbackβ Specifies the list of callbacks that is called when the widget receives a resize event. The reason sent by the callback isXmCR_RESIZE. The event returned for this callback isNULL. (yeah,NULL. it's giving "no event for you." π)XmNshadowTypeβ Describes the drawing style for the DrawnButton. This resource can have the following values:XmSHADOW_INβ Draws the DrawnButton so that the shadow appears inset. This means that the bottom shadow visuals and top shadow visuals are reversed.XmSHADOW_OUTβ Draws the DrawnButton so that the shadow appears outset.XmSHADOW_ETCHED_INβ Draws the DrawnButton using a double line. This gives the effect of a line etched into the window. The thickness of the double line is equal to the value ofXmNshadowThickness.XmSHADOW_ETCHED_OUTβ Draws the DrawnButton using a double line. This gives the effect of a line coming out of the window. The thickness of the double line is equal to the value ofXmNshadowThickness.
π Inherited Resources π
DrawnButton 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. (iykyk β we're going up the family tree from here. π³)
π XmLabel Resource Set π
okay bestie, this is the full roster β every single resource this widget's label machinery knows about. name, class, type, default, and whether you can actually reach it through the standard access calls (that's the Access column, and N/A means not applicable, CSG means it's fair game for the usual get/set/whatever crowd). no skips, no "and so on", all nineteen of them, in order, periodt. π
XmNacceleratorβ classXmCAccelerator, typeString, defaultNULL, accessN/A.XmNacceleratorTextβ classXmCAcceleratorText, typeXmString, defaultNULL, accessN/A.XmNalignmentβ classXmCAlignment, typeunsigned char, defaultdynamic, accessCSG.XmNfontListβ classXmCFontList, typeXmFontList, defaultdynamic, accessCSG.XmNlabelInsensitivePixmapβ classXmCLabelInsensitivePixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSG.XmNlabelPixmapβ classXmCLabelPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSG.XmNlabelStringβ classXmCXmString, typeXmString, default"\0", accessCSG.XmNlabelTypeβ classXmCLabelType, typeunsigned char, defaultXmSTRING, accessCSG.XmNmarginBottomβ classXmCMarginBottom, typeDimension, default0, accessCSG.XmNmarginHeightβ classXmCMarginHeight, typeDimension, default2, accessCSG.XmNmarginLeftβ classXmCMarginLeft, typeDimension, default0, accessCSG.XmNmarginRightβ classXmCMarginRight, typeDimension, default0, accessCSG.XmNmarginTopβ classXmCMarginTop, typeDimension, default0, accessCSG.XmNmarginWidthβ classXmCMarginWidth, typeDimension, default2, accessCSG.XmNmnemonicβ classXmCMnemonic, typeKeySym, defaultNULL, accessN/A.XmNmnemonicCharSetβ classXmCMnemonicCharSet, typeString, defaultXmFONTLIST_DEFAULT_TAG, accessN/A.XmNrecomputeSizeβ classXmCRecomputeSize, typeBoolean, defaultTrue, accessCSG.XmNrenderTableβ classXmCRenderTable, typeXmRenderTable, defaultdynamic, accessCSG.XmNstringDirectionβ classXmCStringDirection, typeXmStringDirection, defaultdynamic, accessCSG.
a lil vibe check on that list β¨ β see how the margins are just vibing at 0 and 2, and three whole resources said "my default is dynamic, figure it out"? that's not me being vague, that's literally what the table says, and I refuse to elaborate further because I do not make the rules. π
and yes, XmNlabelString defaults to the extremely dramatic "\0" β an empty string, a blank canvas, a girl with nothing to say yet. character development pending. π
heads up: the N/A in that Access column is doing real work, bestie β don't come for me later saying I didn't warn you that not every one of these is a normal read/write situation. π«Ά
also XmFONTLIST_DEFAULT_TAG for XmNmnemonicCharSet and XmUNSPECIFIED_PIXMAP for both the pixmap resources β those aren't typos, that's genuinely the documented default, copy it exactly or the compiler will simply not. no cap. π
next up, the fun stuff continues β don't go anywhere, we're so not done here π¦
π XmPrimitive Resource Set π
okay bestie, deep breath, because this is the big one β the full resource table for XmPrimitive, which XmDrawnButton inherits from like it's family money π
. Five columns, eighteen rows, no skips, no shortcuts. Here's how to read each line: the resource Name comes first, then its Class, then the Type, then the Default, and finally the Access column (which is literally just C, CSG, or CG β that's what's written, that's what you get π«Ά).
XmNbottomShadowColorβ classXmCBottomShadowColor, typePixel, default dynamic, accessCSGπΈXmNbottomShadowPixmapβ classXmCBottomShadowPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGβ¨XmNconvertCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCπXmNforegroundβ classXmCForeground, typePixel, default dynamic, accessCSGπXmNhelpCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCπ¦XmNhighlightColorβ classXmCHighlightColor, typePixel, default dynamic, accessCSGπXmNhighlightOnEnterβ classXmCHighlightOnEnter, typeBoolean, defaultFalse, accessCSGπXmNhighlightPixmapβ classXmCHighlightPixmap, typePixmap, default dynamic, accessCSGπXmNhighlightThicknessβ classXmCHighlightThickness, typeDimension, default2, accessCSGβXmNlayoutDirectionβ classXmCLayoutDirection, typeXmDirection, default dynamic, accessCGπ§XmNnavigationTypeβ classXmCNavigationType, typeXmNavigationType, defaultXmNONE, accessCSGπXmNpopupHandlerCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCπ₯XmNshadowThicknessβ classXmCShadowThickness, typeDimension, default2, accessCSGπXmNtopShadowColorβ classXmCTopShadowColor, typePixel, default dynamic, accessCSGπΈXmNtopShadowPixmapβ classXmCTopShadowPixmap, typePixmap, default dynamic, accessCSGβ¨XmNtraversalOnβ classXmCTraversalOn, typeBoolean, defaultTrue, accessCSGπXmNunitTypeβ classXmCUnitType, typeunsigned char, default dynamic, accessCSGπXmNuserDataβ classXmCUserData, typeXtPointer, defaultNULL, accessCSGπ¦
not me counting them to make sure all eighteen made it π bestie there are literally eighteen and every single one is up there, defaults and access codes and all, no cap π₯
and yes, the <pink>dynamic</pink> defaults stay written as dynamic because that's exactly what the table says β don't come for me, I'm just the messenger π«Ά
π Core Resource Set π
Okay bestie, here's the whole squad of core resources this widget rolls with. Same energy as every other widget in the fam, but here's the receipt anyway. For each one you get its name, its class, its type, its default, and its access β and yes, every single one is below, no skipping, no "you get the idea" nonsense. π
XmNacceleratorsβ classXmCAccelerators, typeXtAccelerators, defaultdynamic, accessCSGXmNancestorSensitiveβ classXmCSensitive, typeBoolean, defaultdynamic, accessGXmNbackgroundβ classXmCBackground, typePixel, defaultdynamic, accessCSGXmNbackgroundPixmapβ classXmCPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGXmNborderColorβ classXmCBorderColor, typePixel, defaultXtDefaultForeground, accessCSGXmNborderPixmapβ classXmCPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGXmNborderWidthβ classXmCBorderWidth, typeDimension, default0, accessCSGXmNcolormapβ classXmCColormap, typeColormap, defaultdynamic, accessCGXmNdepthβ classXmCDepth, typeint, defaultdynamic, accessCGXmNdestroyCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNheightβ classXmCHeight, typeDimension, defaultdynamic, accessCSGXmNinitialResourcesPersistentβ classXmCInitialResourcesPersistent, typeBoolean, defaultTrue, accessCXmNmappedWhenManagedβ classXmCMappedWhenManaged, typeBoolean, defaultTrue, accessCSGXmNscreenβ classXmCScreen, typeScreen *, defaultdynamic, accessCGXmNsensitiveβ classXmCSensitive, typeBoolean, defaultTrue, accessCSGXmNtranslationsβ classXmCTranslations, typeXtTranslations, defaultdynamic, accessCSGXmNwidthβ classXmCWidth, typeDimension, defaultdynamic, accessCSGXmNxβ classXmCPosition, typePosition, default0, accessCSGXmNyβ classXmCPosition, typePosition, default0, accessCSG
That access column?CSG,CG,C,Gβ literally what the table says, and I am not about to start guessing at extra lore for you. It's giving "look it up in the Intrinsics docs," bestie. π
π Callback Information π
When a callback fires, it gets handed a pointer to this little struct right here. Here's the exact shape of it, no notes:
typedef struct
{
int reason;
XEvent * event;
Window window;
int click_count;
} XmDrawnButtonCallbackStruct;
And here's what each field is actually doing:
reasonβ tells you why the callback got invoked in the first place. The whole plot, basically. πeventβ points at theXEventthat triggered the callback. Heads up though: this one isNULLforXmNresizeCallback. Yes,NULL. Don't come for me, that's just how it is. πwindowβ set to the window ID where the event went down.click_countβ holds the number of clicks in the last multiclick sequence if theXmNmultiClickresource is set toXmMULTICLICK_KEEP. Otherwise? It just contains1. And the activate callback gets invoked for each click ifXmNmultiClickis set toXmMULTICLICK_KEEP. So like, either you're getting the real count or you're getting a very confident1. π€·
β¨οΈ Translations β¨οΈ
XmDrawnButton pulls in translations from Primitive, and then it's got some extra XmDrawnButton translations of its own, all listed below. The key names here are written in the X standard key event translation table syntax β that's the format Motif uses to say which widget actions line up with which key. π
If you want the quick-and-dirty overview of that format, go peek at VirtualBindings(3). Want the complete breakdown? That's the X Toolkit Instrinsics Documentation, bestie. Go read it, it's all there. π
c<Btn1Down>: ButtonTakeFocus()
okay bestie we're picking up right where we left off, no re-intros, let's go π here's the rest of the bindings:
βΌc<Btn1Down>:βArm()βΌc<Btn1Down>,βΌc<Btn1Up>:βActivate() Disarm()βΌc<Btn1Down>(2+):βMultiArm()βΌc<Btn1Up>(2+):βMultiActivate()βΌc<Btn1Up>:βActivate() Disarm():<Key><osfActivate>:βPrimitiveParentActivate():<Key><osfCancel>:βPrimitiveParentCancel():<Key><osfSelect>:βArmAndActivate():<Key><osfHelp>:βHelp()βΌs βΌm βΌa <Key>Return:βPrimitiveParentActivate()βΌs βΌm βΌa <Key>space:βArmAndActivate()
π¬ Action Routines π¬
The XmDrawnButton action routines are right here, babes:
Activate()β ifXmNpushButtonEnabledisTrue, it redraws the shadow in the unselected state; otherwise it redraws the shadow according toXmNshadowType. And if the pointer is within the DrawnButton, it calls theXmNactivateCallbackcallbacks. slay β¨Arm()β ifXmNpushButtonEnabledisTrue, it redraws the shadow in the selected state; otherwise it redraws the shadow according toXmNshadowType. Then it calls the callbacks forXmNarmCallback.ArmAndActivate()β ifXmNpushButtonEnabledisTrue, it redraws the shadow in the selected state; otherwise it redraws the shadow according toXmNshadowType. Then it calls the callbacks forXmNarmCallback.
If XmNpushButtonEnabled is True, the shadow is redrawn in the unselected state; otherwise the shadow is redrawn according to XmNshadowType. The callbacks for XmNactivateCallback and XmNdisarmCallback are called. And bestie, listen β these actions happen either immediately or at a later time. both. it's giving mysterious π
ButtonTakeFocus()β causes the PushButton to take keyboard focus whenCtrl<Btn1Down>is pressed, without activating the widget. focus only, no clicking, we're just looking respectfully πDisarm()β marks the DrawnButton as unselected and calls the callbacks forXmNdisarmCallback.Help()β calls the callbacks forXmNhelpCallbackif any exist. And if there are no help callbacks for this widget, this action calls the help callbacks for the nearest ancestor that has them. it goes up the family tree, iconic π«ΆMultiActivate()β ifXmNmultiClickisXmMULTICLICK_DISCARD, this action does nothing. periodt.
If XmNmultiClick is XmMULTICLICK_KEEP, this action increments click_count in the callback structure. If XmNpushButtonEnabled is True, this action redraws the shadow in the unselected state; otherwise it redraws the shadow according to XmNshadowType. And if the pointer is within the DrawnButton, this action calls the XmNactivateCallback callbacks and calls the callbacks for XmNdisarmCallback.
MultiArm()β ifXmNmultiClickisXmMULTICLICK_DISCARD, this action does nothing.
If XmNmultiClick is XmMULTICLICK_KEEP and if XmNpushButtonEnabled is True, this action redraws the shadow in the selected state; otherwise it redraws the shadow according to XmNshadowType and calls the callbacks for XmNarmCallback.
β¨ Additional Behavior β¨
This widget has the following additional behavior, no cap:
<EnterWindow>β draws the shadow in its selected state ifXmNpushButtonEnabledisTrueand if the cursor leaves and re-enters the window whileBSelectis pressed. π she remembered you<LeaveWindow>β draws the shadow in its unselected state ifXmNpushButtonEnabledisTrueand if the cursor leaves the window whileBSelectis pressed.
π Virtual Bindings π
The bindings for virtual keys are vendor specific β like, everyone's doing their own thing, iykyk. For information about bindings for virtual buttons and keys, see VirtualBindings(3).
π RELATED π
the whole friend group, fr fr π
Core(3)XmCreateDrawnButtonXmLabel(3)XmPrimitive(3)XmPushButtonXmSeparator(3)XmVaCreateDrawnButtonXmVaCreateManagedDrawnButton
and that's the whole page, bestie, we ate and left no crumbs π this one's the XmDrawnButton(library call) manpage β that's the footer, that's the credit, that's the whole vibe. go forth and draw those buttons, my little main character ππ
π¦ 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