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