XmIconButton(3X)

πŸ“¦
version 2.3.8 Β· 3 versions
, in arch rolling, centos-stream 9, epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– XmIconButton πŸ’–

okay so bestie, welcome to the manual page for XmIconButton, and yes it lives in section 3X β€” the X/Motif corner of the universe πŸ’… buckle up, we're getting into widget lore.


🌸 NAME 🌸

The Icon Button widget πŸ‘‘


✨ SYNOPSIS ✨

This page documents the XmIconButton widget. That's it, that's the synopsis, she's lowkey self-explanatory πŸ¦‹


πŸŽ€ DESCRIPTION πŸŽ€

The Icon Button widget is a selectable area of the screen that holds both a label and a string. When the user selects this button with the OSF/Motif select button, its activateCallback gets called. ✨

This widget can also be used as a Toggle button, although it will have no indicator β€” so like, it toggles but it's not gonna show you a little checkbox, no cap πŸ™ˆ

The placement of the icon relative to the text can be modified with the iconPlacement resource. Iconic behaviour, literally.

Note: this widget takes a String as its label, not an XmString, so there's no need to use XmStringCreate to get a properly formatted string. Internationalized text is not currently supported 😭

🌈 Normal Resources 🌈

okay here's the whole lineup, resource by resource πŸ’–

  • activateCallback β€” class Callback, type Callback, initial value NULL
  • alignment β€” class Alignment, type Alignment, initial value XmALIGNMENT_BEGINNING
  • armColor β€” class ArmColor, type Pixel, initial value <dynamic>
  • doubleClickCallback β€” class Callback, type Callback, initial value NULL
  • fontList β€” class FontList, type FontList, initial value fixed
  • horizontalMargin β€” class Space, type HorizontalDimension, initial value 2
  • iconTextPadding β€” class Space, type VerticalDimension, initial value 2
  • iconPlacement β€” class IconPlacement, type IconPlacement, initial value XmIconTop
  • label β€” class Label, type String, initial value Widget name
  • labelString β€” class LabelString, type XmString, initial value Widget name
  • pixmap β€” class Pixmap, type Pixmap, initial value None
  • recomputeSize β€” class Boolean, type Boolean, initial value True
  • set β€” class Boolean, type Boolean, initial value False
  • stringDirection β€” class StringDirection, type StringDirection, initial value XmSTRING_DIRECTION_L_TO_R
  • verticalMargin β€” class Space, type VerticalDimension, initial value 2

All resource names begin with XmN and all resource class names begin with XmC. iykyk πŸ’…


activateCallback

This list of callback routines is called whenever the icon button is clicked on by the user. The format of the callback routines is specified below πŸ‘‡

armColor

This is the pixel index that describes the color to fill the widget with when it is set. 🎨

doubleClickCallback

This list of callback routines is called whenever the user double clicks on this widget. The format of the callback routines is specified below πŸ‘‡

fontList

The default font in this list is used to render the label string of the icon button. πŸ”€

horizontalMargin, verticalMargin

The amount of space to be left between the edge of the shadow and the text or pixmap displayed. The vertical and horizontal spacing can be controlled independently. 🫢

iconTextPadding

The amount of space to be left between the pixmap and the label string. πŸ–ΌοΈ

iconPlacement

The location of the pixmap (icon) with respect to the displayed text. This resource can take one of the following values: XmIconTop, XmIconBottom, XmIconLeft, XmIconRight, XmIconNone, and XmIconOnly. A type converter has been registered that converts the following strings: "top", "bottom", "left", "right", "none", and "iconOnly". ✨

If only a string is displayed in the Icon Button, this resource can be used to change the justification of the label. XmIconTop=bottom, XmIconBottom=top, XmIconRight=Left, XmIconLeft=Right, XmIconNone=Center. In order to use these options, pixmap must be set to None. 🎯

label

The string to display in this button. This string can only have one font, but can be any number of lines long. Use the NEW_LINE character ( '0 ) to separate lines. This resource has been superceded by labelString, but is included for backwards compatibility. If XmNlabelString is set, XmNlabel is ignored. πŸ’€

labelString

Specifies the compound string to be displayed in the button. If this value is NULL, the value of XmNlabel is used. If both are NULL, labelString is initialized by converting the name of the widget to a compound string. Refer to XmString(3X) in the OSD/Motif Programmers' Reference for more information on the creation and structure of compound strings. πŸ“š

pixmap

The pixmap to display. This pixmap may either be of depth one (1), or the same depth as the screen this widget is being displayed on. If the pixmap is of depth one then XCopyPlane is used to render the pixmap in the foreground and background colors. If the pixmap is not of depth one then XCopyArea is used and all the original colors of the pixmap are preserved. Unlike the Motif PushButton widget, the pixmap is automatically stippled when the Icon Button becomes insensitive. πŸ–ŒοΈ

recomputeSize

If this Boolean value is True then the icon button will ask its parent to resize it to be just large enough to contain the pixmap, label and shadows. If it is False then the icon button will not attempt a resize. πŸ“

set

This Boolean value represents the current state of the icon button. If this value is True then the icon button is set and is rendered as depressed. Otherwise it is unset and is rendered normally. 🫠

stringDirection

Specifies the direction in which the string is to be drawn. XmNSTRING_DIRECTION_L_TO_R is drawn left to right, while XmNSTRING_DIRECTION_R_TO_L is drawn right to left. The default for this resource is determined at creation time. If no value is specified for this resource and the widget's parent is a manager, the value is inherited from the parent; otherwise, it defaults to XmNSTRING_DIRECTION_L_TO_R. ↔️


πŸ¦‹ Callback Routines πŸ¦‹

Whenever the user selects the icon button, the activate callbacks will be called. Whenever the user double clicks on this widget, the first click will call the activateCallback, and if the second occurs within MultiClickTime it will call the doubleClickCallback. These callbacks have the following parameters: πŸ‘‡

void (activate_callback)(Widget w, XtPointer client_data, XtPointer
                    call_data)
  • w β€” the Icon Button widget
  • client_data β€” the client data specified by the application
  • call_data β€” a pointer to an XmIconButtonCallbackInfo structure
void (double_click_callback)(Widget w, XtPointer client_data, XtPointer
                    call_data)
  • w β€” the Icon Button widget
  • client_data β€” the client data specified by the application
  • call_data β€” a pointer to an XmIconButtonCallbackInfo structure

All procedures on the Icon Button's activateCallback and doubleClickCallback lists will have a pointer to an IconButtonCallbackInfo structure passed to them in the call_data field. This structure is defined in the Icon Button widget's public header file as follows: πŸ’–

typedef struct _XmIconButtonCallbackInfo {

     Boolean state;   /* The current state of the icon button.*/

     XEvent * event;  /* The event that caused this action.*/

} XmIconButtonCallbackInfo;
  • state β€” the current state of the icon button. When this is used as a push button (the default) the state variable will always be True.
  • event β€” the X Event that caused this action, see Translations and Actions below for details on the events that can cause these callbacks to be called.

πŸ’… Convenience Routine πŸ’…

XmCreateIconButton β€” Widget creation convenience routine ✨

Widget XmCreateIconButton(
               Widget parent,/* Widget id of parent for IconButton */
               String name, /* Name of the created widget */
               ArgList args,/* argument list */
               Cardinal num_args/* number of items in argument list */
               )

🌟 Translations and Actions 🌟

The following are the default translation bindings used by the icon button:

<Btn1Down>,<Btn1Up>:   XmToggle() XmNotify()
<Btn1Down>(2):         XmDoubleNotify()
<Btn1Down>:            XmGetFocus() XmToggle()
<Key>osfSelect:        XmArmAndActivate()
<Key>osfActivate:      XmArmAndActivate()
None<Key>space:        XmArmAndActivate()
None<Key>Return:       XmArmAndActivate()
<Btn1Down>,<Leave>     XmToggle()

The following actions are supported by the icon button:

  • XmToggle() β€” Toggles the state of the icon button.
  • XmNotify() β€” Calls all routines on activateCallback list.
  • XmDoubleNotify() β€” Calls all routines on the doubleClickCallback list.
  • XmArmAndActivated() β€” This action will arm the button, call the actions on the activateCallback list, wait a fraction of a second and then disarm the button.

To use this button as a toggle button rather than a push button, replace the default translation table with the following table:

<Btn1Down>:         XmToggle() XmNotify()
<Btn1Up>(2):        XmDoubleNotify()
<Key>osfSelect:     XmToggle() XmNotify()
<Key>osfActivate:   XmToggle() XmNotify()
None<Key>space:     XmToggle() XmNotify()
None<Key>Return:    XmToggle() XmNotify()

Copyright (c) 1992 by Integrated Computer Solutions, Inc.


and that's the whole page bestie, you ate that πŸ“ this was XmIconButton(3X) as of 15 July 1992 β€” go forth and make icon buttons that serve absolute main character energy πŸ§šπŸ’œ