Mac OS 9
CTBUtilities.h
Go to the documentation of this file.
1 
19 #ifndef __CTBUTILITIES__
20 #define __CTBUTILITIES__
21 
22 #ifndef __CONDITIONALMACROS__
23 #include <ConditionalMacros.h>
24 #endif
25 
26 #ifndef __MACTYPES__
27 #include <MacTypes.h>
28 #endif
29 
30 #ifndef __MIXEDMODE__
31 #include <MixedMode.h>
32 #endif
33 
34 #ifndef __DIALOGS__
35 #include <Dialogs.h>
36 #endif
37 
38 #ifndef __APPLETALK__
39 #include <AppleTalk.h>
40 #endif
41 
42 #if PRAGMA_ONCE
43 #pragma once
44 #endif
45 
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #endif
50 
51 #if PRAGMA_IMPORT
52 #pragma import on
53 #endif
54 
55 #if PRAGMA_STRUCT_ALIGN
56 #pragma options align = mac68k
57 #elif PRAGMA_STRUCT_PACKPUSH
58 #pragma pack(push, 2)
59 #elif PRAGMA_STRUCT_PACK
60 #pragma pack(2)
61 #endif
62 
63 #if CALL_NOT_IN_CARBON
64  enum
65  {
66  curCTBUVersion = 2
67  };
68 
69  enum
70  {
73  ctbuNoErr = 0
74  };
75 
76  typedef OSErr CTBUErr;
77  typedef SInt16 ChooseReturnCode;
78  enum
79  {
80  chooseDisaster = -2,
81  chooseFailed = -1,
82  chooseAborted = 0,
83  chooseOKMinor = 1,
84  chooseOKMajor = 2,
85  chooseCancel = 3
86  };
87 
88  typedef UInt16 NuLookupReturnCode;
89  enum
90  {
91  nlOk = 0,
92  nlCancel = 1,
93  nlEject = 2
94  };
95 
96  typedef UInt16 NameFilterReturnCode;
97  enum
98  {
99  nameInclude = 1,
100  nameDisable = 2,
101  nameReject = 3
102  };
103 
104  typedef UInt16 ZoneFilterReturnCode;
105  enum
106  {
107  zoneInclude = 1,
108  zoneDisable = 2,
109  zoneReject = 3
110  };
111 
112  enum
113  {
115  hookOK = 1,
116  hookCancel = 2,
117  hookOutline = 3,
118  hookTitle = 4,
119  hookItemList = 5,
120  hookZoneTitle = 6,
121  hookZoneList = 7,
122  hookLine = 8,
123  hookVersion = 9,
124  hookReserved1 = 10,
125  hookReserved2 = 11,
126  hookReserved3 = 12,
127  hookReserved4 = 13,
128  hookNull = 100,
129  hookItemRefresh = 101,
130  hookZoneRefresh = 102,
131  hookEject = 103,
132  hookPreflight = 104,
133  hookPostflight = 105,
134  hookKeyBase = 1000
135  };
136 
138  struct NLTypeEntry
139  {
140  Handle hIcon;
141  Str32 typeStr;
142  };
143  typedef struct NLTypeEntry NLTypeEntry;
144  typedef NLTypeEntry NLType[4];
145  struct NBPReply
146  {
147  EntityName theEntity;
148  AddrBlock theAddr;
149  };
150  typedef struct NBPReply NBPReply;
151  typedef CALLBACK_API(short, DialogHookProcPtr)(short item, DialogRef theDialog);
152  typedef CALLBACK_API(short, NameFilterProcPtr)(const EntityName *theEntity);
153  typedef CALLBACK_API(short, ZoneFilterProcPtr)(ConstStr32Param theZone);
154  typedef STACK_UPP_TYPE(DialogHookProcPtr) DialogHookUPP;
155  typedef STACK_UPP_TYPE(NameFilterProcPtr) NameFilterUPP;
156  typedef STACK_UPP_TYPE(ZoneFilterProcPtr) ZoneFilterUPP;
157 #if CALL_NOT_IN_CARBON
166  DialogHookUPP
167  NewDialogHookUPP(DialogHookProcPtr userRoutine);
168 #if !OPAQUE_UPP_TYPES
169  enum
170  {
171  uppDialogHookProcInfo = 0x000003A0
172  };
173 #ifdef __cplusplus
174  inline DialogHookUPP NewDialogHookUPP(DialogHookProcPtr userRoutine)
175  {
176  return (DialogHookUPP)NewRoutineDescriptor(
177  (ProcPtr)(userRoutine), uppDialogHookProcInfo, GetCurrentArchitecture());
178  }
179 #else
180 #define NewDialogHookUPP(userRoutine) \
181  (DialogHookUPP) NewRoutineDescriptor( \
182  (ProcPtr)(userRoutine), uppDialogHookProcInfo, GetCurrentArchitecture())
183 #endif
184 #endif
185 
194  NameFilterUPP
195  NewNameFilterUPP(NameFilterProcPtr userRoutine);
196 #if !OPAQUE_UPP_TYPES
197  enum
198  {
199  uppNameFilterProcInfo = 0x000000E0
200  };
201 #ifdef __cplusplus
202  inline NameFilterUPP NewNameFilterUPP(NameFilterProcPtr userRoutine)
203  {
204  return (NameFilterUPP)NewRoutineDescriptor(
205  (ProcPtr)(userRoutine), uppNameFilterProcInfo, GetCurrentArchitecture());
206  }
207 #else
208 #define NewNameFilterUPP(userRoutine) \
209  (NameFilterUPP) NewRoutineDescriptor( \
210  (ProcPtr)(userRoutine), uppNameFilterProcInfo, GetCurrentArchitecture())
211 #endif
212 #endif
213 
222  ZoneFilterUPP
223  NewZoneFilterUPP(ZoneFilterProcPtr userRoutine);
224 #if !OPAQUE_UPP_TYPES
225  enum
226  {
227  uppZoneFilterProcInfo = 0x000000E0
228  };
229 #ifdef __cplusplus
230  inline ZoneFilterUPP NewZoneFilterUPP(ZoneFilterProcPtr userRoutine)
231  {
232  return (ZoneFilterUPP)NewRoutineDescriptor(
233  (ProcPtr)(userRoutine), uppZoneFilterProcInfo, GetCurrentArchitecture());
234  }
235 #else
236 #define NewZoneFilterUPP(userRoutine) \
237  (ZoneFilterUPP) NewRoutineDescriptor( \
238  (ProcPtr)(userRoutine), uppZoneFilterProcInfo, GetCurrentArchitecture())
239 #endif
240 #endif
241 
250  void
251  DisposeDialogHookUPP(DialogHookUPP userUPP);
252 #if !OPAQUE_UPP_TYPES
253 #ifdef __cplusplus
254  inline void DisposeDialogHookUPP(DialogHookUPP userUPP)
255  {
256  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
257  }
258 #else
259 #define DisposeDialogHookUPP(userUPP) DisposeRoutineDescriptor(userUPP)
260 #endif
261 #endif
262 
271  void
272  DisposeNameFilterUPP(NameFilterUPP userUPP);
273 #if !OPAQUE_UPP_TYPES
274 #ifdef __cplusplus
275  inline void DisposeNameFilterUPP(NameFilterUPP userUPP)
276  {
277  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
278  }
279 #else
280 #define DisposeNameFilterUPP(userUPP) DisposeRoutineDescriptor(userUPP)
281 #endif
282 #endif
283 
292  void
293  DisposeZoneFilterUPP(ZoneFilterUPP userUPP);
294 #if !OPAQUE_UPP_TYPES
295 #ifdef __cplusplus
296  inline void DisposeZoneFilterUPP(ZoneFilterUPP userUPP)
297  {
298  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
299  }
300 #else
301 #define DisposeZoneFilterUPP(userUPP) DisposeRoutineDescriptor(userUPP)
302 #endif
303 #endif
304 
313  short
314  InvokeDialogHookUPP(short item, DialogRef theDialog, DialogHookUPP userUPP);
315 #if !OPAQUE_UPP_TYPES
316 #ifdef __cplusplus
317  inline short InvokeDialogHookUPP(short item, DialogRef theDialog,
318  DialogHookUPP userUPP)
319  {
320  return (short)CALL_TWO_PARAMETER_UPP(userUPP, uppDialogHookProcInfo, item,
321  theDialog);
322  }
323 #else
324 #define InvokeDialogHookUPP(item, theDialog, userUPP) \
325  (short)CALL_TWO_PARAMETER_UPP((userUPP), uppDialogHookProcInfo, (item), \
326  (theDialog))
327 #endif
328 #endif
329 
338  short
339  InvokeNameFilterUPP(const EntityName *theEntity, NameFilterUPP userUPP);
340 #if !OPAQUE_UPP_TYPES
341 #ifdef __cplusplus
342  inline short InvokeNameFilterUPP(const EntityName *theEntity,
343  NameFilterUPP userUPP)
344  {
345  return (short)CALL_ONE_PARAMETER_UPP(userUPP, uppNameFilterProcInfo,
346  theEntity);
347  }
348 #else
349 #define InvokeNameFilterUPP(theEntity, userUPP) \
350  (short)CALL_ONE_PARAMETER_UPP((userUPP), uppNameFilterProcInfo, (theEntity))
351 #endif
352 #endif
353 
362  short
363  InvokeZoneFilterUPP(ConstStr32Param theZone, ZoneFilterUPP userUPP);
364 #if !OPAQUE_UPP_TYPES
365 #ifdef __cplusplus
366  inline short InvokeZoneFilterUPP(ConstStr32Param theZone,
367  ZoneFilterUPP userUPP)
368  {
369  return (short)CALL_ONE_PARAMETER_UPP(userUPP, uppZoneFilterProcInfo, theZone);
370  }
371 #else
372 #define InvokeZoneFilterUPP(theZone, userUPP) \
373  (short)CALL_ONE_PARAMETER_UPP((userUPP), uppZoneFilterProcInfo, (theZone))
374 #endif
375 #endif
376 
377 #endif
379 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
381 #define NewDialogHookProc(userRoutine) NewDialogHookUPP(userRoutine)
382 #define NewNameFilterProc(userRoutine) NewNameFilterUPP(userRoutine)
383 #define NewZoneFilterProc(userRoutine) NewZoneFilterUPP(userRoutine)
384 #define CallDialogHookProc(userRoutine, item, theDialog) \
385  InvokeDialogHookUPP(item, theDialog, userRoutine)
386 #define CallNameFilterProc(userRoutine, theEntity) \
387  InvokeNameFilterUPP(theEntity, userRoutine)
388 #define CallZoneFilterProc(userRoutine, theZone) \
389  InvokeZoneFilterUPP(theZone, userRoutine)
390 #endif
392 #endif
394 #if CALL_NOT_IN_CARBON
403  CTBUErr
405 
414  short
416 
425  short
426  StandardNBP(Point where, ConstStr255Param prompt, short numTypes,
427  NLType typeList, NameFilterUPP nameFilter, ZoneFilterUPP zoneFilter,
428  DialogHookUPP hook, NBPReply *theReply);
429 
438  short
439  CustomNBP(Point where, ConstStr255Param prompt, short numTypes, NLType typeList,
440  NameFilterUPP nameFilter, ZoneFilterUPP zoneFilter,
441  DialogHookUPP hook, long userData, short dialogID,
442  ModalFilterUPP filter, NBPReply *theReply);
443 
444 #endif
446 #if OLDROUTINENAMES
447 #define NuLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter, \
448  hook, theReply) \
449  StandardNBP(where, prompt, numTypes, typeList, nameFilter, zoneFilter, hook, \
450  theReply)
451 #define NuPLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter, \
452  hook, userData, dialogID, filter, theReply) \
453  CustomNBP(where, prompt, numTypes, typeList, nameFilter, zoneFilter, hook, \
454  userData, dialogID, filter, theReply)
455 #endif
457 #if PRAGMA_STRUCT_ALIGN
458 #pragma options align = reset
459 #elif PRAGMA_STRUCT_PACKPUSH
460 #pragma pack(pop)
461 #elif PRAGMA_STRUCT_PACK
462 #pragma pack()
463 #endif
464 
465 #ifdef PRAGMA_IMPORT_OFF
466 #pragma import off
467 #elif PRAGMA_IMPORT
468 #pragma import reset
469 #endif
470 
471 #ifdef __cplusplus
472 }
473 #endif
474 
475 #endif
AppleTalk Interfaces.
short InvokeNameFilterUPP(const EntityName *theEntity, NameFilterUPP userUPP)
short InvokeZoneFilterUPP(ConstStr32Param theZone, ZoneFilterUPP userUPP)
@ hookOK
Definition: CTBUtilities.h:115
@ hookNull
Definition: CTBUtilities.h:128
CTBUErr InitCTBUtilities(void)
short InvokeDialogHookUPP(short item, DialogRef theDialog, DialogHookUPP userUPP)
short CustomNBP(Point where, ConstStr255Param prompt, short numTypes, NLType typeList, NameFilterUPP nameFilter, ZoneFilterUPP zoneFilter, DialogHookUPP hook, long userData, short dialogID, ModalFilterUPP filter, NBPReply *theReply)
short StandardNBP(Point where, ConstStr255Param prompt, short numTypes, NLType typeList, NameFilterUPP nameFilter, ZoneFilterUPP zoneFilter, DialogHookUPP hook, NBPReply *theReply)
#define NewZoneFilterUPP(userRoutine)
Definition: CTBUtilities.h:236
@ ctbuGenericError
Definition: CTBUtilities.h:72
#define NewDialogHookUPP(userRoutine)
Definition: CTBUtilities.h:180
void DisposeDialogHookUPP(DialogHookUPP userUPP)
short CTBGetCTBVersion(void)
void DisposeZoneFilterUPP(ZoneFilterUPP userUPP)
void DisposeNameFilterUPP(NameFilterUPP userUPP)
#define NewNameFilterUPP(userRoutine)
Definition: CTBUtilities.h:208
Set up for compiler independent conditionals.
Dialog Manager interfaces.
Basic Macintosh data types.
Mixed Mode Manager Interfaces.
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
#define STACK_UPP_TYPE(name)
Definition: MixedMode.h:734
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
Definition: AppleTalk.h:342
Definition: AppleTalk.h:334
Definition: Quickdraw.h:1648
Definition: CTBUtilities.h:146
Definition: CTBUtilities.h:139
Definition: MacTypes.h:520