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