1XmDrawnButton(library call) XmDrawnButton(library call)
2
3
4
6 XmDrawnButton — The DrawnButton widget class
7
9 #include <Xm/DrawnB.h>
10
12 The DrawnButton widget consists of an empty widget window surrounded by
13 a shadow border. It provides the application developer with a graphics
14 area that can have PushButton input semantics.
15
16 Callback types are defined for widget exposure and widget resize to
17 allow the application to redraw or reposition its graphics. If the
18 DrawnButton widget has a highlight and shadow thickness, the applica‐
19 tion should not draw in that area. To avoid drawing in the highlight
20 and shadow area, create the graphics context with a clipping rectangle
21 for drawing in the widget. The clipping rectangle should take into
22 account the size of the widget's highlight thickness and shadow.
23 DrawnButton uses the XmQTmenuSystem and XmQTspecifyRenderTable traits,
24 and holds the XmQTactivatable trait.
25
26 Classes
27 DrawnButton inherits behavior, resources, and traits from the Core,
28 Primitive, and XmLabel classes.
29
30 The class pointer is xmDrawnButtonWidgetClass.
31
32 The class name is XmDrawnButton.
33
34 New Resources
35 The following table defines a set of widget resources used by the pro‐
36 grammer to specify data. The programmer can also set the resource val‐
37 ues for the inherited classes to set attributes for this widget. To
38 reference a resource by name or by class in a .Xdefaults file, remove
39 the XmN or XmC prefix and use the remaining letters. To specify one of
40 the defined values for a resource in a .Xdefaults file, remove the Xm
41 prefix and use the remaining letters (in either lowercase or uppercase,
42 but include any underscores between words). The codes in the access
43 column indicate if the given resource can be set at creation time (C),
44 set by using XtSetValues (S), retrieved by using XtGetValues (G), or is
45 not applicable (N/A).
46
47 ┌───────────────────────────────────────────────────────────────────────────────────────────┐
48 │ │ XmDrawnButto│n Resource Set │ │ │
49 │Name │ Class │ Type │ Default │ Access │
50 ├─────────────────────┼──────────────────────┼────────────────┼────────────────────┼────────┤
51 │XmNactivateCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
52 ├─────────────────────┼──────────────────────┼────────────────┼────────────────────┼────────┤
53 │XmNarmCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
54 ├─────────────────────┼──────────────────────┼────────────────┼────────────────────┼────────┤
55 │XmNdisarmCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
56 ├─────────────────────┼──────────────────────┼────────────────┼────────────────────┼────────┤
57 │XmNexposeCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
58 ├─────────────────────┼──────────────────────┼────────────────┼────────────────────┼────────┤
59 │XmNmultiClick │ XmCMultiClick │ unsigned char │ dynamic │ CSG │
60 ├─────────────────────┼──────────────────────┼────────────────┼────────────────────┼────────┤
61 │XmNpushButtonEnabled │ XmCPushButtonEnabled │ Boolean │ False │ CSG │
62 ├─────────────────────┼──────────────────────┼────────────────┼────────────────────┼────────┤
63 │XmNresizeCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
64 ├─────────────────────┼──────────────────────┼────────────────┼────────────────────┼────────┤
65 │XmNshadowType │ XmCShadowType │ unsigned char │ XmSHADOW_ETCHED_IN │ CSG │
66 ├─────────────────────┼──────────────────────┼────────────────┼────────────────────┼────────┤
67 └─────────────────────┴──────────────────────┴────────────────┴────────────────────┴────────┘
68 XmNactivateCallback
69 Specifies the list of callbacks that is called when the wid‐
70 get becomes selected. The reason sent by the callback is
71 XmCR_ACTIVATE. This callback uses the XmQTactivatable trait.
72
73 XmNarmCallback
74 Specifies the list of callbacks that is called when the wid‐
75 get becomes armed. The reason sent by the callback is
76 XmCR_ARM.
77
78 XmNdisarmCallback
79 Specifies the list of callbacks that is called when the wid‐
80 get becomes disarmed. The reason sent by the callback is
81 XmCR_DISARM.
82
83 XmNexposeCallback
84 Specifies the list of callbacks that is called when the wid‐
85 get receives an exposure event. The reason sent by the call‐
86 back is XmCR_EXPOSE.
87
88 XmNmultiClick
89 If a button click is followed by another button click within
90 the time span specified by the display's multiclick time, and
91 this resource is set to XmMULTICLICK_DISCARD, the second
92 click is not processed. If this resource is set to XmMUL‐
93 TICLICK_KEEP, the event is processed and click_count is
94 incremented in the callback structure. When the button is
95 not in a menu, the default value is XmMULTICLICK_KEEP.
96
97 XmNpushButtonEnabled
98 Enables or disables the 3-dimensional shadow drawing as in
99 PushButton.
100
101 XmNresizeCallback
102 Specifies the list of callbacks that is called when the wid‐
103 get receives a resize event. The reason sent by the callback
104 is XmCR_RESIZE. The event returned for this callback is NULL.
105
106 XmNshadowType
107 Describes the drawing style for the DrawnButton. This
108 resource can have the following values:
109
110 XmSHADOW_IN
111 Draws the DrawnButton so that the shadow appears
112 inset. This means that the bottom shadow visuals
113 and top shadow visuals are reversed.
114
115 XmSHADOW_OUT
116 Draws the DrawnButton so that the shadow appears
117 outset.
118
119 XmSHADOW_ETCHED_IN
120 Draws the DrawnButton using a double line. This
121 gives the effect of a line etched into the window.
122 The thickness of the double line is equal to the
123 value of XmNshadowThickness.
124
125 XmSHADOW_ETCHED_OUT
126 Draws the DrawnButton using a double line. This
127 gives the effect of a line coming out of the win‐
128 dow. The thickness of the double line is equal to
129 the value of XmNshadowThickness.
130
131 Inherited Resources
132 DrawnButton inherits behavior and resources from the superclasses
133 described in the following tables. For a complete description of each
134 resource, refer to the reference page for that superclass.
135
136 ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
137 │ │ XmLabel Res│ource Set │ │ │
138 │Name │ Class │ Type │ Default │ Access │
139 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
140 │XmNaccelerator │ XmCAccelerator │ String │ NULL │ N/A │
141 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
142 │XmNacceleratorText │ XmCAcceleratorText │ XmString │ NULL │ N/A │
143 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
144 │XmNalignment │ XmCAlignment │ unsigned char │ dynamic │ CSG │
145 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
146 │XmNfontList │ XmCFontList │ XmFontList │ dynamic │ CSG │
147 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
148 │XmNlabelInsensitivePixmap │ XmCLabelInsensitivePixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
149 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
150 │XmNlabelPixmap │ XmCLabelPixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
151 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
152 │XmNlabelString │ XmCXmString │ XmString │ "\0" │ CSG │
153 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
154 │XmNlabelType │ XmCLabelType │ unsigned char │ XmSTRING │ CSG │
155 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
156 │XmNmarginBottom │ XmCMarginBottom │ Dimension │ 0 │ CSG │
157 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
158 │XmNmarginHeight │ XmCMarginHeight │ Dimension │ 2 │ CSG │
159 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
160 │XmNmarginLeft │ XmCMarginLeft │ Dimension │ 0 │ CSG │
161 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
162 │XmNmarginRight │ XmCMarginRight │ Dimension │ 0 │ CSG │
163 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
164 │XmNmarginTop │ XmCMarginTop │ Dimension │ 0 │ CSG │
165 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
166 │XmNmarginWidth │ XmCMarginWidth │ Dimension │ 2 │ CSG │
167 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
168 │XmNmnemonic │ XmCMnemonic │ KeySym │ NULL │ N/A │
169 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
170 │XmNmnemonicCharSet │ XmCMnemonicCharSet │ String │ XmFONTLIST_DEFAULT_TAG │ N/A │
171 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
172 │XmNrecomputeSize │ XmCRecomputeSize │ Boolean │ True │ CSG │
173 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
174 │XmNrenderTable │ XmCRenderTable │ XmRenderTable │ dynamic │ CSG │
175 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
176 │XmNstringDirection │ XmCStringDirection │ XmStringDirection │ dynamic │ CSG │
177 ├──────────────────────────┼───────────────────────────┼───────────────────┼────────────────────────┼────────┤
178 └──────────────────────────┴───────────────────────────┴───────────────────┴────────────────────────┴────────┘
179 ┌───────────────────────────────────────────────────────────────────────────────────────────────────┐
180 │ │ XmPrimitive│Resource Set │ │ │
181 │Name │ Class │ Type │ Default │ Access │
182 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
183 │XmNbottomShadowColor │ XmCBottomShadowColor │ Pixel │ dynamic │ CSG │
184 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
185 │XmNbottomShadowPixmap │ XmCBottomShadowPixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
186 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
187 │XmNconvertCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
188 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
189 │XmNforeground │ XmCForeground │ Pixel │ dynamic │ CSG │
190 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
191 │XmNhelpCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
192 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
193 │XmNhighlightColor │ XmCHighlightColor │ Pixel │ dynamic │ CSG │
194 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
195 │XmNhighlightOnEnter │ XmCHighlightOnEnter │ Boolean │ False │ CSG │
196 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
197 │XmNhighlightPixmap │ XmCHighlightPixmap │ Pixmap │ dynamic │ CSG │
198 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
199 │XmNhighlightThickness │ XmCHighlightThickness │ Dimension │ 2 │ CSG │
200 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
201 │XmNlayoutDirection │ XmCLayoutDirection │ XmDirection │ dynamic │ CG │
202 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
203 │XmNnavigationType │ XmCNavigationType │ XmNavigationType │ XmNONE │ CSG │
204 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
205 │XmNpopupHandlerCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
206 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
207 │XmNshadowThickness │ XmCShadowThickness │ Dimension │ 2 │ CSG │
208 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
209 │XmNtopShadowColor │ XmCTopShadowColor │ Pixel │ dynamic │ CSG │
210 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
211 │XmNtopShadowPixmap │ XmCTopShadowPixmap │ Pixmap │ dynamic │ CSG │
212 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
213 │XmNtraversalOn │ XmCTraversalOn │ Boolean │ True │ CSG │
214 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
215 │XmNunitType │ XmCUnitType │ unsigned char │ dynamic │ CSG │
216 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
217 │XmNuserData │ XmCUserData │ XtPointer │ NULL │ CSG │
218 ├────────────────────────┼───────────────────────┼──────────────────┼──────────────────────┼────────┤
219 └────────────────────────┴───────────────────────┴──────────────────┴──────────────────────┴────────┘
220 ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
221 │ │ Core Resource Se│t │ │ │
222 │Name │ Class │ Type │ Default │ Access │
223 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
224 │XmNaccelerators │ XmCAccelerators │ XtAccelerators │ dynamic │ CSG │
225 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
226 │XmNancestorSensitive │ XmCSensitive │ Boolean │ dynamic │ G │
227 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
228 │XmNbackground │ XmCBackground │ Pixel │ dynamic │ CSG │
229 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
230 │XmNbackgroundPixmap │ XmCPixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
231 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
232 │XmNborderColor │ XmCBorderColor │ Pixel │ XtDefaultForeground │ CSG │
233 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
234 │XmNborderPixmap │ XmCPixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
235 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
236 │XmNborderWidth │ XmCBorderWidth │ Dimension │ 0 │ CSG │
237 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
238 │XmNcolormap │ XmCColormap │ Colormap │ dynamic │ CG │
239 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
240 │XmNdepth │ XmCDepth │ int │ dynamic │ CG │
241 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
242 │XmNdestroyCallback │ XmCCallback │ XtCallbackList │ NULL │ C │
243 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
244 │XmNheight │ XmCHeight │ Dimension │ dynamic │ CSG │
245 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
246 │XmNinitialResourcesPersistent │ XmCInitialResourcesPersistent │ Boolean │ True │ C │
247 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
248 │XmNmappedWhenManaged │ XmCMappedWhenManaged │ Boolean │ True │ CSG │
249 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
250 │XmNscreen │ XmCScreen │ Screen * │ dynamic │ CG │
251 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
252 │XmNsensitive │ XmCSensitive │ Boolean │ True │ CSG │
253 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
254 │XmNtranslations │ XmCTranslations │ XtTranslations │ dynamic │ CSG │
255 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
256 │XmNwidth │ XmCWidth │ Dimension │ dynamic │ CSG │
257 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
258 │XmNx │ XmCPosition │ Position │ 0 │ CSG │
259 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
260 │XmNy │ XmCPosition │ Position │ 0 │ CSG │
261 ├──────────────────────────────┼───────────────────────────────┼────────────────┼──────────────────────┼────────┤
262 └──────────────────────────────┴───────────────────────────────┴────────────────┴──────────────────────┴────────┘
263 Callback Information
264 A pointer to the following structure is passed to each callback:
265
266 typedef struct
267 {
268 int reason;
269 XEvent * event;
270 Window window;
271 int click_count;
272 } XmDrawnButtonCallbackStruct;
273
274 reason Indicates why the callback was invoked.
275
276 event Points to the XEvent that triggered the callback. This is
277 NULL for XmNresizeCallback.
278
279 window Is set to the window ID in which the event occurred.
280
281 click_count
282 Contains the number of clicks in the last multiclick sequence
283 if the XmNmultiClick resource is set to XmMULTICLICK_KEEP,
284 otherwise it contains 1. The activate callback is invoked
285 for each click if XmNmultiClick is set to XmMULTICLICK_KEEP.
286
287 Translations
288 XmDrawnButton includes translations from Primitive. Additional
289 XmDrawnButton translations are described in the following list. The
290 following key names are listed in the X standard key event translation
291 table syntax. This format is the one used by Motif to specify the wid‐
292 get actions corresponding to a given key. A brief overview of the for‐
293 mat is provided under VirtualBindings(3). For a complete description
294 of the format, please refer to the X Toolkit Instrinsics Documentation.
295
296 c<Btn1Down>:
297 ButtonTakeFocus()
298
299 ∼c<Btn1Down>:
300 Arm()
301
302 ∼c<Btn1Down>,∼c<Btn1Up>:
303 Activate() Disarm()
304
305 ∼c<Btn1Down>(2+):
306 MultiArm()
307
308 ∼c<Btn1Up>(2+):
309 MultiActivate()
310
311 ∼c<Btn1Up>:
312 Activate() Disarm()
313
314 :<Key><osfActivate>:
315 PrimitiveParentActivate()
316
317 :<Key><osfCancel>:
318 PrimitiveParentCancel()
319
320 :<Key><osfSelect>:
321 ArmAndActivate()
322
323 :<Key><osfHelp>:
324 Help()
325
326 ∼s ∼m ∼a <Key>Return:
327 PrimitiveParentActivate()
328
329 ∼s ∼m ∼a <Key>space:
330 ArmAndActivate()
331
332 Action Routines
333 The XmDrawnButton action routines are
334
335 Activate():
336 If XmNpushButtonEnabled is True, redraws the shadow in the
337 unselected state; otherwise, redraws the shadow according to
338 XmNshadowType. If the pointer is within the DrawnButton,
339 calls the XmNactivateCallback callbacks.
340
341 Arm(): If XmNpushButtonEnabled is True, redraws the shadow in the
342 selected state; otherwise, redraws the shadow according to
343 XmNshadowType. Calls the callbacks for XmNarmCallback.
344
345 ArmAndActivate():
346 If XmNpushButtonEnabled is True, redraws the shadow in the
347 selected state; otherwise, redraws the shadow according to
348 XmNshadowType. Calls the callbacks for XmNarmCallback.
349
350 If XmNpushButtonEnabled is True, the shadow is redrawn in the
351 unselected state; otherwise, the shadow is redrawn according
352 to XmNshadowType. The callbacks for XmNactivateCallback and
353 XmNdisarmCallback are called. These actions happen either
354 immediately or at a later time.
355
356 ButtonTakeFocus():
357 Causes the PushButton to take keyboard focus when
358 Ctrl<Btn1Down> is pressed, without activating the widget.
359
360 Disarm(): Marks the DrawnButton as unselected and calls the callbacks
361 for XmNdisarmCallback.
362
363 Help(): Calls the callbacks for XmNhelpCallback if any exist. If
364 there are no help callbacks for this widget, this action
365 calls the help callbacks for the nearest ancestor that has
366 them.
367
368 MultiActivate():
369 If XmNmultiClick is XmMULTICLICK_DISCARD, this action does
370 nothing.
371
372 If XmNmultiClick is XmMULTICLICK_KEEP, this action increments
373 click_count in the callback structure. If XmNpushButtonEn‐
374 abled is True, this action redraws the shadow in the unse‐
375 lected state; otherwise, it redraws the shadow according to
376 XmNshadowType. If the pointer is within the DrawnButton,
377 this action calls the XmNactivateCallback callbacks and calls
378 the callbacks for XmNdisarmCallback.
379
380 MultiArm():
381 If XmNmultiClick is XmMULTICLICK_DISCARD, this action does
382 nothing.
383
384 If XmNmultiClick is XmMULTICLICK_KEEP and if XmNpushButtonEn‐
385 abled is True, this action redraws the shadow in the selected
386 state; otherwise, it redraws the shadow according to XmNshad‐
387 owType and calls the callbacks for XmNarmCallback.
388
389 Additional Behavior
390 This widget has the following additional behavior:
391
392 <EnterWindow>:
393 Draws the shadow in its selected state if XmNpushButtonEn‐
394 abled is True and if the cursor leaves and re-enters the win‐
395 dow while BSelect is pressed.
396
397 <LeaveWindow>:
398 Draws the shadow in its unselected state if XmNpushButtonEn‐
399 abled is True and if the cursor leaves the window while BSe‐
400 lect is pressed.
401
402 Virtual Bindings
403 The bindings for virtual keys are vendor specific. For information
404 about bindings for virtual buttons and keys, see VirtualBindings(3).
405
407 Core(3), XmCreateDrawnButton, XmLabel(3), XmPrimitive(3), XmPushButton,
408 XmSeparator(3), XmVaCreateDrawnButton, XmVaCreateManagedDrawnButton.
409
410
411
412 XmDrawnButton(library call)