1 | #include <X11/Wc/COPY.h> |
---|
2 | |
---|
3 | /* |
---|
4 | * SCCS_data: %Z% %M% %I% %E% %U% |
---|
5 | * |
---|
6 | * Widget Creation Library - WcActCB.c - Actions and Callbacks |
---|
7 | * |
---|
8 | * Wcl provides equivalent callbacks and actions for many typical application |
---|
9 | * behaviors. These callbacks and actions take string arguments. If the |
---|
10 | * arguments consist as whitespace or comma separated words, then it is |
---|
11 | * easier to implement the behavior as an XtActionProc. If the arguments |
---|
12 | * need to be parsed according to more complex rules, then they are implemented |
---|
13 | * as callbacks. |
---|
14 | * |
---|
15 | ******************************************************************************* |
---|
16 | */ |
---|
17 | |
---|
18 | #ifdef WC_HAS_dlopen_AND_dlsym |
---|
19 | #include <dlfcn.h> |
---|
20 | #endif |
---|
21 | |
---|
22 | #include <X11/IntrinsicP.h> |
---|
23 | |
---|
24 | #ifdef sun |
---|
25 | #include <X11/ObjectP.h> /* why don't they just use X from mit!?! */ |
---|
26 | #include <X11/RectObjP.h> |
---|
27 | #endif |
---|
28 | |
---|
29 | #include <X11/ShellP.h> |
---|
30 | #include <X11/Wc/WcCreateP.h> |
---|
31 | #include <X11/StringDefs.h> |
---|
32 | |
---|
33 | /* |
---|
34 | ******************************************************************************* |
---|
35 | * Actions Utilities |
---|
36 | ******************************************************************************* |
---|
37 | */ |
---|
38 | |
---|
39 | /* -- Invoke XtFunctions using params as widget names |
---|
40 | ******************************************************************************* |
---|
41 | Many actions are simple wrappers around Xt functions. These utilities |
---|
42 | make writing such wrapper actions trivial. |
---|
43 | */ |
---|
44 | |
---|
45 | #define CAN_BE_GADGET 0 |
---|
46 | #define MUST_BE_WIDGET 1 |
---|
47 | #define MUST_BE_SHELL 2 |
---|
48 | |
---|
49 | typedef void (*PFVWidget) _((Widget)); |
---|
50 | |
---|
51 | static void WcxActProcWidget( reqType, caller, w, params, num_params, Proc ) |
---|
52 | int reqType; /* some things only work for widgets */ |
---|
53 | char* caller; /* action invoked by translation mgr */ |
---|
54 | Widget w; /* action invoked on this widget */ |
---|
55 | char** params; /* action arguments */ |
---|
56 | Cardinal* num_params; /* count of params */ |
---|
57 | PFVWidget Proc; /* the procedure to be invoked */ |
---|
58 | { |
---|
59 | int i; |
---|
60 | for ( i = 0 ; i < *num_params ; i++ ) |
---|
61 | { |
---|
62 | Widget target = WcFullNameToWidget( w, params[i] ); |
---|
63 | if ( target ) |
---|
64 | { |
---|
65 | if ( reqType == CAN_BE_GADGET |
---|
66 | || ( reqType == MUST_BE_WIDGET && XtIsWidget(target) ) |
---|
67 | || ( reqType == MUST_BE_SHELL && XtIsShell( target) ) ) |
---|
68 | { |
---|
69 | Proc( target ); |
---|
70 | } |
---|
71 | else |
---|
72 | { |
---|
73 | if ( reqType == MUST_BE_WIDGET ) |
---|
74 | { |
---|
75 | WcWARN2( w, caller, "mustBeWidget", |
---|
76 | "Wcl Warning: %s(%s) - Must be a Widget", |
---|
77 | caller, params[i] ); |
---|
78 | } |
---|
79 | else |
---|
80 | { |
---|
81 | WcWARN2( w, caller, "mustBeShell", |
---|
82 | "Wcl Warning: %s(%s) - Must be a Shell widget", |
---|
83 | caller, params[i] ); |
---|
84 | } |
---|
85 | } |
---|
86 | } |
---|
87 | else |
---|
88 | { |
---|
89 | WcWARN2( w, caller, "notFound", |
---|
90 | "Wcl Warning: %s(%s) - Widget not found", |
---|
91 | caller, params[i] ); |
---|
92 | } |
---|
93 | } |
---|
94 | } |
---|
95 | |
---|
96 | /* -- For invoking XtSomething( widget, int ) |
---|
97 | ******************************************************************************* |
---|
98 | For example, XtPopup, XtSetSensitive, ... |
---|
99 | */ |
---|
100 | |
---|
101 | typedef void (*PFVWidInt) _((Widget,int)); |
---|
102 | |
---|
103 | static void WcxActProcWidgetInt( reqType, caller, w, params, num_params, |
---|
104 | Proc, arg ) |
---|
105 | int reqType; |
---|
106 | char* caller; |
---|
107 | Widget w; |
---|
108 | char** params; |
---|
109 | Cardinal* num_params; |
---|
110 | PFVWidInt Proc; |
---|
111 | int arg; /* arg reqd by Proc */ |
---|
112 | { |
---|
113 | int i; |
---|
114 | for ( i = 0 ; i < *num_params ; i++ ) |
---|
115 | { |
---|
116 | Widget target = WcFullNameToWidget( w, params[i] ); |
---|
117 | if ( target ) |
---|
118 | { |
---|
119 | if ( reqType == CAN_BE_GADGET |
---|
120 | || ( reqType == MUST_BE_WIDGET && XtIsWidget(target) ) |
---|
121 | || ( reqType == MUST_BE_SHELL && XtIsShell( target) ) ) |
---|
122 | { |
---|
123 | Proc( target, arg ); |
---|
124 | } |
---|
125 | else |
---|
126 | { |
---|
127 | if ( reqType == MUST_BE_WIDGET ) |
---|
128 | { |
---|
129 | WcWARN2( w, caller, "mustBeWidget", |
---|
130 | "Wcl Warning: %s(%s) - Must be a Widget", |
---|
131 | caller, params[i] ); |
---|
132 | } |
---|
133 | else |
---|
134 | { |
---|
135 | WcWARN2( w, caller, "mustBeShell", |
---|
136 | "Wcl Warning: %s(%s) - Must be a Shell widget", |
---|
137 | caller, params[i] ); |
---|
138 | } |
---|
139 | } |
---|
140 | } |
---|
141 | else |
---|
142 | { |
---|
143 | WcWARN2( w, caller, "notFound", |
---|
144 | "Wcl Warning: %s(%s) - Widget not found", |
---|
145 | caller, params[i] ); |
---|
146 | } |
---|
147 | } |
---|
148 | } |
---|
149 | |
---|
150 | /* |
---|
151 | ******************************************************************************* |
---|
152 | * Actions which actually do something (equivalent CB invokes the ACT) |
---|
153 | ******************************************************************************* |
---|
154 | */ |
---|
155 | |
---|
156 | #define ACTION_DECL(name) \ |
---|
157 | void name( w, unused, params, num_params ) \ |
---|
158 | Widget w; \ |
---|
159 | XEvent* unused; \ |
---|
160 | char** params; \ |
---|
161 | Cardinal* num_params; |
---|
162 | |
---|
163 | |
---|
164 | /* -- Manage or Unmanage Widgets |
---|
165 | ******************************************************************************* |
---|
166 | WcManage( widget [, widget] ... ) |
---|
167 | WcUnmanage( widget [, widget] ... ) |
---|
168 | */ |
---|
169 | #ifdef XtManageChild |
---|
170 | #undef XtManageChild |
---|
171 | #endif |
---|
172 | |
---|
173 | /*ARGSUSED*/ |
---|
174 | ACTION_DECL( WcManageACT ) |
---|
175 | { |
---|
176 | WcxActProcWidget( CAN_BE_GADGET, "WcManage", w, params, num_params, |
---|
177 | XtManageChild ); |
---|
178 | } |
---|
179 | |
---|
180 | #ifdef XtUnmanageChild |
---|
181 | #undef XtUnmanageChild |
---|
182 | #endif |
---|
183 | |
---|
184 | /*ARGSUSED*/ |
---|
185 | ACTION_DECL( WcUnmanageACT ) |
---|
186 | { |
---|
187 | WcxActProcWidget( CAN_BE_GADGET, "WcUnmanage", w, params, num_params, |
---|
188 | XtUnmanageChild ); |
---|
189 | } |
---|
190 | |
---|
191 | /* -- Manage or unamange named children |
---|
192 | ******************************************************************************* |
---|
193 | WcManageChildren( parent, child [, child] ... ) |
---|
194 | WcUnmanageChildren( parent, child [, child] ... ) |
---|
195 | */ |
---|
196 | |
---|
197 | typedef void (*PFVWidsCard) _((WidgetList,Cardinal)); |
---|
198 | |
---|
199 | static void WcxChgMan( caller, Proc, w, params, num_params ) |
---|
200 | char* caller; |
---|
201 | PFVWidsCard Proc; |
---|
202 | Widget w; |
---|
203 | char** params; |
---|
204 | Cardinal* num_params; |
---|
205 | { |
---|
206 | Widget parent; |
---|
207 | Widget children[MAX_CHILDREN]; |
---|
208 | int i; |
---|
209 | |
---|
210 | if (*num_params < 2) |
---|
211 | { |
---|
212 | WcWARN1( w, caller, "usage", |
---|
213 | "Wcl Usage: %s( parent, child [, child] ... )", caller ); |
---|
214 | return; |
---|
215 | } |
---|
216 | |
---|
217 | if ( NULL == (parent = WcFullNameToWidget( w, *params )) ) |
---|
218 | { |
---|
219 | WcWARN2( w, caller, "parentNotFound", |
---|
220 | "Wcl Warning: %s( %s, ... ) - parent not found", |
---|
221 | caller, *params ); |
---|
222 | return; |
---|
223 | } |
---|
224 | |
---|
225 | for ( i = 1 ; i < *num_params ; i++ ) |
---|
226 | { |
---|
227 | if ( NULL == (children[i-1] = WcChildNameToWidget( parent, params[i] ))) |
---|
228 | { |
---|
229 | WcWARN2( w, caller, "childNotFound", |
---|
230 | "Wcl Warning: %s() - child %s not found", caller, params[i] ); |
---|
231 | return; |
---|
232 | } |
---|
233 | } |
---|
234 | Proc( children, *num_params-1 ); |
---|
235 | } |
---|
236 | |
---|
237 | #ifdef XtManageChildren |
---|
238 | #undef XtManageChildren |
---|
239 | #endif |
---|
240 | |
---|
241 | /*ARGSUSED*/ |
---|
242 | ACTION_DECL( WcManageChildrenACT ) |
---|
243 | { |
---|
244 | WcxChgMan( "WcManageChildren", XtManageChildren, w, params, num_params ); |
---|
245 | } |
---|
246 | |
---|
247 | #ifdef XtUnmanageChildren |
---|
248 | #undef XtUnmanageChildren |
---|
249 | #endif |
---|
250 | |
---|
251 | /*ARGSUSED*/ |
---|
252 | ACTION_DECL( WcUnmanageChildrenACT ) |
---|
253 | { |
---|
254 | WcxChgMan( "WcUnmanageChildren", XtUnmanageChildren, w, params, num_params); |
---|
255 | } |
---|
256 | |
---|
257 | /* -- Destroy named children |
---|
258 | ******************************************************************************* |
---|
259 | WcDestroy( name [, name] ... ) |
---|
260 | */ |
---|
261 | |
---|
262 | #ifdef XtDestroyWidget |
---|
263 | #undef XtDestroyWidget |
---|
264 | #endif |
---|
265 | |
---|
266 | /*ARGSUSED*/ |
---|
267 | ACTION_DECL( WcDestroyACT ) |
---|
268 | { |
---|
269 | WcxActProcWidget( CAN_BE_GADGET, "WcDestroy", w, params, num_params, |
---|
270 | XtDestroyWidget ); |
---|
271 | } |
---|
272 | |
---|
273 | /* -- Change sensitivity of widgets |
---|
274 | ******************************************************************************* |
---|
275 | WcSetSensitive( name [, name] ... ) |
---|
276 | WcSetInsensitive( name [, name] ... ) |
---|
277 | */ |
---|
278 | |
---|
279 | #ifdef XtSetSensitive |
---|
280 | #undef XtSetSensitive |
---|
281 | #endif |
---|
282 | |
---|
283 | /*ARGSUSED*/ |
---|
284 | ACTION_DECL( WcSetSensitiveACT ) |
---|
285 | { |
---|
286 | WcxActProcWidgetInt( MUST_BE_WIDGET, "WcSetSensitive", w, params, num_params, |
---|
287 | XtSetSensitive, TRUE ); |
---|
288 | } |
---|
289 | |
---|
290 | /*ARGSUSED*/ |
---|
291 | ACTION_DECL( WcSetInsensitiveACT ) |
---|
292 | { |
---|
293 | WcxActProcWidgetInt( MUST_BE_WIDGET, "WcSetInsensitive", w, params, num_params, |
---|
294 | XtSetSensitive, FALSE ); |
---|
295 | } |
---|
296 | |
---|
297 | /* -- Popup and Popdown widgets |
---|
298 | ******************************************************************************* |
---|
299 | WcPopup( name [, name] ... ) uses XtGrabNone |
---|
300 | WcPopupGrab( name [, name] ... ) uses XtGrabExclusive |
---|
301 | WcPopdown( name [, name] ... ) |
---|
302 | */ |
---|
303 | #ifdef XtPopup |
---|
304 | #undef XtPopup |
---|
305 | #endif |
---|
306 | |
---|
307 | /*ARGSUSED*/ |
---|
308 | ACTION_DECL( WcPopupACT ) |
---|
309 | { |
---|
310 | WcxActProcWidgetInt( MUST_BE_SHELL, "WcPopup", w, params, num_params, |
---|
311 | XtPopup, XtGrabNone ); |
---|
312 | } |
---|
313 | |
---|
314 | /*ARGSUSED*/ |
---|
315 | ACTION_DECL( WcPopupGrabACT ) |
---|
316 | { |
---|
317 | WcxActProcWidgetInt( MUST_BE_SHELL, "WcPopupGrab", w, params, num_params, |
---|
318 | XtPopup, XtGrabExclusive ); |
---|
319 | } |
---|
320 | |
---|
321 | #ifdef XtPopdown |
---|
322 | #undef XtPopdown |
---|
323 | #endif |
---|
324 | |
---|
325 | /*ARGSUSED*/ |
---|
326 | ACTION_DECL( WcPopdownACT ) |
---|
327 | { |
---|
328 | WcxActProcWidget( MUST_BE_SHELL, "WcPopdown", w, params, num_params, |
---|
329 | XtPopdown ); |
---|
330 | } |
---|
331 | |
---|
332 | |
---|
333 | /* -- Map or Unmap widgets |
---|
334 | ******************************************************************************* |
---|
335 | Some old Xt versions do not provide declarations for XtMapWidget() |
---|
336 | and XtUnmapWidget(), they may only be declared as macros. Wcl provides |
---|
337 | the functions if they do not exist. |
---|
338 | |
---|
339 | WcMap( name [, name] ... ) |
---|
340 | WcUnmap( name [, name] ... ) |
---|
341 | */ |
---|
342 | #ifdef XtMapWidget |
---|
343 | #undef XtMapWidget |
---|
344 | #endif |
---|
345 | #ifdef XtUnmapWidget |
---|
346 | #undef XtUnmapWidget |
---|
347 | #endif |
---|
348 | |
---|
349 | extern void XtMapWidget _(( Widget )); |
---|
350 | extern void XtUnmapWidget _(( Widget )); |
---|
351 | |
---|
352 | /*ARGSUSED*/ |
---|
353 | ACTION_DECL( WcMapACT ) |
---|
354 | { |
---|
355 | WcxActProcWidget( MUST_BE_WIDGET, "WcMap", w, params, num_params, |
---|
356 | XtMapWidget ); |
---|
357 | } |
---|
358 | |
---|
359 | /*ARGSUSED*/ |
---|
360 | ACTION_DECL( WcUnmapACT ) |
---|
361 | { |
---|
362 | WcxActProcWidget( MUST_BE_WIDGET, "WcUnmap", w, params, num_params, |
---|
363 | XtUnmapWidget ); |
---|
364 | } |
---|
365 | |
---|
366 | /* -- Install Accelerators |
---|
367 | ******************************************************************************* |
---|
368 | Invokes XtInstallAcclerators aand XtInstallAllAccelerators. |
---|
369 | |
---|
370 | dest - widget that can activate accelerators, |
---|
371 | src - widget which provides functionality, |
---|
372 | and defines the accel translation. |
---|
373 | */ |
---|
374 | |
---|
375 | /*ARGSUSED*/ |
---|
376 | ACTION_DECL( WcInstallAcceleratorsACT ) |
---|
377 | { |
---|
378 | int i; |
---|
379 | Widget dest, src; |
---|
380 | static char* usage = |
---|
381 | "Wcl Usage: WcInstallAccelerators( dest, src [, src] ... )\n\ |
---|
382 | \tdest - (root of tree) widget that can activate accelerators,\n\ |
---|
383 | \tsrc - widget which provides functionality, \n\ |
---|
384 | \t and defines the accel translation (accelerators resource)." ; |
---|
385 | |
---|
386 | if ( *num_params < 2 ) |
---|
387 | { |
---|
388 | WcWARN( w, "WcInstallAccelerators", "usage", usage ); |
---|
389 | return; |
---|
390 | } |
---|
391 | if ( NULL == (dest = WcFullNameToWidget( w, params[0] )) ) |
---|
392 | { |
---|
393 | WcWARN1( w, "WcInstallAccelerators", "destNotFound", |
---|
394 | "Wcl Warning: Destination widget %s not found.", params[0] ); |
---|
395 | WcWARN( w, "WcInstallAccelerators", "usage", usage ); |
---|
396 | return; |
---|
397 | } |
---|
398 | for ( i = 1 ; i < *num_params ; i++ ) |
---|
399 | { |
---|
400 | if ( NULL == (src = WcFullNameToWidget( w, params[i] )) ) |
---|
401 | { |
---|
402 | WcWARN1( w, "WcInstallAccelerators", "srcNotFound", |
---|
403 | "Wcl Warning: Source widget %s not found.", params[i] ); |
---|
404 | WcWARN( w, "WcInstallAccelerators", "usage", usage ); |
---|
405 | } |
---|
406 | else |
---|
407 | { |
---|
408 | XtInstallAccelerators( dest, src ); |
---|
409 | } |
---|
410 | } |
---|
411 | } |
---|
412 | |
---|
413 | /*ARGSUSED*/ |
---|
414 | ACTION_DECL( WcInstallAllAcceleratorsACT ) |
---|
415 | { |
---|
416 | Widget dest, src; |
---|
417 | static char* usage = |
---|
418 | "Wcl Usage: WcInstallAllAccelerators( dest, src )\n\ |
---|
419 | \tdest - (root of tree) widget that can activate accelerators,\n\ |
---|
420 | \tsrc - root of widget tree, each child widget can provide functionality, \n\ |
---|
421 | \t and can define a accel translation (accelerators resource)." ; |
---|
422 | |
---|
423 | if ( *num_params != 2 ) |
---|
424 | { |
---|
425 | WcWARN( w, "WcInstallAllAccelerators", "usage", usage ); |
---|
426 | return; |
---|
427 | } |
---|
428 | |
---|
429 | if ( NULL == (dest = WcFullNameToWidget( w, params[0] )) ) |
---|
430 | { |
---|
431 | WcWARN1( w, "WcInstallAllAccelerators", "destNotFound", |
---|
432 | "Wcl Warning: Destination widget %s not found.", params[0] ); |
---|
433 | WcWARN( w, "WcInstallAllAccelerators", "usage", usage ); |
---|
434 | return; |
---|
435 | } |
---|
436 | |
---|
437 | if ( NULL == (src = WcFullNameToWidget( w, params[1] )) ) |
---|
438 | { |
---|
439 | WcWARN1( w, "WcInstallAccelerators", "srcNotFound", |
---|
440 | "Wcl Warning: Source widget %s not found.", params[1] ); |
---|
441 | WcWARN( w, "WcInstallAllAccelerators", "usage", usage ); |
---|
442 | return; |
---|
443 | } |
---|
444 | |
---|
445 | XtInstallAllAccelerators( dest, src ); |
---|
446 | } |
---|
447 | |
---|
448 | |
---|
449 | /* -- Create New Widget Heirarchy |
---|
450 | ******************************************************************************* |
---|
451 | WcCreateRoot( shell [on: display] [shell [on: display]] ... ) |
---|
452 | */ |
---|
453 | |
---|
454 | /*ARGSUSED*/ |
---|
455 | ACTION_DECL( WcCreateRootACT ) |
---|
456 | { |
---|
457 | int i = 0; |
---|
458 | static char* usage = |
---|
459 | "Wcl Usage: WcCreateRoot( shell [on: display] [shell [on: display]] ... )"; |
---|
460 | |
---|
461 | while(*num_params) /* must have args or give usage message */ |
---|
462 | { |
---|
463 | |
---|
464 | if (WcStrEq(params[i], "on:")) |
---|
465 | break; /* give usage message */ |
---|
466 | |
---|
467 | if ( i+2 < *num_params && WcStrEq(params[i+1], "on:") ) |
---|
468 | { |
---|
469 | XtAppContext app = XtWidgetToApplicationContext( w ); |
---|
470 | char* class = WcAppNameToAppClass( params[i] ); |
---|
471 | #if defined(XtSpecificationRelease) && XtSpecificationRelease > 4 |
---|
472 | int zero = 0; |
---|
473 | #else |
---|
474 | Cardinal zero = 0; |
---|
475 | #endif |
---|
476 | char* empty = ""; |
---|
477 | Display* dpy; |
---|
478 | |
---|
479 | dpy = XtOpenDisplay( app, |
---|
480 | params[i+2], /* display name */ |
---|
481 | params[i], class, /* shell name and class */ |
---|
482 | NULL, 0, /* no options */ |
---|
483 | &zero, &empty ); /* no argv - XtOpenDisplay */ |
---|
484 | |
---|
485 | XtFree(class); |
---|
486 | |
---|
487 | if ( dpy == NULL) |
---|
488 | { |
---|
489 | WcWARN1( w, "WcCreateRoot", "openDisplayFailed", |
---|
490 | "Wcl Warning: WcCreateRoot() could not open display %s", |
---|
491 | params[i+2]); |
---|
492 | return; |
---|
493 | } |
---|
494 | (void)WcCreateRoot( dpy, params[i] ); |
---|
495 | i+=3; /* used 3 arguments */ |
---|
496 | } |
---|
497 | else |
---|
498 | { |
---|
499 | (void)WcCreateRoot( XtDisplay(w), params[i] ); |
---|
500 | ++i; |
---|
501 | } |
---|
502 | if (i == *num_params) |
---|
503 | return; |
---|
504 | } |
---|
505 | |
---|
506 | /* Something went wrong |
---|
507 | */ |
---|
508 | WcWARN( w, "WcCreateRoot", "usage", usage ); |
---|
509 | } |
---|
510 | |
---|
511 | /* -- Fork and exec |
---|
512 | ******************************************************************************* |
---|
513 | WcSpawn( cmd line ) |
---|
514 | */ |
---|
515 | |
---|
516 | /*ARGSUSED*/ |
---|
517 | ACTION_DECL( WcSpawnACT ) |
---|
518 | { |
---|
519 | int pid; |
---|
520 | int i; |
---|
521 | char** argv = (char**)XtCalloc(*num_params + 1, sizeof(char*)); |
---|
522 | |
---|
523 | for (i = 0 ; i < *num_params ; i++) |
---|
524 | argv[i] = params[i]; |
---|
525 | |
---|
526 | #ifdef VMS |
---|
527 | if ( 0 == (pid = vfork()) ) |
---|
528 | #else |
---|
529 | if ( 0 == (pid = fork()) ) |
---|
530 | #endif |
---|
531 | { |
---|
532 | /* subprocess */ |
---|
533 | execvp( params[0], argv ); |
---|
534 | fprintf( stderr, |
---|
535 | "Wcl Error in Subprocess: WcSpawn(%s ...) - Could not execvp.", |
---|
536 | params[0] ); |
---|
537 | exit(1); |
---|
538 | } |
---|
539 | if (pid == -1) |
---|
540 | { |
---|
541 | WcWARN1( w, "WcSpawn", "forkFailed", |
---|
542 | "Wcl Warning: WcSpawn(%s ...) Failed - Could not fork.", |
---|
543 | params[0] ); |
---|
544 | } |
---|
545 | } |
---|
546 | |
---|
547 | /* -- Load Resource File into Resource Database |
---|
548 | ******************************************************************************* |
---|
549 | WcLoadResourceFile( file [, file] ) |
---|
550 | */ |
---|
551 | |
---|
552 | /*ARGSUSED*/ |
---|
553 | ACTION_DECL( WcLoadResourceFileACT ) |
---|
554 | { |
---|
555 | int i; |
---|
556 | |
---|
557 | for ( i = 0 ; i < *num_params ; i++ ) |
---|
558 | (void)WcLoadResourceFile( w, params[i] ); |
---|
559 | } |
---|
560 | |
---|
561 | /* -- Print Tree of named widgets |
---|
562 | ******************************************************************************* |
---|
563 | WcPrintTree( name [, name] ) |
---|
564 | */ |
---|
565 | |
---|
566 | /*ARGSUSED*/ |
---|
567 | ACTION_DECL( WcPrintTreeACT ) |
---|
568 | { |
---|
569 | if (*num_params == 0) |
---|
570 | WcPrintTree(w); |
---|
571 | else |
---|
572 | WcxActProcWidget( CAN_BE_GADGET, "WcPrintTree", w, params, num_params, |
---|
573 | WcPrintTree ); |
---|
574 | } |
---|
575 | |
---|
576 | /* -- Print resources under a widget instance |
---|
577 | ******************************************************************************* |
---|
578 | WcDumpResources( name [, name] ) |
---|
579 | */ |
---|
580 | |
---|
581 | /*ARGSUSED*/ |
---|
582 | ACTION_DECL( WcDumpResourcesACT ) |
---|
583 | { |
---|
584 | if (*num_params == 0) |
---|
585 | WcPostCreateDumpResources( w, stderr ); |
---|
586 | else |
---|
587 | { |
---|
588 | int i; |
---|
589 | for ( i = 0 ; i < *num_params ; i++ ) |
---|
590 | { |
---|
591 | Widget target = WcFullNameToWidget( w, params[i] ); |
---|
592 | if ( target ) |
---|
593 | { |
---|
594 | WcPostCreateDumpResources( target, stderr ); |
---|
595 | } |
---|
596 | else |
---|
597 | { |
---|
598 | WcWARN1( w, "WcDumpResources", "notFound", |
---|
599 | "Wcl Warning: WcDumpResources(%s) - Widget not found", |
---|
600 | params[i] ); |
---|
601 | } |
---|
602 | } |
---|
603 | } |
---|
604 | } |
---|
605 | |
---|
606 | /* -- Make two or more widgets the same (max) size |
---|
607 | ******************************************************************************* |
---|
608 | WcSameSize( child, child [,child] ... ) |
---|
609 | */ |
---|
610 | |
---|
611 | /*ARGSUSED*/ |
---|
612 | ACTION_DECL( WcSameSizeACT ) |
---|
613 | { |
---|
614 | #define MAX_SAME (BUFSIZ/sizeof(Widget)) |
---|
615 | Widget sameWidgets[MAX_SAME]; |
---|
616 | int i, numWidgets; |
---|
617 | Dimension maxBorder, maxHeight, maxWidth; |
---|
618 | Arg arg[10]; |
---|
619 | int argc; |
---|
620 | |
---|
621 | if ( *num_params < 2 ) |
---|
622 | { |
---|
623 | WcWARN1( w, "WcSameSize", "needTwoOrMore", |
---|
624 | "Wcl Warning: WcSameSize(%s) - Need at least two widgets", |
---|
625 | params[0] ); |
---|
626 | return; |
---|
627 | } |
---|
628 | |
---|
629 | for ( i = numWidgets = 0 ; i < *num_params && numWidgets < MAX_SAME ; i++ ) |
---|
630 | { |
---|
631 | char* name = (char*)params[i]; |
---|
632 | Widget widget = WcFullNameToWidget( w, name ); |
---|
633 | |
---|
634 | if ( (Widget)0 != widget ) |
---|
635 | { |
---|
636 | sameWidgets[numWidgets++] = widget; |
---|
637 | } |
---|
638 | else |
---|
639 | { |
---|
640 | char* thisName = WcWidgetToFullName( w ); |
---|
641 | WcWARN2( w, "WcSameSize", "notFound", |
---|
642 | "Wcl Warning: WcSameSize cannot find widget %s from %s\n", |
---|
643 | name, thisName ); |
---|
644 | XtFree( thisName ); |
---|
645 | } |
---|
646 | } |
---|
647 | |
---|
648 | #define MAX_DIM(a,b) ((a)>(b)?(a):(b)) |
---|
649 | for ( maxBorder = maxHeight = maxWidth = i = 0 ; i < numWidgets ; i++ ) |
---|
650 | { |
---|
651 | maxBorder = MAX_DIM( maxBorder, sameWidgets[i]->core.border_width ); |
---|
652 | maxHeight = MAX_DIM( maxHeight, sameWidgets[i]->core.height ); |
---|
653 | maxWidth = MAX_DIM( maxWidth, sameWidgets[i]->core.width ); |
---|
654 | } |
---|
655 | |
---|
656 | argc = 0; |
---|
657 | XtSetArg( arg[argc], XtNborderWidth, (XtArgVal)maxBorder ); ++argc; |
---|
658 | XtSetArg( arg[argc], XtNheight, (XtArgVal)maxHeight ); ++argc; |
---|
659 | XtSetArg( arg[argc], XtNwidth, (XtArgVal)maxWidth ); ++argc; |
---|
660 | |
---|
661 | for ( i = 0 ; i < numWidgets ; i++ ) |
---|
662 | { |
---|
663 | XtSetValues( sameWidgets[i], arg, argc ); |
---|
664 | } |
---|
665 | |
---|
666 | #undef MAX_DIM |
---|
667 | #undef MAX_SAME |
---|
668 | } |
---|
669 | |
---|
670 | /* -- Exit the application |
---|
671 | ******************************************************************************* |
---|
672 | WcExit( [exitVal] ) |
---|
673 | */ |
---|
674 | |
---|
675 | /*ARGSUSED*/ |
---|
676 | ACTION_DECL( WcExitACT ) |
---|
677 | { |
---|
678 | if (*num_params) |
---|
679 | exit( atoi(*params) ); |
---|
680 | else |
---|
681 | exit(0); |
---|
682 | } |
---|
683 | |
---|
684 | /* |
---|
685 | ******************************************************************************* |
---|
686 | * Callbacks Which Actually Do Something |
---|
687 | ******************************************************************************* |
---|
688 | */ |
---|
689 | |
---|
690 | /* -- Create Dynamically Created Children from Xrm Database |
---|
691 | ******************************************************************************* |
---|
692 | WcCreateChildren( parent, child [,child] ... ) |
---|
693 | WcCreatePopups( parent, child [,child] ... ) |
---|
694 | */ |
---|
695 | |
---|
696 | typedef void (*PVFWidStr) _((Widget,char*)); |
---|
697 | |
---|
698 | static void WcxCreateKids ( w, parent_children, caller, CreateFunc ) |
---|
699 | Widget w; |
---|
700 | char* parent_children; /* parent + list of named children */ |
---|
701 | char* caller; /* name of calling CB func */ |
---|
702 | PVFWidStr CreateFunc; |
---|
703 | { |
---|
704 | char* children; |
---|
705 | Widget parent; |
---|
706 | char parentName[MAX_XRMSTRING]; |
---|
707 | |
---|
708 | if ( *parent_children == NUL ) |
---|
709 | { |
---|
710 | WcWARN1( w, caller, "noNames", |
---|
711 | "Wcl Warning: %s( ) - No widget names provided.", caller ); |
---|
712 | return; |
---|
713 | } |
---|
714 | |
---|
715 | children = WcCleanName( parent_children, parentName ); |
---|
716 | |
---|
717 | children = WcSkipWhitespace_Comma( children ); |
---|
718 | |
---|
719 | if ((Widget)NULL == (parent = WcFullNameToWidget( w, parentName )) ) |
---|
720 | { |
---|
721 | WcWARN2( w, caller, "parentNotFound", |
---|
722 | "Wcl Warning: %s( %s ...) - Parent widget not found.", |
---|
723 | caller, parentName ); |
---|
724 | return; |
---|
725 | } |
---|
726 | |
---|
727 | if (*children == NUL) |
---|
728 | { |
---|
729 | WcWARN2( w, caller, "noChildNames", |
---|
730 | "Wcl Warning: %s(%s) - No child names provided.", |
---|
731 | caller, parentName ); |
---|
732 | return; |
---|
733 | } |
---|
734 | |
---|
735 | CreateFunc( parent, children ); |
---|
736 | } |
---|
737 | |
---|
738 | /*ARGSUSED*/ |
---|
739 | void WcCreateChildrenCB ( w, mom_children, unused ) |
---|
740 | Widget w; |
---|
741 | XtPointer mom_children; /* parent + list of named children */ |
---|
742 | XtPointer unused; |
---|
743 | { |
---|
744 | WcxCreateKids(w, (char*)mom_children, |
---|
745 | "WcCreateChildren", WcCreateNamedChildren); |
---|
746 | } |
---|
747 | |
---|
748 | /*ARGSUSED*/ |
---|
749 | void WcCreatePopupsCB ( w, mom_children, unused ) |
---|
750 | Widget w; |
---|
751 | XtPointer mom_children; /* parent + list of named children */ |
---|
752 | XtPointer unused; |
---|
753 | { |
---|
754 | WcxCreateKids(w, (char*)mom_children, |
---|
755 | "WcCreatePopups", WcCreateNamedPopups ); |
---|
756 | } |
---|
757 | |
---|
758 | /* -- Position a TransientShell in middle of parent widget |
---|
759 | ******************************************************************************* |
---|
760 | This callback is useful as a popupCallback for transient widgets. |
---|
761 | WcPositionTransient() |
---|
762 | */ |
---|
763 | |
---|
764 | /*ARGSUSED*/ |
---|
765 | void WcPositionTransientCB( w, ignored, unused ) |
---|
766 | Widget w; |
---|
767 | XtPointer ignored; |
---|
768 | XtPointer unused; |
---|
769 | { |
---|
770 | Widget child, transientFor; |
---|
771 | XtWidgetGeometry request; |
---|
772 | |
---|
773 | #ifndef XtSpecificationRelease |
---|
774 | ShellWidget shell = (ShellWidget)w; |
---|
775 | #else |
---|
776 | TransientShellWidget shell = (TransientShellWidget)w; |
---|
777 | |
---|
778 | if ( XtIsSubclass((Widget)shell,transientShellWidgetClass) ) |
---|
779 | transientFor = shell->transient.transient_for; |
---|
780 | else |
---|
781 | #endif |
---|
782 | transientFor = XtParent(w); |
---|
783 | |
---|
784 | if ( !XtIsSubclass((Widget)shell,shellWidgetClass) |
---|
785 | || (NULL == transientFor) |
---|
786 | || (NULL == ( child = shell->composite.children[0] )) ) |
---|
787 | return; |
---|
788 | |
---|
789 | request.x = (Position)(transientFor->core.width - child->core.width) / 2; |
---|
790 | request.y = (Position)(transientFor->core.height - child->core.height)/ 2; |
---|
791 | |
---|
792 | if (XtIsRealized (transientFor)) |
---|
793 | XtTranslateCoords( transientFor, request.x, request.y, |
---|
794 | &request.x, &request.y ); |
---|
795 | |
---|
796 | request.request_mode = ( request.x != shell->core.x ? CWX : 0 ); |
---|
797 | request.request_mode |= ( request.y != shell->core.y ? CWY : 0 ); |
---|
798 | |
---|
799 | if ( request.request_mode ) |
---|
800 | (void)XtMakeGeometryRequest( (Widget)shell, &request, NULL ); |
---|
801 | } |
---|
802 | |
---|
803 | /* -- Set Resource Value on Widget |
---|
804 | ******************************************************************************* |
---|
805 | The client data argument consists of one or more resource specifications |
---|
806 | in this syntax: |
---|
807 | |
---|
808 | client_data ::= res_spec |
---|
809 | | res_spec_list |
---|
810 | |
---|
811 | res_spec ::= targetName.resName: resValue |
---|
812 | | targetName.resName(resType): resValue |
---|
813 | |
---|
814 | res_spec_list ::= (res_spec) |
---|
815 | | res_spec_list (res_spec) |
---|
816 | |
---|
817 | */ |
---|
818 | |
---|
819 | /*ARGSUSED*/ |
---|
820 | void WcSetValueCB ( w, name_res_resType_resVal, unused ) |
---|
821 | Widget w; |
---|
822 | XtPointer name_res_resType_resVal; |
---|
823 | XtPointer unused; |
---|
824 | { |
---|
825 | WcSetValue( w, (char*)name_res_resType_resVal ); |
---|
826 | } |
---|
827 | |
---|
828 | /* -- WcTraceCB |
---|
829 | ******************************************************************************* |
---|
830 | Prints out the wiget pathname of the invoking wiget, and an optional |
---|
831 | annotation on stderr. |
---|
832 | */ |
---|
833 | |
---|
834 | /*ARGSUSED*/ |
---|
835 | void WcTraceCB ( w, annotation, unused ) |
---|
836 | Widget w; |
---|
837 | XtPointer annotation; /* client data, traceback annotation */ |
---|
838 | XtPointer unused; |
---|
839 | { |
---|
840 | char* name = WcWidgetToFullName( w ); |
---|
841 | |
---|
842 | WcPrint( "Wcl Trace for ", name, ": ", (char*)annotation, NULL ); |
---|
843 | |
---|
844 | XtFree( name ); |
---|
845 | } |
---|
846 | |
---|
847 | /* -- Invoke shell command |
---|
848 | ******************************************************************************* |
---|
849 | Call system(). |
---|
850 | */ |
---|
851 | |
---|
852 | /*ARGSUSED*/ |
---|
853 | void WcSystemCB ( w, shellCmdString, unused ) |
---|
854 | Widget w; |
---|
855 | XtPointer shellCmdString; |
---|
856 | XtPointer unused; |
---|
857 | { |
---|
858 | system( (char*)shellCmdString ); |
---|
859 | } |
---|
860 | |
---|
861 | /* -- Add and Remove Callbacks |
---|
862 | ******************************************************************************* |
---|
863 | WcAddCallbacks( widget callbackName CallbackProc( args ) ... ) |
---|
864 | WcRemoveCallbacks( widget callbackName CallbackProc( args ) ... ) |
---|
865 | |
---|
866 | Invokes XtAddCallbacks and XtRemoveCallbacks, as callbacks should not just |
---|
867 | be trashed using XtSetValues, since other things besides the application |
---|
868 | code may express intrest in callbacks. Especially true for popup, map, |
---|
869 | and destroy callbacks |
---|
870 | */ |
---|
871 | |
---|
872 | typedef void (*AddOrRemoveProc) _(( Widget, char*, XtCallbackRec* )); |
---|
873 | |
---|
874 | static void WcxAddOrRemoveCallbacks ( w, string, caller, AddOrRemove ) |
---|
875 | Widget w; |
---|
876 | char* string; |
---|
877 | char* caller; |
---|
878 | AddOrRemoveProc AddOrRemove; |
---|
879 | { |
---|
880 | char name[MAX_XRMSTRING]; |
---|
881 | XtCallbackRec* callbacks; |
---|
882 | Widget target; |
---|
883 | |
---|
884 | string = WcCleanName( string, name ); /* name of a widget */ |
---|
885 | string = WcSkipWhitespace_Comma( string ); |
---|
886 | |
---|
887 | if ( NULL == (target = WcFullNameToWidget( w, name )) ) |
---|
888 | { |
---|
889 | WcWARN2( w, caller, "destNotFound", |
---|
890 | "Wcl Warning: %s(%s) - Widget not found.", caller, name ); |
---|
891 | return; |
---|
892 | } |
---|
893 | |
---|
894 | string = WcCleanName( string, name ); /* name now callback name */ |
---|
895 | string = WcSkipWhitespace_Comma( string ); |
---|
896 | |
---|
897 | if ( NULL != (callbacks = WcStringToCallbackList( w, string ) ) ) |
---|
898 | { |
---|
899 | AddOrRemove( target, name, callbacks ); |
---|
900 | WcFreeCallbackList( callbacks ); |
---|
901 | } |
---|
902 | } |
---|
903 | |
---|
904 | /*ARGSUSED*/ |
---|
905 | void WcAddCallbacksCB ( w, callbackString, unused ) |
---|
906 | Widget w; |
---|
907 | XtPointer callbackString; |
---|
908 | XtPointer unused; |
---|
909 | { |
---|
910 | WcxAddOrRemoveCallbacks( w, (char*)callbackString, |
---|
911 | "WcAddCallbacks", XtAddCallbacks ); |
---|
912 | } |
---|
913 | |
---|
914 | /*ARGSUSED*/ |
---|
915 | void WcRemoveCallbacksCB ( w, callbackString, unused ) |
---|
916 | Widget w; |
---|
917 | XtPointer callbackString; |
---|
918 | XtPointer unused; |
---|
919 | { |
---|
920 | WcxAddOrRemoveCallbacks( w, (char*)callbackString, |
---|
921 | "WcRemoveCallbacks", XtRemoveCallbacks ); |
---|
922 | } |
---|
923 | |
---|
924 | /* -- Invoke Callback Once Only |
---|
925 | ******************************************************************************* |
---|
926 | WcOnceOnly( name, callback(clientData) [callback(clientData) ...] ) |
---|
927 | |
---|
928 | I sure wish we did not need to pass the callback name, but we must... |
---|
929 | We don't know which callback list name (i.e., activateCallback, |
---|
930 | destroyCallback, wcAfterChildren etc) is being invoked. We can't get it |
---|
931 | at conversion time, as the converter does not have enough information. |
---|
932 | */ |
---|
933 | |
---|
934 | void WcOnceOnlyCB ( w, name_callbackString, passedAlong ) |
---|
935 | Widget w; |
---|
936 | XtPointer name_callbackString; |
---|
937 | XtPointer passedAlong; |
---|
938 | { |
---|
939 | static char* usage = |
---|
940 | "Wcl Usage: WcOnceOnly( name, callback(clientData) [callback(clientData) ...] )\n\ |
---|
941 | \tname - callback name (i.e., activateCallback, destroyCallback, etc)\n\ |
---|
942 | \t\tCallbacks are each invoked with the client data,\n\ |
---|
943 | \t\tthen this callback is removed."; |
---|
944 | XtCallbackRec* cb; |
---|
945 | XtCallbackRec* callbackRecs; |
---|
946 | char name[MAX_XRMSTRING]; |
---|
947 | char* callbacks = (char*)name_callbackString; |
---|
948 | |
---|
949 | callbacks = WcCleanName( callbacks, name ); |
---|
950 | callbacks = WcSkipWhitespace_Comma( callbacks ); |
---|
951 | |
---|
952 | if ( NULL != ( callbackRecs = WcStringToCallbackList( w, callbacks ) ) ) |
---|
953 | { |
---|
954 | for ( cb = callbackRecs ; cb->callback != 0 ; cb++ ) |
---|
955 | { |
---|
956 | cb->callback( w, cb->closure, passedAlong ); |
---|
957 | } |
---|
958 | /* This does nothing if WcOnceOnlyCB is called via the late binder: |
---|
959 | */ |
---|
960 | XtRemoveCallback( w, name, WcOnceOnlyCB, name_callbackString ); |
---|
961 | |
---|
962 | /* This does nothing if WcOnceOnlyCB was bound via C |
---|
963 | */ |
---|
964 | WcLateBinder_RemoveCallback( name ); |
---|
965 | |
---|
966 | XtFree( (char*)callbackRecs ); |
---|
967 | } |
---|
968 | else |
---|
969 | { |
---|
970 | char* fullName = WcWidgetToFullName(w); |
---|
971 | |
---|
972 | WcWARN2( w, "WcOnceOnly", "noSuchCallbackList", |
---|
973 | "Wcl Warning: Widget %s does not have callback list named %s.", |
---|
974 | fullName, name ); |
---|
975 | WcWARN( w, "WcOnceOnly", "usage", usage ); |
---|
976 | XtFree( fullName ); |
---|
977 | } |
---|
978 | } |
---|
979 | |
---|
980 | /* -- Augment or override translations |
---|
981 | ******************************************************************************* |
---|
982 | WcTranslations( widget translationString ) |
---|
983 | */ |
---|
984 | |
---|
985 | /*ARGSUSED*/ |
---|
986 | void WcTranslationsCB ( w, name_trans, unused ) |
---|
987 | Widget w; |
---|
988 | XtPointer name_trans; |
---|
989 | XtPointer unused; |
---|
990 | { |
---|
991 | char name[MAX_XRMSTRING]; |
---|
992 | char* translations = (String)name_trans; |
---|
993 | Widget target; |
---|
994 | |
---|
995 | translations = WcCleanName( (char*)name_trans, name ); |
---|
996 | translations = WcSkipWhitespace_Comma( translations ); |
---|
997 | if ( NULL == (target = WcFullNameToWidget( w, name ) ) ) |
---|
998 | { |
---|
999 | WcWARN1( w, "WcTranslations", "notFound", |
---|
1000 | "Wcl Warning: WcTranslations(%s ... ) - Widget not found.", |
---|
1001 | name ); |
---|
1002 | return; |
---|
1003 | } |
---|
1004 | WcSetTranslations( target, translations ); |
---|
1005 | } |
---|
1006 | |
---|
1007 | |
---|
1008 | /* -- Invoke Action or Callback in Dynamically Linked Libraries |
---|
1009 | ******************************************************************************* |
---|
1010 | WcDynamicAction( sharedLibrary entryPointName([optArgs]) ) |
---|
1011 | WcDynamicCallback( sharedLibrary entryPointName([optArgs]) ) |
---|
1012 | |
---|
1013 | Invokes named callback or action. |
---|
1014 | |
---|
1015 | Works only on machines which support dlopen() and dlsym(), in other |
---|
1016 | words, SunOS and SVR4 machines. The idea and proof of concept was |
---|
1017 | provided by John Coyne (coyne@seismo.CSS.GOV). |
---|
1018 | |
---|
1019 | This has really been superceeded by the upgraded string-to-callback |
---|
1020 | converter and WcLateBinder() |
---|
1021 | */ |
---|
1022 | /*ARGSUSED*/ |
---|
1023 | void WcDynamicInvoke( w, clientData, callData, invokeAction, caller ) |
---|
1024 | Widget w; |
---|
1025 | XtPointer clientData, callData; |
---|
1026 | int invokeAction; |
---|
1027 | char* caller; |
---|
1028 | { |
---|
1029 | #ifndef WC_HAS_dlopen_AND_dlsym |
---|
1030 | |
---|
1031 | /* Cannot do anything. |
---|
1032 | */ |
---|
1033 | |
---|
1034 | WcWARN( w, "WcDynamicInvoke", "notSupported", |
---|
1035 | "Wcl Warning: WcDynamicInvoke() requires dynamic linking via dlopen() and dlsym()" ); |
---|
1036 | return; |
---|
1037 | |
---|
1038 | #else |
---|
1039 | |
---|
1040 | /* We can actually try to do the dynamic bind and invocation |
---|
1041 | */ |
---|
1042 | |
---|
1043 | static char usageAction[] = |
---|
1044 | "Wcl Usage: WcDynamicAction( sharedLibrary entryPointName([optArgs]) )\n\ |
---|
1045 | sharedLibrary - path from / or ~, or name registered with WclDynamicLibs\n\ |
---|
1046 | entryPointName - name of XtActionProc\n\ |
---|
1047 | optArgs - passed as string args to XtActionProc (do NOT free)"; |
---|
1048 | |
---|
1049 | static char usageCallback[] = |
---|
1050 | "Wcl Usage: WcDynamicCallback( sharedLibrary entryPointName([optArgs]) )\n\ |
---|
1051 | sharedLibrary - path from / or ~, or name registered with WclDynamicLibs\n\ |
---|
1052 | entryPointName - name of XtCallbackProc\n\ |
---|
1053 | optArgs - passed as clientData string to XtCallbackProc (do NOT free)"; |
---|
1054 | |
---|
1055 | static char unbalAction[] = |
---|
1056 | "Wcl Warning: WcDynamicAction( %s ) - Unbalanced parens."; |
---|
1057 | |
---|
1058 | static char unbalCallback[] = |
---|
1059 | "Wcl Warning: WcDynamicCallback( %s ) - Unbalanced parens."; |
---|
1060 | |
---|
1061 | static char unknownAction[] = |
---|
1062 | "Wcl Warning: WcDynamicAction( %s ... ) - library not registered."; |
---|
1063 | |
---|
1064 | static char unknownCallback[] = |
---|
1065 | "Wcl Warning: WcDynamicCallback( %s ... ) - library not registered."; |
---|
1066 | |
---|
1067 | static char tooLongAction[] = |
---|
1068 | "Wcl Warning: WcDynamicAction( %s ... ) - Expanded name too long: %s%s"; |
---|
1069 | |
---|
1070 | static char tooLongCallback[] = |
---|
1071 | "Wcl Warning: WcDynamicCallback( %s ... ) - Expanded name too long: %s%s"; |
---|
1072 | |
---|
1073 | static char dlopenAction[] = |
---|
1074 | "Wcl Warning: WcDynamicAction( %s ... ) Failed - %s"; |
---|
1075 | |
---|
1076 | static char dlopenCallback[] = |
---|
1077 | "Wcl Warning: WcDynamicCallback( %s ... ) Failed - %s"; |
---|
1078 | |
---|
1079 | char* usage = ( invokeAction? usageAction : usageCallback ); |
---|
1080 | char* unbal = ( invokeAction? unbalAction : unbalCallback ); |
---|
1081 | char* unknown = ( invokeAction? unknownAction : unknownCallback ); |
---|
1082 | char* tooLong = ( invokeAction? tooLongAction : tooLongCallback ); |
---|
1083 | char* dlopenFailed = ( invokeAction? dlopenAction : dlopenCallback ); |
---|
1084 | char librarySpec[ MAX_XRMSTRING ]; |
---|
1085 | char* sharedLibrary; |
---|
1086 | char entryPoint[ MAX_XRMSTRING ]; |
---|
1087 | char optArgs[ MAX_XRMSTRING ]; |
---|
1088 | char* from; |
---|
1089 | char* to; |
---|
1090 | void* handle; |
---|
1091 | |
---|
1092 | /* First word is the shared library |
---|
1093 | */ |
---|
1094 | from = WcCleanName( (char*)clientData, librarySpec ); |
---|
1095 | |
---|
1096 | /* Get name of entry point |
---|
1097 | */ |
---|
1098 | from = WcSkipWhitespace_Comma( from ); |
---|
1099 | for ( to = entryPoint ; *from && ' ' <= *from && *from != '(' ; ) |
---|
1100 | *to++ = *from++; |
---|
1101 | *to = '\0'; |
---|
1102 | |
---|
1103 | if ( '\0' == *entryPoint ) |
---|
1104 | { |
---|
1105 | WcWARN( w, caller, "usage", usage ); |
---|
1106 | return; |
---|
1107 | } |
---|
1108 | |
---|
1109 | /* Get optional arguments, strip leading and trailing blanks |
---|
1110 | */ |
---|
1111 | while ( *from && *from <= ' ' && *from != '(' ) |
---|
1112 | from++; |
---|
1113 | |
---|
1114 | if ( *from == '\0' ) |
---|
1115 | { |
---|
1116 | /* No parens means no optional args |
---|
1117 | */ |
---|
1118 | *optArgs = '\0'; |
---|
1119 | } |
---|
1120 | else if ( *from == '(' ) |
---|
1121 | { |
---|
1122 | /* Get chars in parens, no leading or trailing whitespace |
---|
1123 | */ |
---|
1124 | char* firstNonWhitespace = (char*)0; |
---|
1125 | char* lastNonWhitespace; |
---|
1126 | int inParens = 0; |
---|
1127 | while ( *from ) |
---|
1128 | { |
---|
1129 | if ( '(' == *from ) inParens++; |
---|
1130 | else if ( ')' == *from ) inParens--; |
---|
1131 | else if ( ' ' < *from ) |
---|
1132 | { |
---|
1133 | if ( firstNonWhitespace == (char*)0 ) |
---|
1134 | firstNonWhitespace = from; |
---|
1135 | lastNonWhitespace = from; |
---|
1136 | } |
---|
1137 | ++from; |
---|
1138 | } |
---|
1139 | if ( 0 != inParens ) |
---|
1140 | { |
---|
1141 | WcWARN1( w, caller, "unbalancedParens", unbal, (char*)clientData ); |
---|
1142 | return; |
---|
1143 | } |
---|
1144 | |
---|
1145 | to = optArgs; |
---|
1146 | if ( firstNonWhitespace != (char*)0 ) |
---|
1147 | { |
---|
1148 | from = firstNonWhitespace; |
---|
1149 | while ( from <= lastNonWhitespace ) |
---|
1150 | *to++ = *from++; |
---|
1151 | } |
---|
1152 | *to = '\0'; |
---|
1153 | } |
---|
1154 | else |
---|
1155 | { |
---|
1156 | /* Junk following entry point name |
---|
1157 | */ |
---|
1158 | WcWARN( w, caller, "usage", usage ); |
---|
1159 | return; |
---|
1160 | } |
---|
1161 | |
---|
1162 | if ( librarySpec[0] == '-' && librarySpec[1] == 'l' ) |
---|
1163 | { |
---|
1164 | /* Library which should have been registered with Wcl |
---|
1165 | */ |
---|
1166 | XtAppContext app = XtWidgetToApplicationContext(w); |
---|
1167 | sharedLibrary = WcMapDynLibFind( app, XrmStringToQuark(librarySpec) ); |
---|
1168 | |
---|
1169 | if ( (char*)0 == sharedLibrary ) |
---|
1170 | { |
---|
1171 | WcWARN1( w, caller, "unknownLibrary", unknown, librarySpec ); |
---|
1172 | return; |
---|
1173 | } |
---|
1174 | } |
---|
1175 | else if ( librarySpec[0] == '~' ) |
---|
1176 | { |
---|
1177 | char user[ MAX_PATHNAME ]; |
---|
1178 | char path[ MAX_PATHNAME ]; |
---|
1179 | char* homeDir; |
---|
1180 | |
---|
1181 | from = &librarySpec[1]; /* skip the tilda */ |
---|
1182 | to = &user[0]; |
---|
1183 | |
---|
1184 | while ( *from && *from != '/' ) |
---|
1185 | *to++ = *from++; |
---|
1186 | *to = '\0'; |
---|
1187 | |
---|
1188 | homeDir = WcHomeDirectory( user ); /* homeDir is static storage */ |
---|
1189 | |
---|
1190 | if( WcStrLen(homeDir) + WcStrLen(from) >= MAX_PATHNAME ) |
---|
1191 | { |
---|
1192 | WcWARN3( w, caller, "tooLongExpanded", |
---|
1193 | tooLong, librarySpec, homeDir, from ); |
---|
1194 | return; |
---|
1195 | } |
---|
1196 | |
---|
1197 | WcStrCpy( path, homeDir ); |
---|
1198 | WcStrCat( path, from ); /* from points at first '/' */ |
---|
1199 | |
---|
1200 | sharedLibrary = path; |
---|
1201 | } |
---|
1202 | else |
---|
1203 | { |
---|
1204 | sharedLibrary = librarySpec; /* It must be a path name */ |
---|
1205 | } |
---|
1206 | |
---|
1207 | if ( NULL == (handle = dlopen( sharedLibrary, RTLD_LAZY )) ) |
---|
1208 | { |
---|
1209 | WcWARN2( w, "WcDynamicCallback", "dlopenFailed", |
---|
1210 | dlopenFailed, sharedLibrary, dlerror() ); |
---|
1211 | return; |
---|
1212 | } |
---|
1213 | |
---|
1214 | if ( invokeAction ) |
---|
1215 | { |
---|
1216 | XtActionProc ActProc = (XtActionProc)dlsym( handle, entryPoint ); |
---|
1217 | |
---|
1218 | if ( NULL != ActProc ) |
---|
1219 | WcInvokeAction( ActProc, w, optArgs ); |
---|
1220 | else |
---|
1221 | WcWARN3( w, caller, "dlsymFailed", |
---|
1222 | "Wcl Warning: WcDynamicAction( %s %s ) Failed - %s", |
---|
1223 | sharedLibrary, entryPoint, dlerror() ); |
---|
1224 | } |
---|
1225 | else |
---|
1226 | { |
---|
1227 | XtCallbackProc CbProc = (XtCallbackProc)dlsym( handle, entryPoint ); |
---|
1228 | |
---|
1229 | if ( NULL != CbProc ) |
---|
1230 | CbProc( w, (XtPointer)optArgs, callData ); |
---|
1231 | else |
---|
1232 | WcWARN3( w, "WcDynamicCallback", "dlsymFailed", |
---|
1233 | "Wcl Warning: WcDynamicCallback( %s %s ) Failed - %s", |
---|
1234 | sharedLibrary, entryPoint, dlerror() ); |
---|
1235 | } |
---|
1236 | #endif |
---|
1237 | } |
---|
1238 | |
---|
1239 | /*ARGSUSED*/ |
---|
1240 | void WcDynamicActionCB( w, clientData, callData ) |
---|
1241 | Widget w; |
---|
1242 | XtPointer clientData, callData; |
---|
1243 | { |
---|
1244 | #ifdef WC_HAS_dlopen_AND_dlsym |
---|
1245 | WcDynamicInvoke( w, clientData, callData, 1, "WcDynamicAction" ); |
---|
1246 | #else |
---|
1247 | WcWARN( w, "WcDynamicAction", "notSupported", |
---|
1248 | "Wcl Warning: WcDynamicAction() requires dynamic linking via dlopen() and dlsym()" ); |
---|
1249 | #endif |
---|
1250 | } |
---|
1251 | |
---|
1252 | /*ARGSUSED*/ |
---|
1253 | void WcDynamicCallbackCB( w, clientData, callData ) |
---|
1254 | Widget w; |
---|
1255 | XtPointer clientData, callData; |
---|
1256 | { |
---|
1257 | #ifdef WC_HAS_dlopen_AND_dlsym |
---|
1258 | WcDynamicInvoke( w, clientData, callData, 0, "WcDynamicCallback" ); |
---|
1259 | #else |
---|
1260 | WcWARN( w, "WcDynamicCallback", "notSupported", |
---|
1261 | "Wcl Warning: WcDynamicCallback() requires dynamic linking via dlopen() and dlsym()" ); |
---|
1262 | #endif |
---|
1263 | } |
---|
1264 | |
---|
1265 | /* |
---|
1266 | ******************************************************************************* |
---|
1267 | * Callbacks which simply invoke equivalent actions |
---|
1268 | ******************************************************************************* |
---|
1269 | */ |
---|
1270 | |
---|
1271 | #define CB_INVOKES_ACT( cb, act ) \ |
---|
1272 | void cb( w, client_data, unused ) \ |
---|
1273 | Widget w; \ |
---|
1274 | XtPointer client_data; \ |
---|
1275 | XtPointer unused; \ |
---|
1276 | { \ |
---|
1277 | WcInvokeAction( act, w, client_data ); \ |
---|
1278 | } |
---|
1279 | |
---|
1280 | /*ARGSUSED*/ |
---|
1281 | CB_INVOKES_ACT( WcManageCB, WcManageACT ) |
---|
1282 | /*ARGSUSED*/ |
---|
1283 | CB_INVOKES_ACT( WcUnmanageCB, WcUnmanageACT ) |
---|
1284 | /*ARGSUSED*/ |
---|
1285 | CB_INVOKES_ACT( WcManageChildrenCB, WcManageChildrenACT ) |
---|
1286 | /*ARGSUSED*/ |
---|
1287 | CB_INVOKES_ACT( WcUnmanageChildrenCB, WcUnmanageChildrenACT ) |
---|
1288 | /*ARGSUSED*/ |
---|
1289 | CB_INVOKES_ACT( WcDestroyCB, WcDestroyACT ) |
---|
1290 | /*ARGSUSED*/ |
---|
1291 | CB_INVOKES_ACT( WcSetSensitiveCB, WcSetSensitiveACT ) |
---|
1292 | /*ARGSUSED*/ |
---|
1293 | CB_INVOKES_ACT( WcSetInsensitiveCB, WcSetInsensitiveACT ) |
---|
1294 | /*ARGSUSED*/ |
---|
1295 | CB_INVOKES_ACT( WcPopupCB, WcPopupACT ) |
---|
1296 | /*ARGSUSED*/ |
---|
1297 | CB_INVOKES_ACT( WcPopupGrabCB, WcPopupGrabACT ) |
---|
1298 | /*ARGSUSED*/ |
---|
1299 | CB_INVOKES_ACT( WcPopdownCB, WcPopdownACT ) |
---|
1300 | /*ARGSUSED*/ |
---|
1301 | CB_INVOKES_ACT( WcMapCB, WcMapACT ) |
---|
1302 | /*ARGSUSED*/ |
---|
1303 | CB_INVOKES_ACT( WcUnmapCB, WcUnmapACT ) |
---|
1304 | /*ARGSUSED*/ |
---|
1305 | CB_INVOKES_ACT( WcInstallAcceleratorsCB, WcInstallAcceleratorsACT ) |
---|
1306 | /*ARGSUSED*/ |
---|
1307 | CB_INVOKES_ACT( WcInstallAllAcceleratorsCB, WcInstallAllAcceleratorsACT ) |
---|
1308 | /*ARGSUSED*/ |
---|
1309 | CB_INVOKES_ACT( WcCreateRootCB, WcCreateRootACT ) |
---|
1310 | /*ARGSUSED*/ |
---|
1311 | CB_INVOKES_ACT( WcSpawnCB, WcSpawnACT ) |
---|
1312 | /*ARGSUSED*/ |
---|
1313 | CB_INVOKES_ACT( WcLoadResourceFileCB, WcLoadResourceFileACT ) |
---|
1314 | /*ARGSUSED*/ |
---|
1315 | CB_INVOKES_ACT( WcPrintTreeCB, WcPrintTreeACT ) |
---|
1316 | /*ARGSUSED*/ |
---|
1317 | CB_INVOKES_ACT( WcDumpResourcesCB, WcDumpResourcesACT ) |
---|
1318 | /*ARGSUSED*/ |
---|
1319 | CB_INVOKES_ACT( WcSameSizeCB, WcSameSizeACT ) |
---|
1320 | /*ARGSUSED*/ |
---|
1321 | CB_INVOKES_ACT( WcExitCB, WcExitACT ) |
---|
1322 | |
---|
1323 | /* -- WcRegisterCreateCallbacks |
---|
1324 | ******************************************************************************* |
---|
1325 | Register all Wcl callbacks. Called from WcInitialize, so applications |
---|
1326 | normally never call this directly. |
---|
1327 | */ |
---|
1328 | |
---|
1329 | void WcRegisterWcCallbacks ( app ) |
---|
1330 | XtAppContext app; |
---|
1331 | { |
---|
1332 | ONCE_PER_XtAppContext( app ); |
---|
1333 | |
---|
1334 | #define RCALL( name, func ) WcRegisterCallback ( app, name, func, NULL ); |
---|
1335 | |
---|
1336 | /* Actually implemented as XtActionProcs: |
---|
1337 | */ |
---|
1338 | RCALL( "WcManage", WcManageCB ) |
---|
1339 | RCALL( "WcManageCB", WcManageCB ) |
---|
1340 | RCALL( "WcUnmanage", WcUnmanageCB ) |
---|
1341 | RCALL( "WcUnmanageCB", WcUnmanageCB ) |
---|
1342 | RCALL( "WcManageChildren", WcManageChildrenCB ) |
---|
1343 | RCALL( "WcManageChildrenCB", WcManageChildrenCB ) |
---|
1344 | RCALL( "WcUnmanageChildren", WcUnmanageChildrenCB ) |
---|
1345 | RCALL( "WcUnmanageChildrenCB", WcUnmanageChildrenCB ) |
---|
1346 | RCALL( "WcDestroy", WcDestroyCB ) |
---|
1347 | RCALL( "WcDestroyCB", WcDestroyCB ) |
---|
1348 | RCALL( "WcSetSensitive", WcSetSensitiveCB ) |
---|
1349 | RCALL( "WcSetSensitiveCB", WcSetSensitiveCB ) |
---|
1350 | RCALL( "WcSetInsensitive", WcSetInsensitiveCB ) |
---|
1351 | RCALL( "WcSetInsensitiveCB", WcSetInsensitiveCB ) |
---|
1352 | RCALL( "WcPopup", WcPopupCB ) |
---|
1353 | RCALL( "WcPopupCB", WcPopupCB ) |
---|
1354 | RCALL( "WcPopupGrab", WcPopupGrabCB ) |
---|
1355 | RCALL( "WcPopupGrabCB", WcPopupGrabCB ) |
---|
1356 | RCALL( "WcPopdown", WcPopdownCB ) |
---|
1357 | RCALL( "WcPopdownCB", WcPopdownCB ) |
---|
1358 | RCALL( "WcMap", WcMapCB ) |
---|
1359 | RCALL( "WcMapCB", WcMapCB ) |
---|
1360 | RCALL( "WcUnmap", WcUnmapCB ) |
---|
1361 | RCALL( "WcUnmapCB", WcUnmapCB ) |
---|
1362 | RCALL( "WcInstallAccelerators", WcInstallAcceleratorsCB ) |
---|
1363 | RCALL( "WcInstallAcceleratorsCB", WcInstallAcceleratorsCB ) |
---|
1364 | RCALL( "WcInstallAllAccelerators", WcInstallAllAcceleratorsCB ) |
---|
1365 | RCALL( "WcInstallAllAcceleratorsCB", WcInstallAllAcceleratorsCB ) |
---|
1366 | RCALL( "WcCreateRoot", WcCreateRootCB ) |
---|
1367 | RCALL( "WcCreateRootCB", WcCreateRootCB ) |
---|
1368 | RCALL( "WcSpawn", WcSpawnCB ) |
---|
1369 | RCALL( "WcSpawnCB", WcSpawnCB ) |
---|
1370 | RCALL( "WcLoadResourceFile", WcLoadResourceFileCB ) |
---|
1371 | RCALL( "WcLoadResourceFileCB", WcLoadResourceFileCB ) |
---|
1372 | RCALL( "WcPrintTree", WcPrintTreeCB ) |
---|
1373 | RCALL( "WcPrintTreeCB", WcPrintTreeCB ) |
---|
1374 | RCALL( "WcDumpResources", WcDumpResourcesCB ) |
---|
1375 | RCALL( "WcDumpResourcesCB", WcDumpResourcesCB ) |
---|
1376 | RCALL( "WcSameSize", WcSameSizeCB ) |
---|
1377 | RCALL( "WcSameSizeCB", WcSameSizeCB ) |
---|
1378 | RCALL( "WcExit", WcExitCB ) |
---|
1379 | RCALL( "WcExitCB", WcExitCB ) |
---|
1380 | |
---|
1381 | /* Actually implemented as XtCallbackProcs: |
---|
1382 | */ |
---|
1383 | RCALL( "WcCreateChildren", WcCreateChildrenCB ) |
---|
1384 | RCALL( "WcCreateChildrenCB", WcCreateChildrenCB ) |
---|
1385 | RCALL( "WcCreatePopups", WcCreatePopupsCB ) |
---|
1386 | RCALL( "WcCreatePopupsCB", WcCreatePopupsCB ) |
---|
1387 | RCALL( "WcPositionTransient", WcPositionTransientCB ) |
---|
1388 | RCALL( "WcPositionTransientCB", WcPositionTransientCB ) |
---|
1389 | RCALL( "WcSetValues", WcSetValueCB ) |
---|
1390 | RCALL( "WcSetValuesCB", WcSetValueCB ) |
---|
1391 | RCALL( "WcSetValue", WcSetValueCB ) |
---|
1392 | RCALL( "WcSetValueCB", WcSetValueCB ) |
---|
1393 | RCALL( "WcTrace", WcTraceCB ) |
---|
1394 | RCALL( "WcTraceCB", WcTraceCB ) |
---|
1395 | RCALL( "WcSystem", WcSystemCB ) |
---|
1396 | RCALL( "WcSystemCB", WcSystemCB ) |
---|
1397 | RCALL( "WcAddCallbacks", WcAddCallbacksCB ) |
---|
1398 | RCALL( "WcAddCallbacksCB", WcAddCallbacksCB ) |
---|
1399 | RCALL( "WcRemoveCallbacks", WcRemoveCallbacksCB ) |
---|
1400 | RCALL( "WcRemoveCallbacksCB", WcRemoveCallbacksCB ) |
---|
1401 | RCALL( "WcOnceOnly", WcOnceOnlyCB ) |
---|
1402 | RCALL( "WcOnceOnlyCB", WcOnceOnlyCB ) |
---|
1403 | RCALL( "WcTranslations", WcTranslationsCB ) |
---|
1404 | RCALL( "WcTranslationsCB", WcTranslationsCB ) |
---|
1405 | RCALL( "WcDynamicAction", WcDynamicActionCB ) |
---|
1406 | RCALL( "WcDynamicActionCB", WcDynamicActionCB ) |
---|
1407 | RCALL( "WcDynamicCallback", WcDynamicCallbackCB ) |
---|
1408 | RCALL( "WcDynamicCallbackCB", WcDynamicCallbackCB ) |
---|
1409 | } |
---|
1410 | |
---|
1411 | /* |
---|
1412 | ******************************************************************************* |
---|
1413 | * Actions which simply invoke equivalent callbacks |
---|
1414 | ******************************************************************************* |
---|
1415 | */ |
---|
1416 | |
---|
1417 | #define ACT_INVOKES_CB( act, cb ) \ |
---|
1418 | void act( w, unused, params, num_params ) \ |
---|
1419 | Widget w; \ |
---|
1420 | XEvent* unused; \ |
---|
1421 | char** params; \ |
---|
1422 | Cardinal* num_params; \ |
---|
1423 | { \ |
---|
1424 | WcInvokeCallback( cb, w, params, num_params ); \ |
---|
1425 | } |
---|
1426 | |
---|
1427 | /*ARGSUSED*/ |
---|
1428 | ACT_INVOKES_CB( WcCreateChildrenACT, WcCreateChildrenCB ) |
---|
1429 | /*ARGSUSED*/ |
---|
1430 | ACT_INVOKES_CB( WcCreatePopupsACT, WcCreatePopupsCB ) |
---|
1431 | /*ARGSUSED*/ |
---|
1432 | ACT_INVOKES_CB( WcPositionTransientACT, WcPositionTransientCB ) |
---|
1433 | /*ARGSUSED*/ |
---|
1434 | ACT_INVOKES_CB( WcSetValueACT, WcSetValueCB ) |
---|
1435 | /*ARGSUSED*/ |
---|
1436 | ACT_INVOKES_CB( WcTraceACT, WcTraceCB ) |
---|
1437 | /*ARGSUSED*/ |
---|
1438 | ACT_INVOKES_CB( WcSystemACT, WcSystemCB ) |
---|
1439 | /*ARGSUSED*/ |
---|
1440 | ACT_INVOKES_CB( WcAddCallbacksACT, WcAddCallbacksCB ) |
---|
1441 | /*ARGSUSED*/ |
---|
1442 | ACT_INVOKES_CB( WcRemoveCallbacksACT, WcRemoveCallbacksCB ) |
---|
1443 | /*ARGSUSED*/ |
---|
1444 | ACT_INVOKES_CB( WcOnceOnlyACT, WcOnceOnlyCB ) |
---|
1445 | /*ARGSUSED*/ |
---|
1446 | ACT_INVOKES_CB( WcTranslationsACT, WcTranslationsCB ) |
---|
1447 | /*ARGSUSED*/ |
---|
1448 | ACT_INVOKES_CB( WcDynamicActionACT, WcDynamicActionCB ) |
---|
1449 | /*ARGSUSED*/ |
---|
1450 | ACT_INVOKES_CB( WcDynamicCallbackACT, WcDynamicCallbackCB ) |
---|
1451 | |
---|
1452 | /* -- WcRegisterWcActions |
---|
1453 | ******************************************************************************* |
---|
1454 | Register all Wcl supplied actions. Called from WcInitialize(), so |
---|
1455 | applications usually do not call this directly. |
---|
1456 | */ |
---|
1457 | |
---|
1458 | void WcRegisterWcActions ( app ) |
---|
1459 | XtAppContext app; |
---|
1460 | { |
---|
1461 | static XtActionsRec WcActions[] = { |
---|
1462 | |
---|
1463 | {"WcManage", WcManageACT }, |
---|
1464 | {"WcManageACT", WcManageACT }, |
---|
1465 | {"WcUnmanage", WcUnmanageACT }, |
---|
1466 | {"WcUnmanageACT", WcUnmanageACT }, |
---|
1467 | {"WcManageChildren", WcManageChildrenACT }, |
---|
1468 | {"WcManageChildrenACT", WcManageChildrenACT }, |
---|
1469 | {"WcUnmanageChildren", WcUnmanageChildrenACT }, |
---|
1470 | {"WcUnmanageChildrenACT", WcUnmanageChildrenACT }, |
---|
1471 | {"WcDestroy", WcDestroyACT }, |
---|
1472 | {"WcDestroyACT", WcDestroyACT }, |
---|
1473 | {"WcSetSensitive", WcSetSensitiveACT }, |
---|
1474 | {"WcSetSensitiveACT", WcSetSensitiveACT }, |
---|
1475 | {"WcSetInsensitive", WcSetInsensitiveACT }, |
---|
1476 | {"WcSetInsensitiveACT", WcSetInsensitiveACT }, |
---|
1477 | {"WcPopup", WcPopupACT }, |
---|
1478 | {"WcPopupACT", WcPopupACT }, |
---|
1479 | {"WcPopupGrab", WcPopupGrabACT }, |
---|
1480 | {"WcPopupGrabACT", WcPopupGrabACT }, |
---|
1481 | {"WcPopdown", WcPopdownACT }, |
---|
1482 | {"WcPopdownACT", WcPopdownACT }, |
---|
1483 | {"WcMap", WcMapACT }, |
---|
1484 | {"WcMapACT", WcMapACT }, |
---|
1485 | {"WcUnmap", WcUnmapACT }, |
---|
1486 | {"WcUnmapACT", WcUnmapACT }, |
---|
1487 | {"WcInstallAccelerators", WcInstallAcceleratorsACT }, |
---|
1488 | {"WcInstallAcceleratorsACT", WcInstallAcceleratorsACT }, |
---|
1489 | {"WcInstallAllAccelerators", WcInstallAllAcceleratorsACT }, |
---|
1490 | {"WcInstallAllAcceleratorsACT", WcInstallAllAcceleratorsACT }, |
---|
1491 | {"WcCreateRoot", WcCreateRootACT }, |
---|
1492 | {"WcCreateRootACT", WcCreateRootACT }, |
---|
1493 | {"WcSpawn", WcSpawnACT }, |
---|
1494 | {"WcSpawnACT", WcSpawnACT }, |
---|
1495 | {"WcLoadResourceFile", WcLoadResourceFileACT }, |
---|
1496 | {"WcLoadResourceFileACT", WcLoadResourceFileACT }, |
---|
1497 | {"WcPrintTree", WcPrintTreeACT }, |
---|
1498 | {"WcPrintTreeACT", WcPrintTreeACT }, |
---|
1499 | {"WcDumpResources", WcDumpResourcesACT }, |
---|
1500 | {"WcDumpResourcesACT", WcDumpResourcesACT }, |
---|
1501 | {"WcSameSize", WcSameSizeACT }, |
---|
1502 | {"WcSameSizeACT", WcSameSizeACT }, |
---|
1503 | {"WcExit", WcExitACT }, |
---|
1504 | {"WcExitACT", WcExitACT }, |
---|
1505 | |
---|
1506 | {"WcCreateChildren", WcCreateChildrenACT }, |
---|
1507 | {"WcCreateChildrenACT", WcCreateChildrenACT }, |
---|
1508 | {"WcCreatePopups", WcCreatePopupsACT }, |
---|
1509 | {"WcCreatePopupsACT", WcCreatePopupsACT }, |
---|
1510 | {"WcPositionTransient", WcPositionTransientACT }, |
---|
1511 | {"WcPositionTransientACT", WcPositionTransientACT }, |
---|
1512 | {"WcSetValues", WcSetValueACT }, |
---|
1513 | {"WcSetValuesACT", WcSetValueACT }, |
---|
1514 | {"WcSetValue", WcSetValueACT }, |
---|
1515 | {"WcSetValueACT", WcSetValueACT }, |
---|
1516 | {"WcTrace", WcTraceACT }, |
---|
1517 | {"WcTraceACT", WcTraceACT }, |
---|
1518 | {"WcSystem", WcSystemACT }, |
---|
1519 | {"WcSystemACT", WcSystemACT }, |
---|
1520 | {"WcAddCallbacks", WcAddCallbacksACT }, |
---|
1521 | {"WcAddCallbacksACT", WcAddCallbacksACT }, |
---|
1522 | {"WcRemoveCallbacks", WcRemoveCallbacksACT }, |
---|
1523 | {"WcRemoveCallbacksACT", WcRemoveCallbacksACT }, |
---|
1524 | {"WcOnceOnly", WcOnceOnlyACT }, |
---|
1525 | {"WcOnceOnlyACT", WcOnceOnlyACT }, |
---|
1526 | {"WcTranslations", WcTranslationsACT }, |
---|
1527 | {"WcTranslationsACT", WcTranslationsACT }, |
---|
1528 | {"WcDynamicAction", WcDynamicActionACT }, |
---|
1529 | {"WcDynamicActionACT", WcDynamicActionACT }, |
---|
1530 | {"WcDynamicCallback", WcDynamicCallbackACT }, |
---|
1531 | {"WcDynamicCallbackACT", WcDynamicCallbackACT }, |
---|
1532 | }; |
---|
1533 | |
---|
1534 | ONCE_PER_XtAppContext( app ); |
---|
1535 | |
---|
1536 | XtAppAddActions(app, WcActions, XtNumber(WcActions)); |
---|
1537 | } |
---|