callbackChooser_stubs.C.src 23 KB

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