459cb8819866d71913dae946c2527bf61bd106d0
[oweals/cde.git] / cde / programs / ttsnoop / DtTt.h
1 //%%  (c) Copyright 1993, 1994 Hewlett-Packard Company
2 //%%  (c) Copyright 1993, 1994 International Business Machines Corp.
3 //%%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
4 //%%  (c) Copyright 1993, 1994 Novell, Inc.
5 //%%  $XConsortium: DtTt.h /main/5 1996/03/19 10:48:06 barstow $
6 #ifndef DTTT_H
7 #define DTTT_H
8
9 #include <Tt/tttk.h>
10 #include "tt_c++.h"
11 #include "ttChooser_ui.h"
12 #include "stringChooser_ui.h"
13
14 typedef enum {
15         DTTT_PROCID,
16         DTTT_MESSAGE,
17         DTTT_PATTERN,
18         DTTT_PTYPE,
19         DTTT_OTYPE,
20         DTTT_OBJECT,
21         DTTT_SESSION,
22         DTTT_DTSESSION,
23         DTTT_DTFILE,
24         DTTT_OP
25 } DtTtType;
26
27 typedef enum {
28         _DtTtChooserNone,
29         _DtTtChooserMessageOpen,
30         _DtTtChooserMessageCreateStandard,
31         _DtTtChooserMessageOpSet,
32         _DtTtChooserMessageHandlerSet,
33         _DtTtChooserMessageDestroy,
34         _DtTtChooserPatternOpen,
35         _DtTtChooserPatternOpAdd,
36         _DtTtChooserPatternSenderAdd,
37         _DtTtChooserPatternDestroy,
38         _DtTtChooserDtSessionQuit,
39         _DtTtChooserDtFileDeleted,
40         _DtTtChooserDtFileModified,
41         _DtTtChooserDtFileReverted,
42         _DtTtChooserDtFileMoved,
43         _DtTtChooserDtFileSaved,
44         _DtTtChooserDtFileQuit,
45         _DtTtChooserProcidSetDefault,
46         _DtTtChooserProcidSuspend,
47         _DtTtChooserProcidResume,
48         _DtTtChooserDtProcidClose
49 } _DtTtChooserAction;
50
51 typedef enum {
52         _DtStringChooseNone,
53         _DtStringChoosePatternOp,
54         _DtStringChoosePatternOtype,
55         _DtStringChoosePatternObject,
56         _DtStringChoosePatternSenderPtype,
57         _DtStringChooseMessageOtype,
58         _DtStringChooseMessageObject,
59         _DtStringChooseMessageHandlerPtype,
60         _DtStringChooseMessageSenderPtype,
61         _DtStringChooseMessageStatusString,
62         _DtStringChooseMessageArgValSet,
63         _DtStringChoosePtype2Declare,
64         _DtStringChooseMediaPtype2Declare,
65         _DtStringChoosePtype2UnDeclare,
66         _DtStringChoosePtype2SetDefault,
67         _DtStringChoosePtype2Exists,
68         _DtStringChooseSystem,
69         _DtStringChoosePutenv,
70         _DtStringChooseNetfile2File
71 } _DtStringChooserAction;
72
73 typedef enum {
74         _DtSessionChooseNone,
75         _DtSessionChoosePattern,
76         _DtSessionChooseMessage,
77         _DtSessionChooseJoin,
78         _DtSessionChooseDtJoin,
79         _DtSessionChooseQuit,
80         _DtSessionChooseDefault
81 } _DtSessionChooserAction;
82
83 typedef enum {
84         _DtFileChooseNone,
85         _DtFileChoosePatternAdd,
86         _DtFileChooseMessageSet,
87         _DtFileChooseJoin,
88         _DtFileChooseDtJoin,
89         _DtFileChooseQuit,
90         _DtFileChooseDefault,
91         _DtFileChooseGetModified,
92         _DtFileChooseSave,
93         _DtFileChooseRevert,
94         _DtFileChooseNetfile,
95         _DtFileChooseChdir,
96         _DtFileChooseTypesLoad
97 } _DtFileChooserAction;
98
99 typedef enum {  // invariant: IArgAdd == ArgAdd + 1
100         _DtArgChooseNone,
101         _DtArgChoosePatternArgAdd,
102         _DtArgChoosePatternIArgAdd,
103         _DtArgChoosePatternContextAdd,
104         _DtArgChoosePatternIContextAdd,
105         _DtArgChooseMessageArgAdd,
106         _DtArgChooseMessageIArgAdd,
107         _DtArgChooseMessageArgSet,
108         _DtArgChooseMessageIArgSet,
109         _DtArgChooseMessageContextSet,
110         _DtArgChooseMessageIContextSet,
111         _DtArgChooseContextJoin,
112         _DtArgChooseIContextJoin,
113         _DtArgChooseContextQuit,
114         _DtArgChooseIContextQuit
115 } _DtArgChooserAction;
116
117 typedef void            (*DtTtMessageUpdateCallback)(
118                                 Widget          propsWin,
119                                 Tt_message      msg,
120                                 Tt_state        oldState,
121                                 Tt_status       lastOperation,
122                                 Boolean         stillExists
123                         );
124
125 /*
126  * Returns elem2Append on success, 0 on failure
127  */
128 #define listAppend( list, listCount, type, elem2Append )                \
129         (  listGrow( (void **)&list, listCount, sizeof( type ) )        \
130          ? (list[ listCount - 1 ] = elem2Append)                        \
131          : 0 )
132
133 int                     listGrow(
134                                 void **         pList,
135                                 unsigned int &  listCount,
136                                 size_t          elemSize
137                         );
138
139 XmString                DtTtStatusString(
140                                 Tt_status       type
141                         );
142 Tt_status               DtTtCreated(
143                                 DtTtType        type,
144                                 const void *    entity,
145                                 const void *    clientData = 0
146                         );
147 Tt_status               DtTtCreated(
148                                 DtTtType        type,
149                                 Tt_pattern *    entity,
150                                 const char *    name
151                         );
152 void *                  DtTtNth(
153                                 DtTtType        type,
154                                 int             n
155                         );
156 void *                  DtTtNthClientDatum(
157                                 DtTtType        type,
158                                 int             n
159                         );
160 void                    DtTtNthClientDatumSet(
161                                 DtTtType        type,
162                                 int             n,
163                                 const void *    clientData
164                         );
165 int                     DtTtIndex(
166                                 DtTtType        type,
167                                 const void *    entity
168                         );
169 Tt_status               DtTtDestroyed(
170                                 DtTtType        type,
171                                 const void *    entity
172                         );
173 void                    DtTtMessageWidgetUpdate(
174                                 Widget          propsWin,
175                                 Tt_message      msg,
176                                 Tt_state        oldState,
177                                 Tt_status       lastOperation,
178                                 Boolean         stillExists
179                         );
180 Widget                  DtTtMessageWidgetCreate(
181                                 Widget                  parent,
182                                 Tt_message              msg,
183                                 DtTtMessageUpdateCallback       notifyProc
184                         );
185 Widget                  DtTtMessageWidget(
186                                 Tt_message              msg
187                         );
188 Widget                  DtTtPatternWidgetCreate(
189                                 Widget                  parent,
190                                 Tt_pattern              msg,
191                                 Tt_message_callback     notifyProc
192                         );
193 Widget                  DtTtPatternWidget(
194                                 Tt_pattern              pat
195                         );
196 Tt_status               DtTtSetLabel(
197                                 Widget                  labelWidget,
198                                 const char *            string
199                         );
200 Tt_status               DtTtSetLabel(
201                                 Widget                  labelWidget,
202                                 const char *            funcName,
203                                 void *                  returnVal
204                         );
205 Tt_status               DtTtSetLabel(
206                                 Widget                  labelWidget,
207                                 const char *            funcName,
208                                 Tt_status               returnVal
209                         );
210 int                     DtTtSetLabel(
211                                 Widget                  labelWidget,
212                                 const char *            funcName,
213                                 int                     returnVal
214                         );
215
216 void                    _DtTtChooserSet(
217                                 _DtTtChooserAction      choice,
218                                 void *                  item = 0
219                         );
220 XmString *              _DtTtChoices(
221                                 DtTtType                type,
222                                 int *                   itemCount
223                         );
224 void                    _DtStringChooserSet(
225                                 _DtStringChooserAction  choice,
226                                 void *                  item
227                         );
228 void                    _DtStringChooserSet(
229                                 _DtStringChooserAction  choice,
230                                 void *                  item,
231                                 const char *            val
232                         );
233 void                    _DtSessionChooserSet(
234                                 _DtSessionChooserAction choice,
235                                 void *                  item
236                         );
237 void                    _DtFileChooserSet(
238                                 _DtFileChooserAction    choice,
239                                 void *                  item
240                         );
241 void                    _DtArgChooserSet(
242                                 _DtArgChooserAction     choice,
243                                 void *                  item,
244                                 int                     nth     = 0
245                         );
246 void                    _DtArgChooserSet(
247                                 _DtArgChooserAction     choice,
248                                 void *                  item,
249                                 int                     nth,
250                                 Tt_mode                 mode,
251                                 Boolean                 noValue = True,
252                                 char *                  vtype   = 0,
253                                 char *                  val     = 0,
254                                 int                     ival    = 0
255                         );
256 void                    _DtTtMsgCbChooserSet(
257                                 Tt_message              msg
258                         );
259 void                    _DtTtMsgCbChooserSet(
260                                 Tt_pattern              pat
261                         );
262 Tt_message              _DtTtMediaLoadPatCb(
263                                 Tt_message      msg,
264                                 void           *clientdata,
265                                 Tttk_op         op,
266                                 Tt_status       diagnosis,
267                                 unsigned char  *contents,
268                                 int             len,
269                                 char           *file,
270                                 char           *docname
271                         );
272 void                    _DtTtPatternUpdate(
273                                 Tt_pattern              pat,
274                                 _DtStringChooserAction  choice,
275                                 char *                  string
276                         );
277 void                    _DtTtPatternUpdate(
278                                 Tt_pattern              pat,
279                                 _DtSessionChooserAction choice,
280                                 char *                  session
281                         );
282 void                    _DtTtPatternUpdate(
283                                 Tt_pattern              pat,
284                                 _DtFileChooserAction    choice,
285                                 char *                  file
286                         );
287 void                    _DtTtPatternUpdate(
288                                 Tt_pattern              pat,
289                                 _DtTtChooserAction      choice,
290                                 char *                  op
291                         );
292 void                    _DtTtPatternUpdate(
293                                 Tt_pattern              pat,
294                                 _DtArgChooserAction     choice,
295                                 Tt_mode                 mode,
296                                 char *                  vtype,
297                                 char *                  val,
298                                 int                     ival
299                         );
300 void                    _DtTtPatternUpdate(
301                                 Tt_pattern              pat,
302                                 Tt_message_callback     cb
303                         );
304 void                    _DtTtMessageUpdate(
305                                 Tt_message              msg,
306                                 _DtStringChooserAction  choice,
307                                 char *                  val
308                         );
309 void                    _DtTtMessageUpdate(
310                                 Tt_message              msg,
311                                 _DtSessionChooserAction choice,
312                                 char *                  session
313                         );
314 void                    _DtTtMessageUpdate(
315                                 Tt_message              msg,
316                                 _DtFileChooserAction    choice,
317                                 char *                  file
318                         );
319 void                    _DtTtMessageUpdate(
320                                 Tt_message              msg,
321                                 _DtTtChooserAction      choice,
322                                 char *                  op
323                         );
324 void                    _DtTtMessageUpdate(
325                                 Tt_message              msg,
326                                 _DtArgChooserAction     choice,
327                                 int                     nth,
328                                 Tt_mode                 mode,
329                                 char *                  vtype,
330                                 char *                  val,
331                                 int                     ival
332                         );
333 void                    _DtTtMessageUpdate(
334                                 Tt_message              msg,
335                                 Tt_message_callback     cb
336                         );
337 void                    _DtOpen(
338                                 Widget                  label,
339                                 const char *            cmd,
340                                 const char *            tempnamTemplate
341                         );
342 void                    _DtOpen(
343                                 Widget                  label,
344                                 const char *            file
345                         );
346 void                    _DtOpen(
347                                 Widget                  label,
348                                 void *                  buf,
349                                 size_t                  len,
350                                 const char *            tempnamTemplate
351                         );
352 extern "C" {
353 Boolean                 _DtCanHelp(
354                                 const char *            topics
355                         );
356 Boolean                 _DtHelped(
357                                 Widget                  helpDialog
358                         );
359 }
360 void                    _DtMan(
361                                 Widget                  label,
362                                 const char *            topic
363                         );
364 void                    snoopIt(
365                                 const char *            callBackType,
366                                 void *                  callBack,
367                                 Tt_message              msg,
368                                 Tt_pattern              pat      = 0,
369                                 Boolean                 printPat = False
370                         );
371
372
373 extern int              _DtTtPatsNameKey;
374
375 #endif