XMTOGGLEBUTTON(3)
π XmToggleButton π
okay bestie, so this is the manual page for XmToggleButton β and yeah, it lives in the library call section of the manual, so if you were looking for the (3) version, you found it. sit down, grab a strawberry, we're learning about toggle buttons πΈ
β¨ NAME β¨
XmToggleButton β the ToggleButton widget class π
π SYNOPSIS π
#include <Xm/ToggleB.h>
that's it, that's the whole vibe. one include and you're in π
π DESCRIPTION π
so like, ToggleButton's whole thing is setting nontransitory state data inside an application. iykyk. it's the "this is staying set until you say otherwise" girlie, not the flash-in-the-pan press-and-release type.
usually this widget is made of an indicator (square, diamond, or round π¦ π· β) with either text or a pixmap hanging out on one side of it. but lowkey? it can also be just text or just a pixmap, no indicator at all. she's flexible like that π
the toggle graphics display a 1-of-many, N-of-many, or 1-of-many-round selection state. here's the mapping, bestie, memorize it:
- a square indicator β shows an N-of-many selection state
- a diamond-shaped indicator β shows a 1-of-many selection state
- a circle-shaped indicator β shows a 1-of-many-round selection state
ToggleButton implies a set or unset state. periodt. and if you've got a label plus an indicator:
- an empty indicator (square, diamond, or round) = ToggleButton is unset
- a filled indicator = it is set β
that fill can be a check mark, a cross, or the select color. and for a pixmap toggle? different story β different pixmaps get used to display the set/unset states. no cap.
ToggleButton can also indicate an indeterminate state (the "idk her" state π):
- with a label and an indicator β indeterminate shows up as a stippled flat box
- with a pixmap toggle β a different pixmap is used to display the indeterminate state
okay now the menu tea β the default behavior of a ToggleButton inside a menu depends on the type of menu system it resides in. by default, <Btn1> controls the behavior of the ToggleButton. in addition, <Btn3> controls the behavior of the ToggleButton if it resides in a PopupMenu system. and the actual mouse button used? that's determined by its RowColumn parent. so don't come for the ToggleButton, come for the parent π
oh also β Label's resource XmNmarginLeft may be increased to accommodate the toggle indicator when it is created. just a lil heads up so your indicator isn't squished π«Ά
and for the trait girlies: ToggleButton uses the XmQTmenuSystem and XmQTspecifyRenderTable traits. iconic behavior honestly β¨
π§ Classes π§
ToggleButton inherits behavior, resources, and traits from Core, XmPrimitive, and XmLabel. it's giving nepo baby but in a cute way, she got it from her ancestors π
- The class pointer is
xmToggleButtonWidgetClass. - The class name is
XmToggleButton.
π New Resources π
okay so this next part is a table that defines a set of widget resources used by the programmer to specify data. and bestie, you can also set the resource values for the inherited classes to set attributes for this widget. that's the family plan, we all share π₯°
here's the trick for your .Xdefaults file:
- to reference a resource by name or by class in a
.Xdefaultsfile β remove theXmNorXmCprefix and use the remaining letters. - to specify one of the defined values for a resource in a
.Xdefaultsfile β remove theXmprefix and use the remaining letters (in either lowercase or uppercase, but include any underscores between words).
and the codes in the access column tell you what you're allowed to do with a given resource:
Cβ can be set at creation timeSβ can be set by usingXtSetValuesGβ can be retrieved by usingXtGetValuesN/Aβ not applicable
lowkey important: those access codes are the whole vibe check for each resource, so keep an eye on the table when it shows up next π
and that's where this part wraps, bestie β the resource table itself is coming up next, so don't go anywhere πΈ
okay bestie, so here's the whole XmToggleButton Resource Set table, but we're doing it as a list because tables are not the vibe π . Every single resource, with its class, type, default, and access β no cap, all of them:
XmNarmCallbackβ Class:XmCArmCallback, Type:XtCallbackList, Default:NULL, Access:CXmNdetailShadowThicknessβ Class:XmCDetailShadowThickness, Type:Dimension, Default:2, Access:CSGXmNdisarmCallbackβ Class:XmCDisarmCallback, Type:XtCallbackList, Default:NULL, Access:CXmNfillOnSelectβ Class:XmCFillOnSelect, Type:Boolean, Default:dynamic, Access:CSGXmNindeterminatePixmapβ Class:XmCIndeterminatePixmap, Type:Pixmap, Default:XmUNSPECIFIED_PIXMAP, Access:CSGXmNindicatorOnβ Class:XmCIndicatorOn, Type:unsigned char, Default:XmINDICATOR_FILL, Access:CSGXmNindicatorSizeβ Class:XmCIndicatorSize, Type:Dimension, Default:dynamic, Access:CSGXmNindicatorTypeβ Class:XmCIndicatorType, Type:unsigned char, Default:dynamic, Access:CSGXmNselectColorβ Class:XmCSelectColor, Type:Pixel, Default:dynamic, Access:CSGXmNselectInsensitivePixmapβ Class:XmCSelectInsensitivePixmap, Type:Pixmap, Default:XmUNSPECIFIED_PIXMAP, Access:CSGXmNselectPixmapβ Class:XmCSelectPixmap, Type:Pixmap, Default:XmUNSPECIFIED_PIXMAP, Access:CSGXmNsetβ Class:XmCSet, Type:unsigned char, Default:XmUNSET, Access:CSGXmNspacingβ Class:XmCSpacing, Type:Dimension, Default:4, Access:CSGXmNtoggleModeβ Class:XmCToggleMode, Type:unsigned char, Default:XmTOGGLE_BOOLEAN, Access:CSGXmNunselectColorβ Class:XmCUnselectColor, Type:Pixel, Default:dynamic, Access:CSGXmNvalueChangedCallbackβ Class:XmCValueChangedCallback, Type:XtCallbackList, Default:NULL, Access:CXmNvisibleWhenOffβ Class:XmCVisibleWhenOff, Type:Boolean, Default:dynamic, Access:CSG
now for the deets on some of these, bestie:
XmNarmCallback π
okay so this is the list of callbacks that get called when the ToggleButton is armed. To arm this widget, you press the active mouse button while your pointer is inside the ToggleButton. The reason for this callback is XmCR_ARM.
XmNdetailShadowThickness β¨
This one sets the thickness of the indicator shadow. The default thickness is 2 pixels, periodt. π
XmNdisarmCallback π
This is the list of callbacks that fire when ToggleButton is disarmed. To disarm it, you press and release the active mouse button while your pointer is inside the ToggleButton. This widget also gets disarmed when the user moves out of the widget and releases the mouse button while the pointer is outside the widget. The reason for this callback is XmCR_DISARM.
XmNfillOnSelect π¦
Okay so when this is set to True, it fills the indicator with the color specified in XmNselectColor and switches the top and bottom shadow colors. If it's unset, it fills the indicator with the unselect color. If it's indeterminate, it fills the indicator with half select color and half unselect color. Otherwise, it switches only the top and bottom shadow colors. The default is True only if a box type of indicator (such as a check box) is specified, or if the XmNindicatorType is a 1-of type and a toggle indicator is drawn.
If XmNfillOnSelect is True, XmNset is XmSET, and XmNindicatorOn is XmINDICATOR_NONE, then the ToggleButton's background is set to XmNselectColor. For the other XmNindicatorOn values, only the indicator is filled with XmNselectColor. π₯
XmNindeterminateInsensitivePixmap πΈ
This specifies the pixmap to be displayed as the button face when the Label XmNlableType resource is XmPIXMAP or XmPIXMAP_AND_STRING, the ToggleButton XmNset resource is XmINDETERMINATE, and the Core XmNsensitive resource is False.
XmNindeterminatePixmap π
And this one specifies the pixmap to be displayed as the button face when the Label XmNlableType resource is XmPIXMAP or XmPIXMAP_AND_STRING, the ToggleButton XmNset resource is XmINDETERMINATE, and the Core XmNsensitive resource is True. π
XmNindicatorOnβ okay so if a toggle indicator is gonna get drawn at all, this says it gets drawn over to one side of the toggle text or pixmap, and which side depends on the widget'sXmNlayoutDirectionresource. The default value isXmINDICATOR_FILL. Toggles accept the following values, bestie:XmINDICATOR_NONEβ no space is allocated for the indicator and it is not displayed. Any shadows around the entire widget are switched when the toggle is selected or unselected. β¨XmINDICATOR_BOXβ the toggle indicator is in the shape of a shadowed box. πXmINDICATOR_FILLβ if the value of theXmDisplayXmNenableToggleVisualresource isTrue, the visuals are those ofXmINDICATOR_CHECK_BOX; ifFalse, the indicator visuals are those ofXmINDICATOR_BOX.XmINDICATOR_CHECKβ the toggle indicator is in the shape of a checkmark in the foreground color. βXmINDICATOR_CHECK_BOXβ the toggle indicator is in the shape of a checkmark enclosed in a box. This is the default if theXmDisplayXmNenableToggleVisualresource is set.XmINDICATOR_CROSS_BOXβ the toggle indicator is in the shape of a cross enclosed in a box.XmINDICATOR_CROSSβ the toggle indicator is in the shape of a cross.
All ToggleButton checks and crosses should be drawn in the foreground color. periodt.
If this resource is not XmINDICATOR_NONE, it will control the appearance of the toggle visual. If XmNset is XmINDETERMINATE and XmNindicatorOn is not XmINDICATOR_NONE, this resource shows a stippled flat box. If XmNset is XmINDETERMINATE, XmNindicatorOn is XmINDICATOR_NONE, and XmNtoggleMode is XmTOGGLE_INDETERMINATE, the label and the ToggleButton are stippled with a combination of the XmNselectColor and the XmNunselectColor color, and the border is flat. π
XmNindicatorSizeβ sets the size of the indicator. If no value is specified, the size of the indicator is based on the size of the label string or pixmap. If the label string or pixmap changes, the size of the indicator is recomputed based on the size of the label string or pixmap. Once a value has been specified forXmNindicatorSize, the indicator has that size, regardless of the size of the label string or pixmap, until a new value is specified. The size of indicators inside menus may differ from those outside of menus. Note that a change in this resource may also cause a change in the values of the inherited resourcesXmNmarginTop,XmNmarginBottom, andXmNmarginLeft. π¦XmNindicatorTypeβ specifies if the indicator is a 1-of or N-of indicator. For the 1-of indicator, the value can beXmONE_OF_MANY,XmONE_OF_MANY_ROUND, orXmONE_OF_MANY_DIAMOND. For the N-of indicator, the value isXmN_OF_MANY. This value specifies only the visuals and does not enforce the behavior. When the ToggleButton is in a radio box, the default isXmONE_OF_MANY; otherwise, the default isXmN_OF_MANY. Legal values are:XmONE_OF_MANYβ when theDisplayXmNenableToggleVisualresource is set, indicators are drawn with the same appearance asXmONE_OF_MANY_ROUND; otherwise, they appear the same asXmONE_OF_MANY_DIAMOND.XmN_OF_MANYβ the indicators are drawn as specified by theXmNindicatorOnresource.XmONE_OF_MANY_ROUNDβ a shadowed circle. βXmONE_OF_MANY_DIAMONDβ a shadowed diamond. π
XmNselectColorβ lets the application specify what color fills the center of the square, diamond-shaped, or round indicator when it is set. If this color is the same as either the top or the bottom shadow color of the indicator, a one-pixel-wide margin is left between the shadows and the fill; otherwise, it is filled completely. The results of this resource depend on the value of theDisplayresourceXmNenableToggleColor. A value ofTruecauses the fill color to use theXmHIGHLIGHT_COLORcolor by default. A value ofFalsecauses the fill color to use the background color. This resource's 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. To set the background of the button toXmNselectColorwhenXmNindicatorOnisXmINDICATOR_NONE, the value ofXmNfillOnSelectmust be explicitly set toTrue.
This resource is also used as the background color when all of the following conditions are met: the button is armed in a menu, the XmNenableEtchedInMenu resource is True, the XmNindicatorOn resource is False, and the XmNfillOnSelect resource is True.
This resource can take the following values:
XmDEFAULT_SELECT_COLORβ is the same as the current dynamic default, which is a color between the background and the bottom shadow color.XmREVERSED_GROUND_COLORSβ forces the select color to the foreground color and causes the default color of any text rendered over the select color to be in the background color.XmHIGHLIGHT_COLORβ forces the fill color to use the highlight color.
XmNselectInsensitivePixmapβ specifies a pixmap used as the button face when the ToggleButton is selected, the button is insensitive, and theLabelresourceXmNlabelTypeis set toXmPIXMAPorXmPIXMAP_AND_STRING. If the ToggleButton is unselected and the button is insensitive, the pixmap inXmNlabelInsensitivePixmapis used as the button face. If no value is specified forXmNlabelInsensitivePixmap, that resource is set to the value specified forXmNselectInsensitivePixmap. πΌοΈXmNselectPixmapβ specifies the pixmap to be used as the button face whenXmNlabelTypeisXmPIXMAPorXmPIXMAP_AND_STRING, and the ToggleButton is selected. When the ToggleButton is unselected, the pixmap specified in theLabel'sXmNlabelPixmapis used. If no value is specified forXmNlabelPixmap, that resource is set to the value specified forXmNselectPixmap.XmNsetβ represents the state of the ToggleButton. A value ofXmUNSETindicates that the ToggleButton is not set. A value ofXmSETindicates that the ToggleButton is set. A value ofXmINDETERMINATEindicates that the ToggleButton is in an indeterminate state (neither set nor unset). The ToggleButton states cycle through in the order ofXmSET,XmINDETERMINATE(ifXmNtoggleModeis set toXmTOGGLE_INDETERMINATE), andXmUNSET, and then back around toXmSET. IfXmNtoggleModeis set toXmTOGGLE_BOOLEAN, then the ToggleButton states cycle through in the order ofXmSET, thenXmUNSET, and then back around toXmSET. Setting this resource sets the state of the ToggleButton. πXmNspacingβ specifies the amount of spacing between the toggle indicator and the toggle label (text or pixmap). β¨XmNtoggleModeβ specifies the mode of the ToggleButton as eitherXmTOGGLE_BOOLEANorXmTOGGLE_INDETERMINATE. TheXmTOGGLE_INDETERMINATEvalue allows theXmNsetresource to be able to accept the valuesXmINDETERMINATE,XmSET, andXmUNSET. TheXmNtoggleModeresource is forced toXmTOGGLE_BOOLEANif the toggle is in anXmRowColumnwidget whose radio behavior isXmONE_OF_MANY. InXmTOGGLE_BOOLEANmode, theXmNsetresource can only acceptXmSETandXmUNSET.XmNunselectColorβ lets the application specify what color fills the center of the square, diamond-shaped, or round indicator when it is not set. If this color is the same as either the top or the bottom shadow color of the indicator, a one-pixel-wide margin is left between the shadows and the fill; otherwise, it is filled completely. This resource's default for a color display isXmNbackground. For a monochrome display, the default is set to the background color. To set the background of the button toXmNunselectColorwhenXmNindicatorOnisXmINDICATOR_NONE, the value ofXmNfillOnSelectmust be explicitly set toTrue. This resource acts like theXmNselectColorresource, but for the case whenXmNsetisXmUNSET.XmNvalueChangedCallbackβ specifies the list of callbacks called when the ToggleButton value is changed. To change the value, press and release the active mouse button while the pointer is inside the ToggleButton. This action also causes this widget to be disarmed. For this callback, the reason isXmCR_VALUE_CHANGED. π£XmNvisibleWhenOffβ indicates that the toggle indicator is visible in the unselected state when theBooleanvalue isTrue. When the ToggleButton is in a menu, the default value isFalse. When the ToggleButton is in aRadioBox, the default value isTrue. π
𧬠Inherited Resources π§¬
ToggleButton 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 π
XmLabel Resource Set π
okay bestie, real talk β before we get to the toggle-specific stuff, your widget is walking in with a whole inherited wardrobe from XmLabel. Every single resource in the set, no skips, no cap. They're listed as Name, Class, Type, Default, and Access, and every last one of them has access CSG π
XmNacceleratorβ classXmCAccelerator, typeString, defaultNULL, accessCSGπ₯XmNacceleratorTextβ classXmCAcceleratorText, typeXmString, defaultNULL, accessCSGπ₯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, defaultdynamic, accessCSGπXmNlabelTypeβ classXmCLabelType, typeunsigned char, defaultXmSTRING, accessCSGβ¨XmNmarginBottomβ classXmCMarginBottom, typeDimension, defaultdynamic, accessCSGπXmNmarginHeightβ classXmCMarginHeight, typeDimension, default2, accessCSGπXmNmarginLeftβ classXmCMarginLeft, typeDimension, defaultdynamic, accessCSGπXmNmarginRightβ classXmCMarginRight, typeDimension, default0, accessCSGπXmNmarginTopβ classXmCMarginTop, typeDimension, defaultdynamic, accessCSGπXmNmarginWidthβ classXmCMarginWidth, typeDimension, default2, accessCSGπXmNmnemonicβ classXmCMnemonic, typeKeySym, defaultNULL, accessCSGβ¨οΈXmNmnemonicCharSetβ classXmCMnemonicCharSet, typeString, defaultXmFONTLIST_DEFAULT_TAG, accessCSGπXmNpixmapPlacementβ classXmCPixmapPlacement, typeunsigned int, defaultXmPIXMAP_LEFT, accessCSGπΈXmNpixmapTextPaddingβ classXmCSpace, typeDimension, default2, accessCSGβ¨XmNrecomputeSizeβ classXmCRecomputeSize, typeBoolean, defaultTrue, accessCSGπXmNrenderTableβ classXmCRenderTable, typeXmRenderTable, defaultdynamic, accessCSGπ§XmNstringDirectionβ classXmCStringDirection, typeXmStringDirection, defaultdynamic, accessCSGπ¦
and that's the entire XmLabel resource set, every last one, accounted for β no sneaky extras hiding in the margins, iykyk π
okay bestie, here's the XmPrimitive resource set in full β every single one, no skipping, no gatekeeping π these are the ones that come along for the ride no matter which widget you're building on top of it.
XmNbottomShadowColorβ classXmCBottomShadowColor, typePixel, default dynamic, accessCSG. the lil 3D shadow on the bottom edge, and yeah it figures itself out dynamically by default β¨XmNbottomShadowPixmapβ classXmCBottomShadowPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSG. shadow-as-a-pixmap instead of a color, and it starts out literally unspecified πXmNconvertCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessC. the callback squad for conversions,NULLuntil you say otherwiseXmNforegroundβ classXmCForeground, typePixel, default dynamic, accessCSG. the main character color of the whole widget, dynamic by default πXmNhelpCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessC. where your help requests land,NULLby defaultXmNhighlightColorβ classXmCHighlightColor, typePixel, default dynamic, accessCSG. the color of the highlight, and yes, dynamic β¨XmNhighlightOnEnterβ classXmCHighlightOnEnter, typeBoolean, defaultFalse, accessCSG. highlight when the pointer enters? default says nah,FalseπXmNhighlightPixmapβ classXmCHighlightPixmap, typePixmap, default dynamic, accessCSG. pixmap version of the highlight, dynamic defaultXmNhighlightThicknessβ classXmCHighlightThickness, typeDimension, default2, accessCSG. how chunky the highlight is, default2fr frXmNlayoutDirectionβ classXmCLayoutDirection, typeXmDirection, default dynamic, accessCG. which way everything flows, dynamic default β and bestie, notice the access isCG, notCSG?? it's the odd one out, iconic honestly πXmNnavigationTypeβ classXmCNavigationType, typeXmNavigationType, defaultXmNONE, accessCSG. how this thing plays with keyboard traversal, defaults toXmNONEXmNpopupHandlerCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessC. the popup handler callback list,NULLuntil you fill it π«ΆXmNshadowThicknessβ classXmCShadowThickness, typeDimension, default dynamic, accessCSG. how thick the shadow drama is, dynamic defaultXmNtopShadowColorβ classXmCTopShadowColor, typePixel, default dynamic, accessCSG. the top-edge shadow color, dynamic as always β¨XmNtopShadowPixmapβ classXmCTopShadowPixmap, typePixmap, default dynamic, accessCSG. top shadow but as a pixmap, dynamic defaultXmNtraversalOnβ classXmCTraversalOn, typeBoolean, defaultTrue, accessCSG. is this widget reachable by traversal? defaultTrue, periodt βXmNunitTypeβ classXmCUnitType, typeunsigned char, default dynamic, accessCSG. the unit type, typed asunsigned char, dynamic default β yeah,unsigned char, we love a chaotic type choice πXmNuserDataβ classXmCUserData, typeXtPointer, defaultNULL, accessCSG. your personal little pointer to stash whatever you want,NULLby default π
and that's the whole XmPrimitive table, no crumbs left behind π keep going, there's more where this came from π
β¨ Core Resource Set β¨
okay bestie, this is the inherited core stuff every widget gets β XmToggleButton didn't invent these, she just showed up and collected them like the icon she is π . Here's the whole roster, no skips:
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's the whole set, every single one, no crumbs left behind π«Ά
πΈ Callback Information πΈ
so when a callback fires, she hands you a pointer to this lil struct, and it's giving very informative:
typedef struct
{
int reason;
XEvent * event;
int set;
} XmToggleButtonCallbackStruct;
reasonβ spill the tea, why did the callback even get invokedeventβ points to theXEventthat triggered the callback, so you know what went downsetβ reflects the ToggleButton's state, and it's one ofXmSET(selected),XmUNSET(unselected), orXmINDETERMINATE(neither). and here's the gag bestie: the state reported is the state the ToggleButton is in after the event has been processed, not before. like, imagine a user clicks the ToggleButton to flip it from unselected to selected β in that case the ToggleButton changes the value ofsetfromXmUNSETtoXmSETbefore it ever calls the callback. so you're always seeing the post-glow version, periodt β¨
π¦ Translations π¦
XmToggleButton comes with translations inherited from Primitive, because of course she does π . on top of that, there are extra XmToggleButton translations for buttons that are not in a menu system β those get listed below.
β οΈ real talk though: altering translations in#overrideor#augmentmode is undefined. do not do it. no cap. undefined means undefined and she will not be held responsible for the chaos π
Okay so these key names? They're written in the X standard key event translation table syntax β which is literally the exact format Motif uses to say "this key β these widget actions". You get a lil overview of the format over in VirtualBindings(3), and if you want the whole thing, the X Toolkit Instrinsics Documentation is your girl. π
c<Btn1Down>:
ButtonTakeFocus()
βΌc<Btn1Down>:
Arm()
βΌc<Btn1Up>:
Select() Disarm()
<Btn2Down>:
ProcessDrag()
:<Key><osfActivate>:
PrimitiveParentActivate()
:<Key><osfCancel>:
PrimitiveParentCancel()
:<Key><osfSelect>:
ArmAndActivate()
:<Key><osfHelp>:
Help()
βΌs βΌm βΌa <Key>Return:
PrimitiveParentActivate()
βΌs βΌm βΌa <Key>space:
ArmAndActivate()
XmToggleButton also inherits its menu traversal translations from XmLabel, bestie, no cap. And there's a whole extra batch of XmToggleButton translations for ToggleButtons that live in a menu system β they're listed right here. Oh and heads up: in a Popup menu system, <Btn3> does the <Btn1> actions too. Slay. β¨
<Btn2Down>:
ProcessDrag()
c<Btn1Down>:
MenuButtonTakeFocus()
c<Btn1Up>:
MenuButtonTakeFocusUp()
βΌc<BtnDown>:
BtnDown()
βΌc<BtnUp>:
BtnUp()
:<Key><osfSelect>:
ArmAndActivate()
:<Key><osfActivate>:
ArmAndActivate()
:<Key><osfHelp>:
Help()
:<Key><osfCancel>:
MenuEscape()
βΌs βΌm βΌa <Key>Return:
ArmAndActivate()
βΌs βΌm βΌa <Key>space:
ArmAndActivate()
π¬ Action Routines π¬
The XmToggleButton action routines are, in no particular order because they're already alphabetical and I'm not gonna mess with that:
Arm()β If the button was previously unset, this action does the following: ifXmNindicatorOnisTrue, it draws the indicator shadow so that the indicator looks pressed; ifXmNfillOnSelectisTrue, it fills the indicator with the color specified byXmNselectColor. IfXmNindicatorOnisFalse, it draws the button shadow so that the button looks pressed. IfXmNlabelTypeisXmPIXMAPorXmPIXMAP_AND_STRING, theXmNselectPixmapis used as the button face. This action calls theXmNarmCallbackcallbacks.
And if the button was previously set, this action does the following: if both XmNindicatorOn and XmNvisibleWhenOff are True, it draws the indicator shadow so that the indicator looks raised; if XmNfillOnSelect is True, it fills the indicator with the background color. If XmNindicatorOn is False, it draws the button shadow so that the button looks raised. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, the XmNlabelPixmap is used as the button face. This action calls the XmNarmCallback callbacks.
ArmAndActivate()β If the ToggleButton was previously set, unsets it; if the ToggleButton was previously unset, sets it. Iconic little toggle moment, honestly.
In a menu, this action unposts all menus in the menu hierarchy. Unless the button is already armed, it calls the XmNarmCallback callbacks. This action calls the XmNvalueChangedCallback and XmNdisarmCallback callbacks.
Outside a menu, if the button was previously unset, this action does the following: if XmNindicatorOn is True, it draws the indicator shadow so that the indicator looks pressed; if XmNfillOnSelect is True, it fills the indicator with the color specified by XmNselectColor. If XmNindicatorOn is False, it draws the button shadow so that the button looks pressed. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, the XmNselectPixmap is used as the button face. This action calls the XmNarmCallback, XmNvalueChangedCallback, and XmNdisarmCallback callbacks.
Outside a menu, if the button was previously set, this action does the following: if both XmNindicatorOn and XmNvisibleWhenOff are True, it draws the indicator shadow so that the indicator looks raised; if XmNfillOnSelect is True, it fills the indicator with the background color. If XmNindicatorOn is False, it draws the button shadow so that the button looks raised. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, the XmNlabelPixmap is used as the button face. This action calls the XmNarmCallback, XmNvalueChangedCallback, and XmNdisarmCallback callbacks.
BtnDown()β This action unposts any menus posted by the ToggleButton's parent menu, disables keyboard traversal for the menu, and enables mouse traversal for the menu. It draws the shadow in the armed state and, unless the button is already armed, calls theXmNarmCallbackcallbacks.BtnUp()β This action unposts all menus in the menu hierarchy. If the ToggleButton was previously set, unsets it; if the ToggleButton was previously unset, sets it. It calls theXmNvalueChangedCallbackcallbacks and then theXmNdisarmCallbackcallbacks.ButtonTakeFocus()β Causes the ToggleButton to take keyboard focus whenCtrl<Btn1Down>is pressed, without activating the widget. Just a lil focus grab, no commitment. π«ΆDisarm()β Calls the callbacks forXmNdisarmCallback.Help()β 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. 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.MenuShellPopdownOne()β 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.
ProcessDrag()β Drags the contents of a ToggleButton label, identified whenBTransferis pressed. This action sets theXmNconvertProcof the DragContext to a function that calls theXmNconvertCallbackprocedures, possibly multiple times, for the_MOTIF_DROPselection. This action is undefined for ToggleButtons used in a menu system. π So like, don't.Select()β If the pointer is within the button, takes the following actions: If the button was previously unset, sets it; if the button was previously set, unsets it. This action calls theXmNvalueChangedCallbackcallbacks.
πΈ Additional Behavior πΈ
This widget has the following additional behavior, and it's giving main character energy:
<EnterWindow>β 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 ToggleButton is not in a menu and the cursor leaves and then reenters the ToggleButton's window while the button is pressed, this action restores the button's armed appearance.
<LeaveWindow>β 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 ToggleButton is not in a menu and the cursor leaves the ToggleButton's window while the button is pressed, this action restores the button's unarmed appearance.
π¦ Virtual Bindings π¦
Okay so the bindings for virtual keys are vendor specific β meaning every vendor does their own lil thing and we can't promise you anything. For information about bindings for virtual buttons and keys, go see VirtualBindings(3). iykyk. β¨
π RELATED π
Your reading list, bestie, go click around:
Core(3)XmCreateRadioBox(3)XmCreateToggleButton(3)XmLabel(3)XmPrimitive(3)XmRowColumn(3)XmToggleButtonGetState(3)XmToggleButtonSetState(3)XmVaCreateToggleButton(3)XmVaCreateManagedToggleButton(3)
and that's the whole page, periodt π This one lives in the XmToggleButton(library call) section β a library call page, your classic Motif reference-manual situation. Go forth and toggle, gorgeous. ππ¦π
π¦ 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