XMPUSHBUTTONGADGET(3)
π XmPushButtonGadget π
okay bestie, so this is XmPushButtonGadget(library call) β yes, a whole library call manual page, and it's a long one, so buckle up. We're doing this in five parts and this is part one. Let's go π«Ά
β¨ NAME β¨
XmPushButtonGadget β The PushButtonGadget widget class
β¨ SYNOPSIS β¨
#include <Xm/PushBG.h>
β¨ DESCRIPTION β¨
So, PushButtonGadget issues commands within an application. That's the whole job. It's giving "one button, one destiny." π
It consists of a text label or pixmap surrounded by a border shadow. When PushButtonGadget is selected, the shadow changes to give the appearance that the PushButtonGadget has been pressed in. When PushButtonGadget is unselected, the shadow changes to give the appearance that the PushButtonGadget is out. literally just a visual glow-up and glow-down, no cap.
The default behavior associated with a PushButtonGadget in a menu depends on the type of menu system in which it resides. By default, <Btn1> controls the behavior of the PushButtonGadget. In addition, <Btn3> controls the behavior of the PushButtonGadget if it resides in a PopupMenu system. The actual mouse button used is determined by its RowColumn parent. so it's not really the button's call β it's the parent's vibe check. π
Thickness for a second shadow may be specified with the XmNshowAsDefault resource. If it has a nonzero value, the Label's XmNmarginLeft, XmNmarginRight, XmNmarginTop, and XmNmarginBottom resources may be modified to accommodate the second shadow. (yes, the second shadow is the main character here, and everyone else has to scooch over for it π)
If an initial value is specified for XmNarmPixmap but not for XmNlabelPixmap, the XmNarmPixmap value is used for XmNlabelPixmap. cute little inheritance moment, honestly obsessed.
PushButtonGadget uses the XmQTmenuSystem and XmQTspecifyRenderTable traits, and holds the XmQactivatable, XmQTmenuSavvy, and XmQTtakesDefault traits. traits = the personality it brings to every room it walks into, fr fr.
πΈ Classes πΈ
PushButtonGadget inherits behavior, resources, and traits from Object, RectObj, XmGadget and XmLabelGadget. four ancestors, one iconic gadget.
The class pointer is xmPushButtonGadgetClass.
The class name is XmPushButtonGadget.
π New Resources π
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).
π the resource set, aka the receipts. Name / Class / Type / Default / Access, one bullet each, because we do not do tables in this house π
π« XmPushButtonGadget Resource Set
XmNactivateCallbackβ Class:XmCCallbackΒ· Type:XtCallbackListΒ· Default:NULLΒ· Access:CXmNarmCallbackβ Class:XmCCallbackΒ· Type:XtCallbackListΒ· Default:NULLΒ· Access:CXmNarmColorβ Class:XmCArmColorΒ· Type:PixelΒ· Default: dynamic Β· Access:CSGXmNarmPixmapβ Class:XmCArmPixmapΒ· Type:PixmapΒ· Default:XmUNSPECIFIED_PIXMAPΒ· Access:CSGXmNdefaultButtonShadowThicknessβ Class:XmCdefaultButtonShadowThicknessΒ· Type:DimensionΒ· Default: dynamic Β· Access:CSGXmNdisarmCallbackβ Class:XmCCallbackΒ· Type:XtCallbackListΒ· Default:NULLΒ· Access:CXmNfillOnArmβ Class:XmCFillOnArmΒ· Type:BooleanΒ· Default:TrueΒ· Access:CSGXmNmultiClickβ Class:XmCMultiClickΒ· Type:unsigned charΒ· Default: dynamic Β· Access:CSGXmNshowAsDefaultβ Class:XmCShowAsDefaultΒ· Type:DimensionΒ· Default:0Β· Access:CSG
π The resources, explained with love π
XmNactivateCallbackβ Specifies the list of callbacks that is called when the PushButtonGadget is activated. It is activated when the user presses and releases the active mouse button while the pointer is inside the PushButtonGadget. Activating PushButtonGadget also disarms it. For this callback, the reason isXmCR_ACTIVATE. This callback uses theXmQTactivatabletrait. the moment the button goes "β¨ and I oop, consider it done β¨".XmNarmCallbackβ Specifies the list of callbacks that is called when PushButtonGadget is armed. It is armed when the user presses the active mouse button while the pointer is inside the PushButtonGadget. For this callback, the reason isXmCR_ARM. armed = cocked and loaded, the pre-game, the inhale before the scream. π«ΆXmNarmColorβ Specifies the color with which to fill the armed button.XmNfillOnArmmust be set toTruefor this resource to have an effect. The default for a color display is a color between the background and the bottom shadow color. For a monochrome display, the default is set to the foreground color, and any text in the label appears in the background color when the button is armed. yes, on monochrome it does the full swap β text goes background-colored, no cap, that's just the deal.XmNarmPixmapβ Specifies the pixmap to be used as the button face ifXmNlabeltypeisXmPIXMAPorXmPIXMAP_AND_STRINGand PushButtonGadget is armed. This resource is disabled when the PushButtonGadget is in a menu. π sorry bestie, in a menu it simply does not get to participate.XmNdefaultButtonShadowThicknessβ This resource specifies the width of the default button indicator shadow. If this resource is0(zero), the width of the shadow comes from the value of theXmNshowAsDefaultresource. If this resource is greater than zero, theXmNshowAsDefaultresource is only used to specify whether this button is the default. The default value is the initial value ofXmNshowAsDefault. so it's giving "who's in charge of the shadow width" and the answer changes depending on whether this is zero. stay woke. πXmNdisarmCallbackβ Specifies the list of callbacks that is called when the PushButtonGadget is disarmed. PushButtonGadget is disarmed when the user presses and releases the active mouse button while the pointer is inside that gadget. For this callback, the reason isXmCR_DISARM. the "jk jk, we're chill again" callback πXmNfillOnArmβ Forces the PushButtonGadget to fill the background of the button with the color specified byXmNarmColorwhen the button is armed and when this resource is set toTrue. If it isFalse, only the top and bottom shadow colors are switched. When the PushButtonGadget is in a menu, this resource is ignored and assumed to beFalse. > π¨ important: in a menu, whatever you set here gets ignored and treated asFalse. periodt.
okay that's part one bestie, don't go anywhere, more parts are coming πβ¨
β¨ XmNmultiClick β¨
okay so bestie, imagine someone's out here mashing the button like it owes them money π β here's the tea:
- If a button click gets followed by another button click within the time span the display's multiclick time says, and this resource is set to
XmMULTICLICK_DISCARD, then that second click just⦠does not get processed. it's giving "we're not doing that today." - But if this resource is set to
XmMULTICLICK_KEEP, then the event does get processed, andclick_countgets incremented in the callback structure. slay. π - Defaults? When the button is in a menu, the default is
XmMULTICLICK_DISCARD. Otherwise, for a button not in a menu, the default isXmMULTICLICK_KEEP. π«Ά
π XmNshowAsDefault π
this one's the "notice me, I'm the special one" resource, no cap:
- If
XmNdefaultButtonShadowThicknessis greater than 0 (zero), then any value greater than zero in this resource tells the world to mark this button as the default button. - If
XmNdefaultButtonShadowThicknessis 0, then a value greater than 0 in this resource tells the world to mark this button as the default button with the shadow thickness specified by this resource. - The space between the shadow and the default shadow is equal to the sum of both shadows. math is mathing β¨
- The default value is
0. - When the Display resource
XmNdefaultButtonEmphasishas a value ofXmEXTERNAL_HIGHLIGHT(which is the default, iykyk), PushButton draws the location cursor outside of the outer shadow. - When this resource has a value of
XmINTERNAL_HIGHLIGHT, the highlight gets drawn between the inner and outer shadows. iconic behavior. - When this value is not 0, the Label
XmNmarginLeft,XmNmarginRight,XmNmarginTop, andXmNmarginBottomresources may get modified to accommodate that second shadow. they're just making room bestie, let them live π - π¨ and heads up: this resource is disabled when the PushButton is in a menu. periodt.
π Inherited Resources π
PushButtonGadget inherits behavior and resources from the superclasses described in the tables that follow. For the full deets on each and every resource, go check the reference page for that superclass β it's all there, fr fr. π
β¨ XmLabelGadget Resource Set β¨
okay so bestie, this is literally the whole entire resource set for XmLabelGadget, and I am not skipping a single one because that would be disrespectful to the craft π
The original was a big fancy table with columns Name, Class, Type, Default, and Access, but we're doing it list-style because tables are giving β¨ boomer energy β¨ and we are not that.
every single row below is exactly as it appears in the manual, no cap. Class, type, default, access β all of it. π«Ά
XmNacceleratorβ Class:XmCAccelerator; Type:String; Default:NULL; Access:CSGXmNacceleratorTextβ Class:XmCAcceleratorText; Type:XmString; Default:NULL; Access:CSGXmNalignmentβ Class:XmCAlignment; Type:unsigned char; Default:dynamic; Access:CSGXmNfontListβ Class:XmCFontList; Type:XmFontList; Default:dynamic; Access:CSGXmNlabelInsensitivePixmapβ Class:XmCLabelInsensitivePixmap; Type:Pixmap; Default:XmUNSPECIFIED_PIXMAP; Access:CSGXmNlabelPixmapβ Class:XmCLabelPixmap; Type:Pixmap; Default:dynamic; Access:CSGXmNlabelStringβ Class:XmCXmString; Type:XmString; Default:dynamic; Access:CSGXmNlabelTypeβ Class:XmCLabelType; Type:unsigned char; Default:XmSTRING; Access:CSGXmNmarginBottomβ Class:XmCMarginBottom; Type:Dimension; Default:dynamic; Access:CSGXmNmarginHeightβ Class:XmCMarginHeight; Type:Dimension; Default:2; Access:CSGXmNmarginLeftβ Class:XmCMarginLeft; Type:Dimension; Default:dynamic; Access:CSGXmNmarginRightβ Class:XmCMarginRight; Type:Dimension; Default:dynamic; Access:CSGXmNmarginTopβ Class:XmCMarginTop; Type:Dimension; Default:dynamic; Access:CSGXmNmarginWidthβ Class:XmCMarginWidth; Type:Dimension; Default:2; Access:CSGXmNmnemonicβ Class:XmCMnemonic; Type:KeySym; Default:NULL; Access:CSGXmNpixmapPlacementβ Class:XmCPixmapPlacement; Type:unsigned int; Default:XmPIXMAP_LEFT; Access:CSGXmNpixmapTextPaddingβ Class:XmCSpace; Type:Dimension; Default:2; Access:CSGXmNmnemonicCharSetβ Class:XmCMnemonicCharSet; Type:String; Default:dynamic; Access:CSGXmNrecomputeSizeβ Class:XmCRecomputeSize; Type:Boolean; Default:True; Access:CSGXmNrenderTableβ Class:XmCRenderTable; Type:XmRenderTable; Default:dynamic; Access:CSGXmNstringDirectionβ Class:XmCStringDirection; Type:XmStringDirection; Default:dynamic; Access:CSG
π XmGadget Resource Set π
ok so these are the resources our girl gets handed down from her XmGadget ancestor β the whole entire list, nothing skipped, we do not gatekeep here π The OG table's columns are Name, Class, Type, Default, and Access, so that's exactly what every bullet below is serving you.
XmNbackgroundβ classXmCBackground, typePixel, default dynamic, accessCSGXmNbackgroundPixmapβ classXmCPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGXmNbottomShadowColorβ classXmCBottomShadowColor, typePixel, default dynamic, accessCSGXmNbottomShadowPixmapβ classXmCBottomShadowPixmap, typePixmap, default dynamic, accessCSGXmNhelpCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNforegroundβ classXmCForeground, typePixel, default dynamic, accessCSGXmNhighlightColorβ classXmCHighlightColor, typePixel, default dynamic, accessCSGXmNhighlightOnEnterβ classXmCHighlightOnEnter, typeBoolean, defaultFalse, accessCSGXmNhighlightPixmapβ classXmCHighlightPixmap, typePixmap, default dynamic, accessCSGXmNhighlightThicknessβ classXmCHighlightThickness, typeDimension, default2, accessCSGXmNlayoutDirectionβ classXmNCLayoutDirection, typeXmDirection, default dynamic, accessCGXmNnavigationTypeβ classXmCNavigationType, typeXmNavigationType, defaultXmNONE, accessCSGXmNshadowThicknessβ classXmCShadowThickness, typeDimension, default2, accessCSGXmNtopShadowColorβ classXmCTopShadowColor, typePixel, default dynamic, accessCSGXmNtopShadowPixmapβ classXmCTopShadowPixmap, typePixmap, default dynamic, accessCSGXmNtraversalOnβ classXmCTraversalOn, typeBoolean, defaultTrue, accessCSGXmNunitTypeβ classXmCUnitType, typeunsigned char, default dynamic, accessCSGXmNuserDataβ classXmCUserData, typeXtPointer, defaultNULL, accessCSG
that's eighteen, count them, all of them, periodt π
π¦ RectObj Resource Set π¦
and then there's the RectObj set β even further up the family tree, the rectangle ancestor that everyone shares π«Ά same deal, same columns, every row:
XmNancestorSensitiveβ classXmCSensitive, typeBoolean, default dynamic, accessGXmNborderWidthβ classXmCBorderWidth, typeDimension, default0, accessN/AXmNheightβ classXmCHeight, typeDimension, default dynamic, accessCSGXmNsensitiveβ classXmCSensitive, typeBoolean, defaultTrue, accessCSGXmNwidthβ classXmCWidth, typeDimension, default dynamic, accessCSGXmNxβ classXmCPosition, typePosition, default0, accessCSGXmNyβ classXmCPosition, typePosition, default0, accessCSG
ngl the way these two tables are just quietly doing the most important work and never getting credit... main character energy in the background fr π
keep scrolling bestie, there's more of this family tree to unfold π
π Object Resource Set π
Here's the whole resource lineup for this gadget, bestie. One entry, but she's important:
XmNdestroyCallbackβ Class:XmCCallbackΒ· Type:XtCallbackListΒ· Default:NULLΒ· Access:C
π Callback Information π
Every time a callback fires, it gets handed a pointer to this lil struct, fr fr:
typedef struct
{
int reason;
XEvent * event;
int click_count;
} XmPushButtonCallbackStruct;
reasonβ tells you why the callback got invoked in the first place. πeventβ points at theXEventthat triggered the callback.click_countβ only valid whenreasonisXmCR_ACTIVATE. It holds the number of clicks in the last multiclick sequence if theXmNmultiClickresource is set toXmMULTICLICK_KEEP; otherwise it just says1. And heads up: the activate callback gets invoked for each click whenXmNmultiClickis set toXmMULTICLICK_KEEP.
π₯ Behavior π₯
XmPushButtonGadget picks up behavior from XmGadget, and it also gets menu traversal behavior from XmLabelGadget. Everything extra it does is right here:
<Btn2Down>β drags the contents of a PushButtonGadget label, which gets identified the moment<Btn2>is pressed.
This action is undefined for PushButtonGadgets used in a menu system. Don't do it. π
<Btn1Down>β arms the PushButtonGadget. Iconic.
In a menu, this action unposts any menus posted by the PushButtonGadget's parent menu, disables keyboard traversal for the menu, and enables mouse traversal for the menu. It draws the shadow in the armed state. Unless the button is already armed, it calls the XmNarmCallback callbacks.
If the button is not in a menu, this action draws the shadow in the armed state. If XmNfillOnArm is set to True, it fills the button with the color specified by XmNarmColor. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, the XmNarmPixmap is used for the button face. It calls the XmNarmCallback callbacks.
<Btn1>(2+) β ifXmNmultiClickisXmMULTICLICK_DISCARD, this action does absolutely nothing. Ghosted. π«₯
If XmNmultiClick is XmMULTICLICK_KEEP, this action draws the shadow in the armed state. If the button is not in a menu and if XmNfillOnArm is set to True, it fills the button with the color specified by XmNarmColor. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, the XmNarmPixmap is used for the button face. This action calls the XmNarmCallback callbacks.
<Btn1Up>β in a menu, this action unposts all menus in the menu hierarchy and activates the PushButtonGadget. It calls theXmNactivateCallbackcallbacks and then theXmNdisarmCallbackcallbacks.
If the PushButtonGadget is not in a menu, this action draws the shadow in the unarmed state. If XmNfillOnArm is set to True, the background color reverts to the unarmed color. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, the XmNlabelPixmap is used for the button face. If the pointer is still within the button, this action calls the callbacks for XmNactivateCallback and XmNdisarmCallback.
<Btn1Up>(2+) β ifXmNmultiClickisXmMULTICLICK_DISCARD, this action does nothing. Again. π€·
If XmNmultiClick is XmMULTICLICK_KEEP, this action increments click_count in the callback structure and draws the shadow in the unarmed state. If the button is not in a menu and if XmNfillOnArm is set to True, the background color reverts to the unarmed color. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, XmNlabelPixmap is used for the button face. If the pointer is within the PushButtonGadget, this action calls the callbacks for XmNactivateCallback and XmNdisarmCallback.
<Key><osfActivate>β in a menu, this action unposts all menus in the menu hierarchy, unless the button is already armed, and calls theXmNarmCallbackcallbacks, theXmNactivateCallbackand theXmNdisarmCallbackcallbacks. Outside a menu,KActivatehas no effect. For PushButtonGadgets outside of a menu, if the parent is a manager, this action passes the event to the parent.<Key><osfSelect>β in a menu, this action unposts all menus in the menu hierarchy, unless the button is already armed, and calls theXmNarmCallbackcallbacks. This action calls theXmNactivateCallbackandXmNdisarmCallbackcallbacks.
Outside a menu, this action draws the shadow in the armed state and, if XmNfillOnArm is set to True, fills the button with the color specified by XmNarmColor. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, XmNarmPixmap is used for the button face. This action calls the XmNarmCallback callbacks.
Outside a menu, this action also arranges for the following to happen, either immediately or at a later time: the shadow is drawn in the unarmed state and, if XmNfillOnArm is set to True, the background color reverts to the unarmed color. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, the XmNlabelPixmap is used for the button face. The XmNactivateCallback and XmNdisarmCallback callbacks are called.
<Key><osfHelp>β in a Pulldown or Popup MenuPane, unposts all menus in the menu hierarchy and restores keyboard focus to the widget that had the focus before the menu system was entered. This action calls the callbacks forXmNhelpCallbackif any exist. If there are no help callbacks for this widget, this action calls the help callbacks for the nearest ancestor that has them. (Finding your nearest ancestor who can help = the realest thing ever. π«Ά)<Key><osfCancel>β in a toplevel Pulldown MenuPane from a MenuBar, unposts the menu, disarms the MenuBar CascadeButton and the MenuBar, and 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. For a PushButtonGadget outside of a menu, if the parent is a manager, this action passes the event to the parent.
<Enter>β in a menu, if keyboard traversal is enabled, this action does nothing. Otherwise, it draws the shadow in the armed state and calls theXmNarmCallbackcallbacks.
If the PushButtonGadget is not in a menu and the cursor leaves and then reenters the PushButtonGadget while the button is pressed, this action draws the shadow in the armed state. If XmNfillOnArm is set to True, it also fills the button with the color specified by XmNarmColor. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, the XmNarmPixmap is used for the button face.
<Leave>β in a menu, if keyboard traversal is enabled, this action does nothing. Otherwise, it draws the shadow in the unarmed state and calls theXmNdisarmCallbackcallbacks.
If the PushButtonGadget is not in a menu and the cursor leaves the PushButtonGadget while the button is pressed, this action draws the shadow in the unarmed state. If XmNfillOnArm is set to True, the background color reverts to the unarmed color. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, the XmNlabelPixmap is used for the button face.
π Virtual Bindings π
The bindings for virtual keys are vendor specific β so like, ask your vendor, not me. For information about bindings for virtual buttons and keys, go read VirtualBindings(3).
πΈ RELATED πΈ
Besties you should also go read, no cap:
Object(3)RectObj(3)XmCreatePushButtonGadget(3)XmGadget(3)XmLabelGadget(3)XmRowColumn(3)XmVaCreatePushButtonGadget(3)XmVaCreateManagedPushButtonGadget(3)
That's the whole page, babe! π This was the XmPushButtonGadget(library call) manual page β library call section, that's the source and the version, and the date field on it is empty so there's literally nothing to stamp. Go arm some buttons and slay. π
β¨
π¦ 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