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: sessionChooser_stubs.C.src /main/3 1995/11/06 17:13:45 rswiston $
7 /*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
10 * File: sessionChooser_stubs.c
11 * Contains: Module callbacks and connection functions
13 * This file was generated by dtcodegen, from module sessionChooser
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.
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! **
26 #include "dtb_utils.h"
27 #include "sessionChooser_ui.h"
30 * Header files for cross-module connections
32 #include "ttsnoop_ui.h"
35 /**************************************************************************
36 *** DTB_USER_CODE_START
38 *** All necessary header files have been included.
40 *** Add include files, types, macros, externs, and user functions here.
45 #if defined(linux) || defined(CSRG_BASED)
50 #include <strstream.h>
55 extern std::ofstream snoopStream;
59 _DtSessionChooserAction choice,
67 case _DtSessionChoosePattern:
69 title = "tt_pattern_session_add";
71 case _DtSessionChooseMessage:
73 title = "tt_message_session_set";
75 case _DtSessionChooseJoin:
77 title = "tt_session_join";
79 case _DtSessionChooseDtJoin:
81 title = "ttdt_session_join";
83 case _DtSessionChooseQuit:
85 title = "tt_session_quit";
87 case _DtSessionChooseDefault:
89 title = "tt_default_session_set";
94 DtbSessionChooserSessionChooserInfo instance =
95 &dtb_session_chooser_session_chooser;
96 if (! instance->initialized) {
97 dtb_session_chooser_session_chooser_initialize(
98 instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin );
100 DtTtSetLabel( instance->sessionOkButton, okString );
101 XtVaSetValues( instance->sessionChooser, XmNtitle, title, 0 );
102 // Remember dialog mode, entity
103 XtVaSetValues( instance->sessionOkButton, XmNuserData, choice, 0 );
104 XtVaSetValues( instance->sessionCancelButton, XmNuserData, entity, 0 );
105 XmTextPosition last =
106 XmTextFieldGetLastPosition( instance->sessionText );
108 XtLastTimestampProcessed( XtDisplay( instance->sessionText ));
109 XmTextFieldSetSelection( instance->sessionText, 0, last, when );
110 XtManageChild( instance->sessionChooser_shellform );
120 DtTtCreated( DTTT_MESSAGE, msg );
121 snoopIt( "Ttdt_contract_cb", (void *) snoopSessionMsg, msg );
122 if ( (tt_message_class( msg ) == TT_REQUEST)
123 && (tt_message_state( msg ) == TT_SENT))
125 // Let user fill in the answer
126 Widget newWidget = DtTtMessageWidgetCreate(
127 dtb_ttsnoop_ttsnoop_win.ttsnoopWin,
128 msg, DtTtMessageWidgetUpdate );
129 if (! tt_is_err( tt_ptr_error( newWidget ) )) {
130 XRaiseWindow( XtDisplay( newWidget ),
131 XtWindow( newWidget ));
137 /*** DTB_USER_CODE_END
139 *** End of user code section
141 **************************************************************************/
146 sessionChooser_sessionCancelButton_CB1(
148 XtPointer clientData,
152 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
153 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
155 DtbSessionChooserSessionChooserInfo instance = (DtbSessionChooserSessionChooserInfo)clientData;
157 if (!(instance->initialized))
159 dtb_session_chooser_session_chooser_initialize(instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
161 XtUnmanageChild(instance->sessionChooser_shellform);
163 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
164 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
171 XtPointer clientData,
175 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
176 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
178 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
179 DtbSessionChooserSessionChooserInfo instance =
180 (DtbSessionChooserSessionChooserInfo)clientData;
181 char *sess = tt_default_session();
182 Tt_status status = DtTtSetLabel( instance->sessionChooser_label,
183 "tt_default_session()", sess );
184 if (tt_is_err( status )) {
187 XmTextFieldSetString( instance->sessionText, sess );
189 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
196 XtPointer clientData,
200 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
201 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
203 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
204 DtbSessionChooserSessionChooserInfo instance =
205 (DtbSessionChooserSessionChooserInfo)clientData;
206 char *session = XmTextFieldGetString( instance->sessionText );
207 if ((session != 0) && (session[0] == '\0')) {
212 XtVaGetValues( instance->sessionOkButton, XmNuserData, &val, 0 );
213 _DtSessionChooserAction choice = (_DtSessionChooserAction) (long) val;
214 XtVaGetValues( instance->sessionCancelButton, XmNuserData, &val, 0 );
215 Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
219 case _DtSessionChoosePattern:
220 _DtTtPatternUpdate( (Tt_pattern)val, choice, session );
222 case _DtSessionChooseMessage:
223 _DtTtMessageUpdate( (Tt_message)val, choice, session );
225 case _DtSessionChooseJoin:
226 status = tt_session_join( session );
227 DtTtSetLabel( label, "tt_session_join()", status );
229 case _DtSessionChooseDtJoin:
230 pats = ttdt_session_join( session, snoopSessionMsg,
231 dtb_ttsnoop_ttsnoop_win.ttsnoopWin, 0, 1 );
232 status = DtTtSetLabel( label, "ttdt_session_join()", pats );
233 if ((status == TT_OK) && (pats != 0)) {
234 DtTtCreated( DTTT_DTSESSION, pats, session );
237 case _DtSessionChooseQuit:
238 status = tt_session_quit( session );
239 DtTtSetLabel( label, "tt_session_quit()", status );
241 case _DtSessionChooseDefault:
242 status = tt_default_session_set( session );
243 DtTtSetLabel( label, "tt_default_session_set()", status );
251 XtUnmanageChild(instance->sessionChooser_shellform);
252 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
259 XtPointer clientData,
263 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
264 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
266 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
267 DtbSessionChooserSessionChooserInfo instance =
268 (DtbSessionChooserSessionChooserInfo)clientData;
270 XtVaGetValues( instance->sessionOkButton, XmNuserData, &val, 0 );
271 _DtSessionChooserAction choice = (_DtSessionChooserAction) (long) val;
272 Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
274 case _DtSessionChoosePattern:
275 _DtMan( label, "tt_pattern_session_add" );
277 case _DtSessionChooseMessage:
278 _DtMan( label, "tt_message_session_set" );
280 case _DtSessionChooseJoin:
281 _DtMan( label, "tt_session_join" );
283 case _DtSessionChooseDtJoin:
284 _DtMan( label, "ttdt_session_join" );
286 case _DtSessionChooseQuit:
287 _DtMan( label, "tt_session_quit" );
289 case _DtSessionChooseDefault:
290 _DtMan( label, "tt_default_session_set" );
295 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
302 XtPointer clientData,
306 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
307 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
309 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
310 DtbSessionChooserSessionChooserInfo instance =
311 (DtbSessionChooserSessionChooserInfo)clientData;
312 char *sess = tt_X_session( getenv( "DISPLAY" ));
313 Tt_status status = DtTtSetLabel( instance->sessionChooser_label,
314 "tt_X_session( getenv( \"DISPLAY\" ))", sess );
315 if (tt_is_err( status )) {
318 XmTextFieldSetString( instance->sessionText, sess );
320 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
327 XtPointer clientData,
331 /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
332 /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
334 /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
335 DtbSessionChooserSessionChooserInfo instance =
336 (DtbSessionChooserSessionChooserInfo)clientData;
337 char *sess = tt_initial_session();
338 Tt_status status = DtTtSetLabel( instance->sessionChooser_label,
339 "tt_initial_session()", sess );
340 if (tt_is_err( status )) {
343 XmTextFieldSetString( instance->sessionText, sess );
345 /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
350 /**************************************************************************
351 *** DTB_USER_CODE_START
353 *** All automatically-generated data and functions have been defined.
355 *** Add new functions here, or at the top of the file.
358 /*** DTB_USER_CODE_END
360 *** End of user code section
362 **************************************************************************/