1XmToggleButton(library call) XmToggleButton(library call)
2
3
4
6 XmToggleButton — The ToggleButton widget class
7
9 #include <Xm/ToggleB.h>
10
12 ToggleButton sets nontransitory state data within an application. Usu‐
13 ally this widget consists of an indicator (square, diamond, or round)
14 with either text or a pixmap on one side of it. However, it can also
15 consist of just text or a pixmap without the indicator.
16
17 The toggle graphics display a 1-of-many, N-of-many, or 1-of-many-round
18 selection state. When a toggle indicator is displayed, a square indi‐
19 cator shows an N-of-many selection state, a diamond-shaped indicator
20 shows a 1-of-many selection state, and a circle-shaped indicator shows
21 a 1-of-many-round selection state.
22
23 ToggleButton implies a set or unset state. In the case of a label and
24 an indicator, an empty indicator (square, diamond, or round) indicates
25 that ToggleButton is unset, and a filled indicator shows that it is
26 set. The indicator may be filled with a check mark, a cross, or the
27 select color. In the case of a pixmap toggle, different pixmaps are
28 used to display the set/unset states. ToggleButton can also indicate
29 an indeterminate state. In the case of a label and an indicator, an
30 indeterminate state is indicated by a stippled flat box. In the case
31 of a pixmap toggle, a different pixmap is used to display the indeter‐
32 minate state.
33
34 The default behavior associated with a ToggleButton in a menu depends
35 on the type of menu system in which it resides. By default, <Btn1>
36 controls the behavior of the ToggleButton. In addition, <Btn3> con‐
37 trols the behavior of the ToggleButton if it resides in a PopupMenu
38 system. The actual mouse button used is determined by its RowColumn
39 parent.
40
41 Label's resource XmNmarginLeft may be increased to accommodate the tog‐
42 gle indicator when it is created.
43
44 ToggleButton uses the XmQTmenuSystem and XmQTspecifyRenderTable traits.
45
46 Classes
47 ToggleButton inherits behavior, resources, and traits from Core,
48 XmPrimitive, and XmLabel.
49
50 The class pointer is xmToggleButtonWidgetClass.
51
52 The class name is XmToggleButton.
53
54 New Resources
55 The following table defines a set of widget resources used by the pro‐
56 grammer to specify data. The programmer can also set the resource val‐
57 ues for the inherited classes to set attributes for this widget. To
58 reference a resource by name or by class in a .Xdefaults file, remove
59 the XmN or XmC prefix and use the remaining letters. To specify one of
60 the defined values for a resource in a .Xdefaults file, remove the Xm
61 prefix and use the remaining letters (in either lowercase or uppercase,
62 but include any underscores between words). The codes in the access
63 column indicate if the given resource can be set at creation time (C),
64 set by using XtSetValues (S), retrieved by using XtGetValues (G), or is
65 not applicable (N/A).
66
67 ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────┐
68 │ │ XmToggleButton Res│ource Set │ │ │
69 │Name │ Class │ Type │ Default │ Access │
70 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
71 │XmNarmCallback │ XmCArmCallback │ XtCallbackList │ NULL │ C │
72 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
73 │XmNdetailShadowThickness │ XmCDetailShadowThickness │ Dimension │ 2 │ CSG │
74 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
75 │XmNdisarmCallback │ XmCDisarmCallback │ XtCallbackList │ NULL │ C │
76 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
77 │XmNfillOnSelect │ XmCFillOnSelect │ Boolean │ dynamic │ CSG │
78 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
79 │XmNindeterminatePixmap │ XmCIndeterminatePixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
80 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
81 │XmNindicatorOn │ XmCIndicatorOn │ unsigned char │ XmINDICATOR_FILL │ CSG │
82 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
83 │XmNindicatorSize │ XmCIndicatorSize │ Dimension │ dynamic │ CSG │
84 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
85 │XmNindicatorType │ XmCIndicatorType │ unsigned char │ dynamic │ CSG │
86 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
87 │XmNselectColor │ XmCSelectColor │ Pixel │ dynamic │ CSG │
88 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
89 │XmNselectInsensitivePixmap │ XmCSelectInsensitivePixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
90 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
91 │XmNselectPixmap │ XmCSelectPixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
92 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
93 │XmNset │ XmCSet │ unsigned char │ XmUNSET │ CSG │
94 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
95 │XmNspacing │ XmCSpacing │ Dimension │ 4 │ CSG │
96 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
97 │XmNtoggleMode │ XmCToggleMode │ unsigned char │ XmTOGGLE_BOOLEAN │ CSG │
98 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
99 │XmNunselectColor │ XmCUnselectColor │ Pixel │ dynamic │ CSG │
100 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
101 │XmNvalueChangedCallback │ XmCValueChangedCallback │ XtCallbackList │ NULL │ C │
102 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
103 │XmNvisibleWhenOff │ XmCVisibleWhenOff │ Boolean │ dynamic │ CSG │
104 ├───────────────────────────┼────────────────────────────┼────────────────┼──────────────────────┼────────┤
105 └───────────────────────────┴────────────────────────────┴────────────────┴──────────────────────┴────────┘
106 XmNarmCallback
107 Specifies the list of callbacks called when the ToggleButton
108 is armed. To arm this widget, press the active mouse button
109 while the pointer is inside the ToggleButton. For this call‐
110 back, the reason is XmCR_ARM.
111
112 XmNdetailShadowThickness
113 Specifies the thickness of the indicator shadow. The default
114 thickness is 2 pixels.
115
116 XmNdisarmCallback
117 Specifies the list of callbacks called when ToggleButton is
118 disarmed. To disarm this widget, press and release the
119 active mouse button while the pointer is inside the Toggle‐
120 Button. This widget is also disarmed when the user moves out
121 of the widget and releases the mouse button when the pointer
122 is outside the widget. For this callback, the reason is
123 XmCR_DISARM.
124
125 XmNfillOnSelect
126 Fills the indicator with the color specified in XmNselect‐
127 Color and switches the top and bottom shadow colors when set
128 to True. If unset, fills the indicator with the unselect
129 color. If indeterminate, fills the indicator with half select
130 color and half unselect color. Otherwise, it switches only
131 the top and bottom shadow colors. The default is True only if
132 a box type of indicator (such as a check box) is specified,
133 or if the XmNindicatorType is a 1-of type and a toggle indi‐
134 cator is drawn.
135
136 If XmNfillOnSelect is True, XmNset is XmSET, and XmNindica‐
137 torOn is XmINDICATOR_NONE the ToggleButton's background is
138 set to XmNselectColor. For the other XmNindicatorOn values,
139 only the indicator is filled with XmNselectColor.
140
141 XmNindeterminateInsensitivePixmap
142 Specifies the pixmap to be displayed as the button face when
143 the Label XmNlableType resource is XmPIXMAP or
144 XmPIXMAP_AND_STRING, the ToggleButton XmNset resource is
145 XmINDETERMINATE, and the Core XmNsensitive resource is False.
146
147 XmNindeterminatePixmap
148 Specifies the pixmap to be displayed as the button face when
149 the Label XmNlableType resource is XmPIXMAP or
150 XmPIXMAP_AND_STRING, the ToggleButton XmNset resource is
151 XmINDETERMINATE, and the Core XmNsensitive resource is True.
152
153 XmNindicatorOn
154 Specifies that if a toggle indicator is to be drawn, it will
155 be drawn to one side of the toggle text or pixmap, depending
156 on the XmNlayoutDirection resource of the widget. The default
157 value is XmINDICATOR_FILL. Toggles accept the following val‐
158 ues:
159
160 XmINDICATOR_NONE
161 No space is allocated for the indicator, and it is
162 not displayed. Any shadows around the entire widget
163 are switched when the toggle is selected or unse‐
164 lected.
165
166 XmINDICATOR_BOX
167 The toggle indicator is in the shape of a shadowed
168 box.
169
170 XmINDICATOR_FILL
171 If the value of the XmDisplay XmNenableToggleVisual
172 resource is True , the visuals are those of XmINDI‐
173 CATOR_CHECK_BOX ; if False , the indicator visuals
174 are those of XmINDICATOR_BOX.
175
176 XmINDICATOR_CHECK
177 The toggle indicator is in the shape of a checkmark
178 in the foreground color.
179
180 XmINDICATOR_CHECK_BOX
181 The toggle indicator is in the shape of a checkmark
182 enclosed in a box. This is the default if the
183 XmDisplay XmNenableToggleVisual resource is set.
184
185 XmINDICATOR_CROSS_BOX
186 The toggle indicator is in the shape of a cross
187 enclosed in a box.
188
189 XmINDICATOR_CROSS
190 The toggle indicator is in the shape of a cross.
191
192 All ToggleButton checks and crosses should be drawn in the
193 foreground color.
194
195 If this resource is not XmINDICATOR_NONE, it will control the
196 appearance of the toggle visual. If XmNset is XmINDETERMINATE
197 and XmNindicatorOn is not XmINDICATOR_NONE, this resource
198 shows a stippled flat box. If XmNset is XmINDETERMINATE,
199 XmNindicatorOn is XmINDICATOR_NONE, and XmNtoggleMode is
200 XmTOGGLE_INDETERMINATE, the label and the ToggleButton are
201 stippled with a combination of the XmNselectColor and the
202 XmNunselectColor color, and the border is flat.
203
204 XmNindicatorSize
205 Sets the size of the indicator. If no value is specified,
206 the size of the indicator is based on the size of the label
207 string or pixmap. If the label string or pixmap changes, the
208 size of the indicator is recomputed based on the size of the
209 label string or pixmap. Once a value has been specified for
210 XmNindicatorSize, the indicator has that size, regardless of
211 the size of the label string or pixmap, until a new value is
212 specified. The size of indicators inside menus may differ
213 from those outside of menus. Note that a change in this
214 resource may also cause a change in the values of the inher‐
215 ited resources XmNmarginTop, XmNmarginBottom, and XmNmargin‐
216 Left.
217
218 XmNindicatorType
219 Specifies if the indicator is a 1-of or N-of indicator. For
220 the 1-of indicator, the value can be XmONE_OF_MANY,
221 XmONE_OF_MANY_ROUND, or XmONE_OF_MANY_DIAMOND. For the N-of
222 indicator, the value is XmN_OF_MANY. This value specifies
223 only the visuals and does not enforce the behavior. When the
224 ToggleButton is in a radio box, the default is XmONE_OF_MANY;
225 otherwise, the default is XmN_OF_MANY. Legal values are:
226
227 XmONE_OF_MANY
228 When the Display XmNenableToggleVisual resource is
229 set, indicators are drawn with the same appearance
230 as XmONE_OF_MANY_ROUND; otherwise, they appear the
231 same as XmONE_OF_MANY_DIAMOND.
232
233 XmN_OF_MANY
234 The indicators are drawn as specified by the
235 XmNindicatorOn resource.
236
237 XmONE_OF_MANY_ROUND
238 A shadowed circle.
239
240 XmONE_OF_MANY_DIAMOND
241 A shadowed diamond.
242
243 XmNselectColor
244 Allows the application to specify what color fills the center
245 of the square, diamond-shaped, or round indicator when it is
246 set. If this color is the same as either the top or the bot‐
247 tom shadow color of the indicator, a one-pixel-wide margin is
248 left between the shadows and the fill; otherwise, it is
249 filled completely. The results of this resource depend on
250 the value of the Display resource XmNenableToggleColor. A
251 value of True causes the fill color to use the XmHIGH‐
252 LIGHT_COLOR color by default. A value of False causes the
253 fill color to use the background color. This resource's
254 default for a color display is a color between the background
255 and the bottom shadow color. For a monochrome display, the
256 default is set to the foreground color. To set the background
257 of the button to XmNselectColor when XmNindicatorOn is
258 XmINDICATOR_NONE, the value of XmNfillOnSelect must be
259 explicitly set to True.
260
261 This resource is also used as the background color when all
262 of the following conditions are met: the button is armed in a
263 menu, the XmNenableEtchedInMenu resource is True, the
264 XmNindicatorOn resource is False, and the XmNfillOnSelect
265 resource is True.
266
267 This resource can take the following values:
268
269 XmDEFAULT_SELECT_COLOR
270 Is the same as the current dynamic default, which
271 is a color between the background and the bottom
272 shadow color.
273
274 XmREVERSED_GROUND_COLORS
275 Forces the select color to the foreground color and
276 causes the default color of any text rendered over
277 the select color to be in the background color.
278
279 XmHIGHLIGHT_COLOR
280 Forces the fill color to use the highlight color.
281
282 XmNselectInsensitivePixmap
283 Specifies a pixmap used as the button face when the Toggle‐
284 Button is selected, the button is insensitive, and the Label
285 resource XmNlabelType is set to XmPIXMAP or
286 XmPIXMAP_AND_STRING. If the ToggleButton is unselected and
287 the button is insensitive, the pixmap in XmNlabelInsensi‐
288 tivePixmap is used as the button face. If no value is speci‐
289 fied for XmNlabelInsensitivePixmap, that resource is set to
290 the value specified for XmNselectInsensitivePixmap.
291
292 XmNselectPixmap
293 Specifies the pixmap to be used as the button face when XmN‐
294 labelType is XmPIXMAP or XmPIXMAP_AND_STRING, and the Toggle‐
295 Button is selected. When the ToggleButton is unselected, the
296 pixmap specified in the Label's XmNlabelPixmap is used. If
297 no value is specified for XmNlabelPixmap, that resource is
298 set to the value specified for XmNselectPixmap.
299
300 XmNset Represents the state of the ToggleButton. A value of XmUNSET
301 indicates that the ToggleButton is not set. A value of XmSET
302 indicates that the ToggleButton is set. A value of XmINDE‐
303 TERMINATE indicates that the ToggleButton is in an indetermi‐
304 nate state (neither set nor unset). The ToggleButton states
305 cycle through in the order of XmSET, XmINDETERMINATE (if XmN‐
306 toggleMode is set to XmTOGGLE_INDETERMINATE), and XmUNSET,
307 and then back around to XmSET. If XmNtoggleMode is set to
308 XmTOGGLE_BOOLEAN, then the ToggleButton states cycle through
309 in the order of XmSET, then XmUNSET, and then back around to
310 XmSET. Setting this resource sets the state of the Toggle‐
311 Button.
312
313 XmNspacing
314 Specifies the amount of spacing between the toggle indicator
315 and the toggle label (text or pixmap).
316
317 XmNtoggleMode
318 Specifies the mode of the ToggleButton as either XmTOG‐
319 GLE_BOOLEAN or XmTOGGLE_INDETERMINATE. The XmTOGGLE_INDETER‐
320 MINATE value allows the XmNset resource to be able to accept
321 the values XmINDETERMINATE, XmSET, and XmUNSET. The XmNtog‐
322 gleMode resource is forced to XmTOGGLE_BOOLEAN if the toggle
323 is in an XmRowColumn widget whose radio behavior is
324 XmONE_OF_MANY. In XmTOGGLE_BOOLEAN mode, the XmNset resource
325 can only accept XmSET and XmUNSET.
326
327 XmNunselectColor
328 Allows the application to specify what color fills the center
329 of the square, diamond-shaped, or round indicator when it is
330 not set. If this color is the same as either the top or the
331 bottom shadow color of the indicator, a one-pixel-wide margin
332 is left between the shadows and the fill; otherwise, it is
333 filled completely. This resource's default for a color dis‐
334 play is XmNbackground. For a monochrome display, the default
335 is set to the background color. To set the background of the
336 button to XmNunselectColor when XmNindicatorOn is XmINDICA‐
337 TOR_NONE, the value of XmNfillOnSelect must be explicitly set
338 to True. This resource acts like the XmNselectColor resource,
339 but for the case when XmNset is XmUNSET.
340
341 XmNvalueChangedCallback
342 Specifies the list of callbacks called when the ToggleButton
343 value is changed. To change the value, press and release the
344 active mouse button while the pointer is inside the Toggle‐
345 Button. This action also causes this widget to be disarmed.
346 For this callback, the reason is XmCR_VALUE_CHANGED.
347
348 XmNvisibleWhenOff
349 Indicates that the toggle indicator is visible in the unse‐
350 lected state when the Boolean value is True. When the Tog‐
351 gleButton is in a menu, the default value is False. When the
352 ToggleButton is in a RadioBox, the default value is True.
353
354 Inherited Resources
355 ToggleButton inherits behavior and resources from the superclasses
356 described in the following tables. For a complete description of each
357 resource, refer to the reference page for that superclass.
358
359 ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
360 │ │ XmLabel Res│ource Set │ │ │
361 │Name │ Class │ Type │ Default │ Access │
362 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
363 │XmNaccelerator │ XmCAccelerator │ String │ NULL │ CSG │
364 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
365 │XmNacceleratorText │ XmCAcceleratorText │ XmString │ NULL │ CSG │
366 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
367 │XmNalignment │ XmCAlignment │ unsigned char │ dynamic │ CSG │
368 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
369 │XmNfontList │ XmCFontList │ XmFontList │ dynamic │ CSG │
370 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
371 │XmNlabelInsensitivePixmap │ XmCLabelInsensitivePixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
372 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
373 │XmNlabelPixmap │ XmCLabelPixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
374 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
375 │XmNlabelString │ XmCXmString │ XmString │ dynamic │ CSG │
376 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
377 │XmNlabelType │ XmCLabelType │ unsigned char │ XmSTRING │ CSG │
378 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
379 │XmNmarginBottom │ XmCMarginBottom │ Dimension │ dynamic │ CSG │
380 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
381 │XmNmarginHeight │ XmCMarginHeight │ Dimension │ 2 │ CSG │
382 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
383 │XmNmarginLeft │ XmCMarginLeft │ Dimension │ dynamic │ CSG │
384 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
385 │XmNmarginRight │ XmCMarginRight │ Dimension │ 0 │ CSG │
386 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
387 │XmNmarginTop │ XmCMarginTop │ Dimension │ dynamic │ CSG │
388 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
389 │XmNmarginWidth │ XmCMarginWidth │ Dimension │ 2 │ CSG │
390 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
391 │XmNmnemonic │ XmCMnemonic │ KeySym │ NULL │ CSG │
392 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
393 │XmNmnemonicCharSet │ XmCMnemonicCharSet │ String │ XmFONTLIST_DEFAULT_TAG │ CSG │
394 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
395 │XmNpixmapPlacement │ XmCPixmapPlacement │ unsigned int │ XmPIXMAP_LEFT │ CSG │
396 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
397 │XmNpixmapTextPadding │ XmCSpace │ Dimension │ 2 │ CSG │
398 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
399 │XmNrecomputeSize │ XmCRecomputeSize │ Boolean │ True │ CSG │
400 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
401 │XmNrenderTable │ XmCRenderTable │ XmRenderTable │ dynamic │ CSG │
402 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
403 │XmNstringDirection │ XmCStringDirection │ XmStringDirection │ dynamic │ CSG │
404 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
405 └──────────────────────────┴───────────────────────────┴───────────────────┴────────────────────────┴────────┘
406 ┌───────────────────────────────────────────────────────────────────────────────────────────────────┐
407 │ │ XmPrimitive│Resource Set │ │ │
408 │Name │ Class │ Type │ Default │ Access │
409 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
410 │XmNbottomShadowColor │ XmCBottomShadowColor │ Pixel │ dynamic │ CSG │
411 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
412 │XmNbottomShadowPixmap │ XmCBottomShadowPixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
413 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
414 │XmNconvertCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
415 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
416 │XmNforeground │ XmCForeground │ Pixel │ dynamic │ CSG │
417 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
418 │XmNhelpCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
419 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
420 │XmNhighlightColor │ XmCHighlightColor │ Pixel │ dynamic │ CSG │
421 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
422 │XmNhighlightOnEnter │ XmCHighlightOnEnter │ Boolean │ False │ CSG │
423 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
424 │XmNhighlightPixmap │ XmCHighlightPixmap │ Pixmap │ dynamic │ CSG │
425 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
426 │XmNhighlightThickness │ XmCHighlightThickness │ Dimension │ 2 │ CSG │
427 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
428 │XmNlayoutDirection │ XmCLayoutDirection │ XmDirection │ dynamic │ CG │
429 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
430 │XmNnavigationType │ XmCNavigationType │ XmNavigationType │ XmNONE │ CSG │
431 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
432 │XmNpopupHandlerCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
433 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
434 │XmNshadowThickness │ XmCShadowThickness │ Dimension │ dynamic │ CSG │
435 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
436 │XmNtopShadowColor │ XmCTopShadowColor │ Pixel │ dynamic │ CSG │
437 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
438 │XmNtopShadowPixmap │ XmCTopShadowPixmap │ Pixmap │ dynamic │ CSG │
439 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
440 │XmNtraversalOn │ XmCTraversalOn │ Boolean │ True │ CSG │
441 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
442 │XmNunitType │ XmCUnitType │ unsigned char │ dynamic │ CSG │
443 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
444 │XmNuserData │ XmCUserData │ XtPointer │ NULL │ CSG │
445 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
446 └────────────────────────┴───────────────────────┴──────────────────┴──────────────────────┴────────┘
447 ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
448 │ │ Core Resource Se│t │ │ │
449 │Name │ Class │ Type │ Default │ Access │
450 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
451 │XmNaccelerators │ XmCAccelerators │ XtAccelerators │ dynamic │ CSG │
452 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
453 │XmNancestorSensitive │ XmCSensitive │ Boolean │ dynamic │ G │
454 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
455 │XmNbackground │ XmCBackground │ Pixel │ dynamic │ CSG │
456 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
457 │XmNbackgroundPixmap │ XmCPixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
458 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
459 │XmNborderColor │ XmCBorderColor │ Pixel │ XtDefaultForeground │ CSG │
460 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
461 │XmNborderPixmap │ XmCPixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
462 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
463 │XmNborderWidth │ XmCBorderWidth │ Dimension │ 0 │ CSG │
464 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
465 │XmNcolormap │ XmCColormap │ Colormap │ dynamic │ CG │
466 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
467 │XmNdepth │ XmCDepth │ int │ dynamic │ CG │
468 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
469 │XmNdestroyCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
470 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
471 │XmNheight │ XmCHeight │ Dimension │ dynamic │ CSG │
472 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
473 │XmNinitialResourcesPersistent │ XmCInitialResourcesPersistent │ Boolean │ True │ C │
474 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
475 │XmNmappedWhenManaged │ XmCMappedWhenManaged │ Boolean │ True │ CSG │
476 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
477 │XmNscreen │ XmCScreen │ Screen * │ dynamic │ CG │
478 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
479 │XmNsensitive │ XmCSensitive │ Boolean │ True │ CSG │
480 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
481 │XmNtranslations │ XmCTranslations │ XtTranslations │ dynamic │ CSG │
482 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
483 │XmNwidth │ XmCWidth │ Dimension │ dynamic │ CSG │
484 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
485 │XmNx │ XmCPosition │ Position │ 0 │ CSG │
486 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
487 │XmNy │ XmCPosition │ Position │ 0 │ CSG │
488 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
489 └──────────────────────────────┴───────────────────────────────┴────────────────┴──────────────────────┴────────┘
490 Callback Information
491 A pointer to the following structure is passed to each callback:
492
493 typedef struct
494 {
495 int reason;
496 XEvent * event;
497 int set;
498 } XmToggleButtonCallbackStruct;
499
500 reason Indicates why the callback was invoked
501
502 event Points to the XEvent that triggered the callback
503
504 set Reflects the ToggleButton's state, either XmSET (selected),
505 XmUNSET (unselected), or XmINDETERMINATE (neither). Note
506 that the reported state is the state that the ToggleButton is
507 in after the event has been processed. For example, suppose
508 that a user clicks on a ToggleButton to change it from the
509 unselected state to the selected state. In this case, Toggle‐
510 Button changes the value of set from XmUNSET to XmSET prior
511 to calling the callback.
512
513 Translations
514 XmToggleButton includes translations from Primitive. Additional XmTog‐
515 gleButton translations for buttons not in a menu system are described
516 in the following list.
517
518 Note that altering translations in #override or #augment mode is unde‐
519 fined.
520
521 The following key names are listed in the X standard key event transla‐
522 tion table syntax. This format is the one used by Motif to specify the
523 widget actions corresponding to a given key. A brief overview of the
524 format is provided under VirtualBindings(3). For a complete descrip‐
525 tion of the format, please refer to the X Toolkit Instrinsics Documen‐
526 tation.
527
528 c<Btn1Down>:
529 ButtonTakeFocus()
530
531 ∼c<Btn1Down>:
532 Arm()
533
534 ∼c<Btn1Up>:
535 Select() Disarm()
536
537 <Btn2Down>:
538 ProcessDrag()
539
540 :<Key><osfActivate>:
541 PrimitiveParentActivate()
542
543 :<Key><osfCancel>:
544 PrimitiveParentCancel()
545
546 :<Key><osfSelect>:
547 ArmAndActivate()
548
549 :<Key><osfHelp>:
550 Help()
551
552 ∼s ∼m ∼a <Key>Return:
553 PrimitiveParentActivate()
554
555 ∼s ∼m ∼a <Key>space:
556 ArmAndActivate()
557
558 XmToggleButton inherits menu traversal translations from XmLabel.
559 Additional XmToggleButton translations for ToggleButtons in a menu sys‐
560 tem are described in the following list. In a Popup menu system,
561 <Btn3> also performs the <Btn1> actions.
562
563 <Btn2Down>:
564 ProcessDrag()
565
566 c<Btn1Down>:
567 MenuButtonTakeFocus()
568
569 c<Btn1Up>:
570 MenuButtonTakeFocusUp()
571
572 ∼c<BtnDown>:
573 BtnDown()
574
575 ∼c<BtnUp>:
576 BtnUp()
577
578 :<Key><osfSelect>:
579 ArmAndActivate()
580
581 :<Key><osfActivate>:
582 ArmAndActivate()
583
584 :<Key><osfHelp>:
585 Help()
586
587 :<Key><osfCancel>:
588 MenuEscape()
589
590 ∼s ∼m ∼a <Key>Return:
591 ArmAndActivate()
592
593 ∼s ∼m ∼a <Key>space:
594 ArmAndActivate()
595
596 Action Routines
597 The XmToggleButton action routines are
598
599 Arm(): If the button was previously unset, this action does the fol‐
600 lowing: if XmNindicatorOn is True, it draws the indicator
601 shadow so that the indicator looks pressed; if XmNfillOnSe‐
602 lect is True, it fills the indicator with the color specified
603 by XmNselectColor. If XmNindicatorOn is False, it draws the
604 button shadow so that the button looks pressed. If XmNlabel‐
605 Type is XmPIXMAP or XmPIXMAP_AND_STRING, the XmNselectPixmap
606 is used as the button face. This action calls the XmNarm‐
607 Callback callbacks.
608
609 If the button was previously set, this action does the fol‐
610 lowing: if both XmNindicatorOn and XmNvisibleWhenOff are
611 True, it draws the indicator shadow so that the indicator
612 looks raised; if XmNfillOnSelect is True, it fills the indi‐
613 cator with the background color. If XmNindicatorOn is False,
614 it draws the button shadow so that the button looks raised.
615 If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING, the XmN‐
616 labelPixmap is used as the button face. This action calls
617 the XmNarmCallback callbacks.
618
619 ArmAndActivate():
620 If the ToggleButton was previously set, unsets it; if the
621 ToggleButton was previously unset, sets it.
622
623 In a menu, this action unposts all menus in the menu hierar‐
624 chy. Unless the button is already armed, it calls the XmN‐
625 armCallback callbacks. This action calls the XmNval‐
626 ueChangedCallback and XmNdisarmCallback callbacks.
627
628 Outside a menu, if the button was previously unset, this
629 action does the following: if XmNindicatorOn is True, it
630 draws the indicator shadow so that the indicator looks
631 pressed; if XmNfillOnSelect is True, it fills the indicator
632 with the color specified by XmNselectColor. If XmNindica‐
633 torOn is False, it draws the button shadow so that the button
634 looks pressed. If XmNlabelType is XmPIXMAP or
635 XmPIXMAP_AND_STRING, the XmNselectPixmap is used as the but‐
636 ton face. This action calls the XmNarmCallback, XmNval‐
637 ueChangedCallback, and XmNdisarmCallback callbacks.
638
639 Outside a menu, if the button was previously set, this action
640 does the following: if both XmNindicatorOn and XmNvisible‐
641 WhenOff are True, it draws the indicator shadow so that the
642 indicator looks raised; if XmNfillOnSelect is True, it fills
643 the indicator with the background color. If XmNindicatorOn
644 is False, it draws the button shadow so that the button looks
645 raised. If XmNlabelType is XmPIXMAP or XmPIXMAP_AND_STRING,
646 the XmNlabelPixmap is used as the button face. This action
647 calls the XmNarmCallback, XmNvalueChangedCallback, and
648 XmNdisarmCallback callbacks.
649
650 BtnDown():
651 This action unposts any menus posted by the ToggleButton's
652 parent menu, disables keyboard traversal for the menu, and
653 enables mouse traversal for the menu. It draws the shadow in
654 the armed state and, unless the button is already armed,
655 calls the XmNarmCallback callbacks.
656
657 BtnUp(): This action unposts all menus in the menu hierarchy. If the
658 ToggleButton was previously set, unsets it; if the ToggleBut‐
659 ton was previously unset, sets it. It calls the XmNval‐
660 ueChangedCallback callbacks and then the XmNdisarmCallback
661 callbacks.
662
663 ButtonTakeFocus():
664 Causes the ToggleButton to take keyboard focus when
665 Ctrl<Btn1Down> is pressed, without activating the widget.
666
667 Disarm(): Calls the callbacks for XmNdisarmCallback.
668
669 Help(): In a Pulldown or Popup MenuPane, unposts all menus in the
670 menu hierarchy and restores keyboard focus to the widget that
671 had the focus before the menu system was entered. Calls the
672 callbacks for XmNhelpCallback if any exist. If there are no
673 help callbacks for this widget, this action calls the help
674 callbacks for the nearest ancestor that has them.
675
676 MenuShellPopdownOne():
677 In a toplevel Pulldown MenuPane from a MenuBar, unposts the
678 menu, disarms the MenuBar CascadeButton and the MenuBar, and
679 restores keyboard focus to the widget that had the focus
680 before the MenuBar was entered. In other Pulldown MenuPanes,
681 unposts the menu.
682
683 In a Popup MenuPane, unposts the menu and restores keyboard
684 focus to the widget from which the menu was posted.
685
686 ProcessDrag():
687 Drags the contents of a ToggleButton label, identified when
688 BTransfer is pressed. This action sets the XmNconvertProc of
689 the DragContext to a function that calls the XmNconvertCall‐
690 back procedures, possibly multiple times, for the _MOTIF_DROP
691 selection. This action is undefined for ToggleButtons used
692 in a menu system.
693
694 Select(): If the pointer is within the button, takes the following
695 actions: If the button was previously unset, sets it; if the
696 button was previously set, unsets it. This action calls the
697 XmNvalueChangedCallback callbacks.
698
699 Additional Behavior
700 This widget has the following additional behavior:
701
702 <EnterWindow>:
703 In a menu, if keyboard traversal is enabled, this action does
704 nothing. Otherwise, it draws the shadow in the armed state
705 and calls the XmNarmCallback callbacks.
706
707 If the ToggleButton is not in a menu and the cursor leaves
708 and then reenters the ToggleButton's window while the button
709 is pressed, this action restores the button's armed appear‐
710 ance.
711
712 <LeaveWindow>:
713 In a menu, if keyboard traversal is enabled, this action does
714 nothing. Otherwise, it draws the shadow in the unarmed state
715 and calls the XmNdisarmCallback callbacks.
716
717 If the ToggleButton is not in a menu and the cursor leaves
718 the ToggleButton's window while the button is pressed, this
719 action restores the button's unarmed appearance.
720
721 Virtual Bindings
722 The bindings for virtual keys are vendor specific. For information
723 about bindings for virtual buttons and keys, see VirtualBindings(3).
724
726 Core(3), XmCreateRadioBox(3), XmCreateToggleButton(3), XmLabel(3),
727 XmPrimitive(3), XmRowColumn(3), XmToggleButtonGetState(3), XmToggleBut‐
728 tonSetState(3), XmVaCreateToggleButton(3), XmVaCreateManagedToggleBut‐
729 ton(3).
730
731
732
733 XmToggleButton(library call)