Merge branch 'master' of https://git.code.sf.net/p/cdesktopenv/code
[oweals/cde.git] / cde / programs / ttsnoop / callbackChooser_stubs.C.src
1 /*** DTB_USER_CODE_START vvv Add file header below vvv ***/
2 //%%  (c) Copyright 1993, 1994 Hewlett-Packard Company
3 //%%  (c) Copyright 1993, 1994 International Business Machines Corp.
4 //%%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
5 //%%  (c) Copyright 1993, 1994 Novell, Inc.
6 //%%  $XConsortium: callbackChooser_stubs.C.src /main/3 1995/11/06 17:12:25 rswiston $
7 /*** DTB_USER_CODE_END   ^^^ Add file header above ^^^ ***/
8
9 /*
10  * File: callbackChooser_stubs.c
11  * Contains: Module callbacks and connection functions
12  *
13  * This file was generated by dtcodegen, from module callbackChooser
14  *
15  * Any text may be added between the DTB_USER_CODE_START and
16  * DTB_USER_CODE_END comments (even non-C code). Descriptive comments
17  * are provided only as an aid.
18  *
19  *  ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS.  **
20  *  ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR  **
21  *  ** DELETE THE GENERATED COMMENTS!                                 **
22  */
23
24 #include <stdio.h>
25 #include <Xm/Xm.h>
26 #include "dtb_utils.h"
27 #include "callbackChooser_ui.h"
28
29 /*
30  * Header files for cross-module connections
31  */
32 #include "ttsnoop_ui.h"
33
34
35 /**************************************************************************
36  *** DTB_USER_CODE_START
37  ***
38  *** All necessary header files have been included.
39  ***
40  *** Add include files, types, macros, externs, and user functions here.
41  ***/
42
43 #if defined(linux) || defined(CSRG_BASED)
44 #include <fstream>
45 #include <strstream>
46 #else
47 #include <fstream.h>
48 #include <strstream.h>
49 #endif
50
51 #include "DtTt.h"
52
53 extern std::ofstream snoopStream;
54
55 typedef enum {
56         DoJustPrint,
57         DoReply,
58         DoFail,
59         DoReject,
60         DoAccept,
61         DoAbstain,
62         DoOpen
63 } What2Do;
64
65 static void
66 _DtTtMsgCbChooserSet(
67         void *entity,
68         int isMessage,
69         const char *title
70 )
71 {
72         DtbCallbackChooserCallbackChooserInfo instance =
73                 &dtb_callback_chooser_callback_chooser;
74         if (! instance->initialized) {
75                 dtb_callback_chooser_callback_chooser_initialize(
76                         instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
77         }
78         XtVaSetValues( instance->callbackChooser, XmNtitle, title, 0 );
79         XtPointer xtPtr = (XtPointer)isMessage;
80         XtVaSetValues( instance->callbackAddButton, XmNuserData, xtPtr, 0 );
81         XtVaSetValues( instance->callbackAddCancelButton,
82                        XmNuserData, entity, 0 );
83         XtManageChild( instance->callbackChooser_shellform );
84 }
85
86 void
87 _DtTtMsgCbChooserSet(
88         Tt_pattern pat
89 )
90 {
91         _DtTtMsgCbChooserSet( pat, 0, "tt_pattern_callback_add" );
92 }
93
94 void
95 _DtTtMsgCbChooserSet(
96         Tt_message msg
97 )
98 {
99         _DtTtMsgCbChooserSet( msg, 1, "tt_message_callback_add" );
100 }
101
102 static Tt_callback_action
103 openIt(
104         Tt_message msg,
105         Tt_pattern pat
106 )
107 {
108         DtTtCreated( DTTT_MESSAGE, msg );
109         snoopIt( "Tt_message_callback", (void *) openIt, msg, pat, True );
110         Widget newWidget = DtTtMessageWidgetCreate(
111                             dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
112                             msg, DtTtMessageWidgetUpdate );
113         if (! tt_is_err( tt_ptr_error( newWidget ) )) {
114                 XRaiseWindow( XtDisplay( newWidget ),
115                               XtWindow( newWidget ));
116         }
117         return TT_CALLBACK_PROCESSED;
118 }
119
120 static Tt_callback_action
121 ucb(
122         Tt_message msg,
123         Tt_pattern pat,
124         Tt_message_callback func,
125         What2Do action,
126         Boolean destroy,
127         Boolean cont
128 )
129 {
130         DtTtCreated( DTTT_MESSAGE, msg );
131         if (snoopStream.bad()) {
132                 return TT_CALLBACK_CONTINUE;
133         }
134         snoopStream << "(Tt_message_callback)" << func << "( ";
135         snoopStream << "(Tt_message)" << (void *)msg << ", ";
136         snoopStream << "(Tt_pattern)" << (void *)pat << " ): ";
137         char *msgString = tt_message_print( msg );
138         Tt_status status = tt_ptr_error( msgString );
139         if (status == TT_OK) {
140                 snoopStream << endl << msgString << endl;
141         } else {
142                 snoopStream << status << endl;
143         }
144         tt_free( msgString );
145         Tt_status (*actionFunc)(Tt_message) = 0;
146         char *actionFuncName = 0;
147         switch (action) {
148             default:
149             case DoJustPrint:
150                 break;
151             case DoReply:
152                 actionFunc = tt_message_reply;
153                 actionFuncName = "tt_message_reply";
154                 break;
155             case DoFail:
156                 actionFunc = tt_message_fail;
157                 actionFuncName = "tt_message_fail";
158                 break;
159             case DoReject:
160                 actionFunc = tt_message_reject;
161                 actionFuncName = "tt_message_reject";
162                 break;
163             case DoAccept:
164                 actionFunc = tt_message_accept;
165                 actionFuncName = "tt_message_accept";
166                 break;
167             case DoAbstain:
168                 destroy = 1;
169                 break;
170         }
171         if (actionFunc != 0) {
172                 snoopStream << func << "(): " << actionFuncName << "("
173                         << msg << ") = "
174                         << (*actionFunc)( msg ) << endl;
175         }
176         if (destroy) {
177                 status = tttk_message_destroy( msg );
178                 snoopStream << func << "(): tttk_message_destroy("
179                         << msg << ") = " << status << endl;
180                 if (status == TT_OK) {
181                         DtTtDestroyed( DTTT_MESSAGE, msg );
182                 }
183         }
184         Tt_callback_action val = TT_CALLBACK_PROCESSED;
185         if (cont) {
186                 val = TT_CALLBACK_CONTINUE;
187         }
188         snoopStream << func << "(): return " << val << endl;
189         return val;
190 }
191
192 static Tt_callback_action
193 mcbJustPrint_Cont( Tt_message m, Tt_pattern p ) {
194         return ucb( m, p, mcbJustPrint_Cont, DoJustPrint, 0, 0 ); }
195 static Tt_callback_action
196 mcbJustPrint_Done( Tt_message m, Tt_pattern p ) {
197         return ucb( m, p, mcbJustPrint_Done, DoJustPrint, 0, 1 ); }
198 static Tt_callback_action
199 mcbJustPrint_Destroy_Cont( Tt_message m, Tt_pattern p ) {
200         return ucb( m, p, mcbJustPrint_Destroy_Cont, DoJustPrint, 1, 0 ); }
201 static Tt_callback_action
202 mcbJustPrint_Destroy_Done( Tt_message m, Tt_pattern p ) {
203         return ucb( m, p, mcbJustPrint_Destroy_Done, DoJustPrint, 1, 1 ); }
204 static Tt_callback_action
205 mcbReply_Cont( Tt_message m, Tt_pattern p ) {
206         return ucb( m, p, mcbReply_Cont, DoReply, 0, 0 ); }
207 static Tt_callback_action
208 mcbReply_Done( Tt_message m, Tt_pattern p ) {
209         return ucb( m, p, mcbReply_Done, DoReply, 0, 1 ); }
210 static Tt_callback_action
211 mcbReply_Destroy_Cont( Tt_message m, Tt_pattern p ) {
212         return ucb( m, p, mcbReply_Destroy_Cont, DoReply, 1, 0 ); }
213 static Tt_callback_action
214 mcbReply_Destroy_Done( Tt_message m, Tt_pattern p ) {
215         return ucb( m, p, mcbReply_Destroy_Done, DoReply, 1, 1 ); }
216 static Tt_callback_action
217 mcbFail_Cont( Tt_message m, Tt_pattern p ) {
218         return ucb( m, p, mcbFail_Cont, DoFail, 0, 0 ); }
219 static Tt_callback_action
220 mcbFail_Done( Tt_message m, Tt_pattern p ) {
221         return ucb( m, p, mcbFail_Done, DoFail, 0, 1 ); }
222 static Tt_callback_action
223 mcbFail_Destroy_Cont( Tt_message m, Tt_pattern p ) {
224         return ucb( m, p, mcbFail_Destroy_Cont, DoFail, 1, 0 ); }
225 static Tt_callback_action
226 mcbFail_Destroy_Done( Tt_message m, Tt_pattern p ) {
227         return ucb( m, p, mcbFail_Destroy_Done, DoFail, 1, 1 ); }
228 static Tt_callback_action
229 mcbReject_Cont( Tt_message m, Tt_pattern p ) {
230         return ucb( m, p, mcbReject_Cont, DoReject, 0, 0 ); }
231 static Tt_callback_action
232 mcbReject_Done( Tt_message m, Tt_pattern p ) {
233         return ucb( m, p, mcbReject_Done, DoReject, 0, 1 ); }
234 static Tt_callback_action
235 mcbReject_Destroy_Cont( Tt_message m, Tt_pattern p ) {
236         return ucb( m, p, mcbReject_Destroy_Cont, DoReject, 1, 0 ); }
237 static Tt_callback_action
238 mcbReject_Destroy_Done( Tt_message m, Tt_pattern p ) {
239         return ucb( m, p, mcbReject_Destroy_Done, DoReject, 1, 1 ); }
240 static Tt_callback_action
241 mcbAccept_Cont( Tt_message m, Tt_pattern p ) {
242         return ucb( m, p, mcbAccept_Cont, DoAccept, 0, 0 ); }
243 static Tt_callback_action
244 mcbAccept_Done( Tt_message m, Tt_pattern p ) {
245         return ucb( m, p, mcbAccept_Done, DoAccept, 0, 1 ); }
246 static Tt_callback_action
247 mcbAccept_Destroy_Cont( Tt_message m, Tt_pattern p ) {
248         return ucb( m, p, mcbAccept_Destroy_Cont, DoAccept, 1, 0 ); }
249 static Tt_callback_action
250 mcbAccept_Destroy_Done( Tt_message m, Tt_pattern p ) {
251         return ucb( m, p, mcbAccept_Destroy_Done, DoAccept, 1, 1 ); }
252 static Tt_callback_action
253 mcbAbstain_Cont( Tt_message m, Tt_pattern p ) {
254         return ucb( m, p, mcbAbstain_Cont, DoAbstain, 0, 0 ); }
255 static Tt_callback_action
256 mcbAbstain_Done( Tt_message m, Tt_pattern p ) {
257         return ucb( m, p, mcbAbstain_Done, DoAbstain, 0, 1 ); }
258 static Tt_callback_action
259 mcbAbstain_Destroy_Cont( Tt_message m, Tt_pattern p ) {
260         return ucb( m, p, mcbAbstain_Destroy_Cont, DoAbstain, 1, 0 ); }
261 static Tt_callback_action
262 mcbAbstain_Destroy_Done( Tt_message m, Tt_pattern p ) {
263         return ucb( m, p, mcbAbstain_Destroy_Done, DoAbstain, 1, 1 ); }
264
265 Tt_message_callback callbacks[] = 
266 {
267         mcbJustPrint_Cont,
268         mcbJustPrint_Done,
269         mcbJustPrint_Destroy_Cont,
270         mcbJustPrint_Destroy_Done,
271         mcbReply_Cont,
272         mcbReply_Done,
273         mcbReply_Destroy_Cont,
274         mcbReply_Destroy_Done,
275         mcbFail_Cont,
276         mcbFail_Done,
277         mcbFail_Destroy_Cont,
278         mcbFail_Destroy_Done,
279         mcbReject_Cont,
280         mcbReject_Done,
281         mcbReject_Destroy_Cont,
282         mcbReject_Destroy_Done,
283         mcbAccept_Cont,
284         mcbAccept_Done,
285         mcbAccept_Destroy_Cont,
286         mcbAccept_Destroy_Done,
287         mcbAbstain_Cont,
288         mcbAbstain_Done,
289         mcbAbstain_Destroy_Cont,
290         mcbAbstain_Destroy_Done
291 };
292
293 /*** DTB_USER_CODE_END
294  ***
295  *** End of user code section
296  ***
297  **************************************************************************/
298
299
300
301 void 
302 callbackChooser_callbackAddCancelButton_CB1(
303     Widget widget,
304     XtPointer clientData,
305     XtPointer callData
306 )
307 {
308     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
309     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
310     
311     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
312     
313     if (!(instance->initialized))
314     {
315         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
316     }
317     XtUnmanageChild(instance->callbackChooser_shellform);
318     
319     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
320     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
321 }
322
323
324 void 
325 callbackChooser_msgActionChoice_Open_item_CB1(
326     Widget widget,
327     XtPointer clientData,
328     XtPointer callData
329 )
330 {
331     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
332     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
333     
334     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
335     
336     if (!(instance->initialized))
337     {
338         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
339     }
340
341     XtSetSensitive(instance->msgDestroyChoice, False);
342     
343     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
344     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
345 }
346
347
348 void 
349 callbackChooser_msgActionChoice_Open_item_CB2(
350     Widget widget,
351     XtPointer clientData,
352     XtPointer callData
353 )
354 {
355     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
356     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
357     
358     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
359     
360     if (!(instance->initialized))
361     {
362         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
363     }
364
365     XtSetSensitive(instance->msgReturnChoice, False);
366     
367     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
368     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
369 }
370
371
372 void 
373 callbackChooser_msgActionChoice_Print_item_CB1(
374     Widget widget,
375     XtPointer clientData,
376     XtPointer callData
377 )
378 {
379     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
380     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
381     
382     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
383     
384     if (!(instance->initialized))
385     {
386         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
387     }
388
389     XtSetSensitive(instance->msgDestroyChoice, True);
390     
391     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
392     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
393 }
394
395
396 void 
397 callbackChooser_msgActionChoice_Accept_item_CB1(
398     Widget widget,
399     XtPointer clientData,
400     XtPointer callData
401 )
402 {
403     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
404     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
405     
406     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
407     
408     if (!(instance->initialized))
409     {
410         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
411     }
412
413     XtSetSensitive(instance->msgDestroyChoice, True);
414     
415     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
416     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
417 }
418
419
420 void 
421 callbackChooser_msgActionChoice_Accept_item_CB2(
422     Widget widget,
423     XtPointer clientData,
424     XtPointer callData
425 )
426 {
427     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
428     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
429     
430     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
431     
432     if (!(instance->initialized))
433     {
434         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
435     }
436
437     XtSetSensitive(instance->msgReturnChoice, True);
438     
439     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
440     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
441 }
442
443
444 void 
445 callbackChooser_msgActionChoice_Print_item_CB2(
446     Widget widget,
447     XtPointer clientData,
448     XtPointer callData
449 )
450 {
451     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
452     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
453     
454     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
455     
456     if (!(instance->initialized))
457     {
458         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
459     }
460
461     XtSetSensitive(instance->msgReturnChoice, True);
462     
463     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
464     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
465 }
466
467
468 void 
469 callbackChooser_msgActionChoice_Abstain_item_CB1(
470     Widget widget,
471     XtPointer clientData,
472     XtPointer callData
473 )
474 {
475     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
476     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
477     
478     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
479     
480     if (!(instance->initialized))
481     {
482         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
483     }
484
485     XtSetSensitive(instance->msgReturnChoice, True);
486     
487     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
488     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
489 }
490
491
492 void 
493 callbackChooser_msgActionChoice_Abstain_item_CB2(
494     Widget widget,
495     XtPointer clientData,
496     XtPointer callData
497 )
498 {
499     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
500     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
501     
502     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
503     
504     if (!(instance->initialized))
505     {
506         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
507     }
508
509     XtSetSensitive(instance->msgDestroyChoice, True);
510     
511     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
512     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
513 }
514
515
516 void 
517 callbackChooser_msgActionChoice_Reply_item_CB1(
518     Widget widget,
519     XtPointer clientData,
520     XtPointer callData
521 )
522 {
523     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
524     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
525     
526     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
527     
528     if (!(instance->initialized))
529     {
530         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
531     }
532
533     XtSetSensitive(instance->msgDestroyChoice, True);
534     
535     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
536     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
537 }
538
539
540 void 
541 callbackChooser_msgActionChoice_Reply_item_CB2(
542     Widget widget,
543     XtPointer clientData,
544     XtPointer callData
545 )
546 {
547     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
548     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
549     
550     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
551     
552     if (!(instance->initialized))
553     {
554         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
555     }
556
557     XtSetSensitive(instance->msgReturnChoice, True);
558     
559     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
560     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
561 }
562
563
564 void 
565 callbackChooser_msgActionChoice_Reject_item_CB1(
566     Widget widget,
567     XtPointer clientData,
568     XtPointer callData
569 )
570 {
571     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
572     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
573     
574     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
575     
576     if (!(instance->initialized))
577     {
578         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
579     }
580
581     XtSetSensitive(instance->msgReturnChoice, True);
582     
583     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
584     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
585 }
586
587
588 void 
589 callbackChooser_msgActionChoice_Reject_item_CB2(
590     Widget widget,
591     XtPointer clientData,
592     XtPointer callData
593 )
594 {
595     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
596     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
597     
598     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
599     
600     if (!(instance->initialized))
601     {
602         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
603     }
604
605     XtSetSensitive(instance->msgDestroyChoice, True);
606     
607     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
608     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
609 }
610
611
612 void 
613 callbackChooser_msgActionChoice_Fail_item_CB1(
614     Widget widget,
615     XtPointer clientData,
616     XtPointer callData
617 )
618 {
619     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
620     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
621     
622     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
623     
624     if (!(instance->initialized))
625     {
626         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
627     }
628
629     XtSetSensitive(instance->msgDestroyChoice, True);
630     
631     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
632     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
633 }
634
635
636 void 
637 callbackChooser_msgActionChoice_Fail_item_CB2(
638     Widget widget,
639     XtPointer clientData,
640     XtPointer callData
641 )
642 {
643     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
644     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
645     
646     DtbCallbackChooserCallbackChooserInfo       instance = (DtbCallbackChooserCallbackChooserInfo)clientData;
647     
648     if (!(instance->initialized))
649     {
650         dtb_callback_chooser_callback_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
651     }
652
653     XtSetSensitive(instance->msgReturnChoice, True);
654     
655     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
656     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
657 }
658
659
660 void 
661 callbackOkayed(
662     Widget widget,
663     XtPointer clientData,
664     XtPointer callData
665 )
666 {
667     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
668     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
669     
670     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
671     DtbCallbackChooserCallbackChooserInfo instance =
672             (DtbCallbackChooserCallbackChooserInfo)clientData;
673     Tt_message msg = 0;
674     Tt_pattern pat = 0;
675     XtPointer xtPtr = 0;
676     int isMessage = 0;
677     XtVaGetValues( instance->callbackAddButton, XmNuserData, &xtPtr, 0 );
678     isMessage = (int) (long) xtPtr;
679     XtVaGetValues( instance->callbackAddCancelButton, XmNuserData, &xtPtr, 0 );
680     msg = (Tt_message)xtPtr;
681     pat = (Tt_pattern)xtPtr;
682
683     What2Do action = DoOpen;
684     Widget actionWidget;
685     XtVaGetValues( instance->msgActionChoice,
686                    XmNmenuHistory, &actionWidget, 0 );
687     if (actionWidget == instance->msgActionChoice_items.Open_item) {
688             action = DoOpen;
689     } else if (actionWidget == instance->msgActionChoice_items.Print_item) {
690             action = DoJustPrint;
691     } else if (actionWidget == instance->msgActionChoice_items.Accept_item) {
692             action = DoAccept;
693     } else if (actionWidget == instance->msgActionChoice_items.Abstain_item) {
694             action = DoAbstain;
695     } else if (actionWidget == instance->msgActionChoice_items.Reply_item) {
696             action = DoReply;
697     } else if (actionWidget == instance->msgActionChoice_items.Reject_item) {
698             action = DoReject;
699     } else if (actionWidget == instance->msgActionChoice_items.Fail_item) {
700             action = DoFail;
701     }
702
703     int destroy = 0;
704     Boolean destroyBool;
705     XtVaGetValues( instance->msgDestroyChoice_items.Destroy_item,
706                    XmNset, &destroyBool, 0 );
707     if (destroyBool) {
708             destroy = 1;
709     }
710
711     Tt_callback_action returnVal = TT_CALLBACK_CONTINUE;
712     Widget returnWidget;
713     XtVaGetValues( instance->msgReturnChoice,
714                    XmNmenuHistory, &returnWidget, 0 );
715     if (returnWidget == instance->msgReturnChoice_items.PROCESSED_item) {
716             returnVal = TT_CALLBACK_PROCESSED;
717     }
718
719     Tt_message_callback func;
720     switch (action) {
721         case DoOpen:
722             func = openIt;
723             break;
724         case DoJustPrint:
725         case DoReply:
726         case DoFail:
727         case DoReject:
728         case DoAccept:
729         case DoAbstain:
730             func = callbacks[ ((int)action)*4 + destroy*2 + (int)returnVal ];
731             break;
732     }
733     if (isMessage) {
734             _DtTtMessageUpdate( msg, func );
735     } else {
736             _DtTtPatternUpdate( pat, func );
737     }
738     XtUnmanageChild( instance->callbackChooser_shellform );
739     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
740 }
741
742
743 void 
744 callbackHelp(
745     Widget widget,
746     XtPointer clientData,
747     XtPointer callData
748 )
749 {
750     /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
751     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
752     
753     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
754     DtbCallbackChooserCallbackChooserInfo instance =
755             (DtbCallbackChooserCallbackChooserInfo)clientData;
756     XtPointer xtPtr = 0;
757     int isMessage = 0;
758     XtVaGetValues( instance->callbackAddButton, XmNuserData, &xtPtr, 0 );
759     isMessage = (int) (long) xtPtr;
760     Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
761     if (isMessage) {
762             _DtMan( label, "tt_message_callback_add" );
763     } else {
764             _DtMan( label, "tt_pattern_callback_add" );
765     }
766     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
767 }
768
769
770
771 /**************************************************************************
772  *** DTB_USER_CODE_START
773  ***
774  *** All automatically-generated data and functions have been defined.
775  ***
776  *** Add new functions here, or at the top of the file.
777  ***/
778
779 /*** DTB_USER_CODE_END
780  ***
781  *** End of user code section
782  ***
783  **************************************************************************/
784
785