Mac OS 9
LocationManager.h
Go to the documentation of this file.
1 
19 #ifndef __LOCATIONMANAGER__
20 #define __LOCATIONMANAGER__
21 
22 #ifndef __APPLEEVENTS__
23 #include <AppleEvents.h>
24 #endif
25 
26 #ifndef __COMPONENTS__
27 #include <Components.h>
28 #endif
29 
30 #ifndef __DIALOGS__
31 #include <Dialogs.h>
32 #endif
33 
34 #ifndef __PROCESSES__
35 #include <Processes.h>
36 #endif
37 
38 #ifndef __STANDARDFILE__
39 #include <StandardFile.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  /* Location Manager API Support
64  * -------------------------------------------------------------------- */
65  /* A Location Token uniquely identifies a Location on a machine... */
66 
67  typedef struct OpaqueALMToken *ALMToken;
68 /* ALMToken of "off" Location...*/
69 #define kALMNoLocationToken ((ALMToken)(-1))
70  enum
71  {
72  kALMLocationNameMaxLen = 31, /* name (actually imposed by file system)... */
73  kALMNoLocationIndex =
74  -1 /* index for the "off" Location (kALMNoLocationToken)... */
75  };
76 
77  typedef Str31 ALMLocationName;
78  /* Returned from ALMConfirmName... */
79  typedef SInt16 ALMConfirmChoice;
80  enum
81  {
82  kALMConfirmRename = 1,
83  kALMConfirmReplace = 2
84  };
85 
86  /* ALMConfirmName dialog item numbers for use in callbacks (ALM 2.0)... */
87 
88  enum
89  {
90  kALMDuplicateRenameButton =
91  1, /* if Window refcon is kALMDuplicateDialogRefCon... */
92  kALMDuplicateReplaceButton = 2,
93  kALMDuplicateCancelButton = 3,
94  kALMDuplicatePromptText = 5
95  };
96 
97  enum
98  {
99  kALMRenameRenameButton =
100  1, /* if Window refcon is kALMRenameDialogRefCon... */
101  kALMRenameCancelButton = 2,
102  kALMRenameEditText = 3,
103  kALMRenamePromptText = 4
104  };
105 
106  /* Refcons of two windows in ALMConfirmName (ALM 2.0)... */
107 
108  enum
109  {
110  kALMDuplicateDialogRefCon = FOUR_CHAR_CODE('dupl'),
111  kALMRenameDialogRefCon = FOUR_CHAR_CODE('rnam')
112  };
113 
114  /* Callback routine for Location awareness (mimics AppleEvents) in
115  * non-application code... */
116 
117  typedef CALLBACK_API(void, ALMNotificationProcPtr)(AppleEvent *theEvent);
118  typedef STACK_UPP_TYPE(ALMNotificationProcPtr) ALMNotificationUPP;
119 #if CALL_NOT_IN_CARBON
128  ALMNotificationUPP
129  NewALMNotificationUPP(ALMNotificationProcPtr userRoutine);
130 #if !OPAQUE_UPP_TYPES
131  enum
132  {
133  uppALMNotificationProcInfo = 0x000000C0
134  }; /* pascal no_return_value Func(4_bytes) */
135 #ifdef __cplusplus
136  inline ALMNotificationUPP
137  NewALMNotificationUPP(ALMNotificationProcPtr userRoutine)
138  {
139  return (ALMNotificationUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
140  uppALMNotificationProcInfo,
141  GetCurrentArchitecture());
142  }
143 #else
144 #define NewALMNotificationUPP(userRoutine) \
145  (ALMNotificationUPP) \
146  NewRoutineDescriptor((ProcPtr)(userRoutine), uppALMNotificationProcInfo, \
147  GetCurrentArchitecture())
148 #endif
149 #endif
150 
159  void
160  DisposeALMNotificationUPP(ALMNotificationUPP userUPP);
161 #if !OPAQUE_UPP_TYPES
162 #ifdef __cplusplus
163  inline void DisposeALMNotificationUPP(ALMNotificationUPP userUPP)
164  {
165  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
166  }
167 #else
168 #define DisposeALMNotificationUPP(userUPP) DisposeRoutineDescriptor(userUPP)
169 #endif
170 #endif
171 
180  void
181  InvokeALMNotificationUPP(AppleEvent *theEvent, ALMNotificationUPP userUPP);
182 #if !OPAQUE_UPP_TYPES
183 #ifdef __cplusplus
185  ALMNotificationUPP userUPP)
186  {
187  CALL_ONE_PARAMETER_UPP(userUPP, uppALMNotificationProcInfo, theEvent);
188  }
189 #else
190 #define InvokeALMNotificationUPP(theEvent, userUPP) \
191  CALL_ONE_PARAMETER_UPP((userUPP), uppALMNotificationProcInfo, (theEvent))
192 #endif
193 #endif
194 
195 #endif /* CALL_NOT_IN_CARBON */
196 
197 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
198 /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
199 #define NewALMNotificationProc(userRoutine) NewALMNotificationUPP(userRoutine)
200 #define CallALMNotificationProc(userRoutine, theEvent) \
201  InvokeALMNotificationUPP(theEvent, userRoutine)
202 #endif /* CALL_NOT_IN_CARBON */
203 
204  /* Notification AppleEvents sent to apps/registered code... */
205  enum
206  {
207  kAELocationChangedNoticeKey =
208  FOUR_CHAR_CODE('walk'), /* Current Location changed... */
209  kAELocationRescanNoticeKey =
210  FOUR_CHAR_CODE('trip') /* Location created/renamed/deleted... */
211  };
212 
213  /* ALMSwitchToLocation masks... */
214  typedef SInt32 ALMSwitchActionFlags;
215  enum
216  {
217  kALMDefaultSwitchFlags = 0x00000000, /* No special action to take... */
218  kALMDontShowStatusWindow = 0x00000001, /* Suppress "switching" window... */
219  kALMSignalViaAE = 0x00000002 /* Switch by sending Finder AppleEvent... */
220  };
221 
222  /* Parameters for Get/Put/Merge Location calls... */
223 
224  typedef const OSType *ConstALMModuleTypeListPtr;
225  enum
226  {
227  kALMAddAllOnSimple = 0, /* Add all single-instance, non-action modules... */
228  kALMAddAllOff = -1 /* Add all modules but turn them off... */
229  };
230 
231  /* Item numbers for use in Get/Put/Merge Location filters... */
232 
233  enum
234  {
235  kALMLocationSelectButton = 1,
236  kALMLocationCancelButton = 2,
237  kALMLocationBalloonHelp = 3,
238  kALMLocationLocationList = 7,
239  kALMLocationLocationNameEdit = 10,
240  kALMLocationPromptText = 11
241  };
242 
243  enum
244  {
245  kALMLocationSaveButton = kALMLocationSelectButton
246  };
247 
248  /* Location Manager Module API Support
249  * ------------------------------------------------------------- */
250 
251  /* ALMGetScriptInfo stuff... */
252 
253  enum
254  {
255  kALMScriptInfoVersion =
256  2 /* Customarily put in resource for localization... */
257  };
258 
260  {
261  SInt16 version; /* Set to kALMScriptInfoVersion... */
262  SInt16 scriptCode;
263  SInt16 regionCode;
264  SInt16 langCode;
265  SInt16 fontNum;
266  SInt16 fontSize;
267  };
275  {
276  SInt16 version;
277  SInt16 scriptCode;
278  SInt16 regionCode;
279  SInt16 langCode;
280  SInt16 fontSize;
281  Str63 fontName;
282  };
286  enum
287  {
288  kALMAltScriptManagerInfoRsrcType = FOUR_CHAR_CODE('trip'),
289  kALMAltScriptManagerInfoRsrcID = 0
290  };
291 
292  /* Reboot information used on ALMSetCurrent (input/output parameter)... */
293  typedef UInt32 ALMRebootFlags;
294  enum
295  {
296  kALMNoChange = 0,
297  kALMAvailableNow = 1,
298  kALMFinderRestart = 2,
299  kALMProcesses = 3,
300  kALMExtensions = 4,
301  kALMWarmBoot = 5,
302  kALMColdBoot = 6,
303  kALMShutdown = 7
304  };
305 
311  enum
312  {
313  kALMFileCreator =
314  FOUR_CHAR_CODE('fall'), /* Creator of Location Manager files... */
315  kALMComponentModuleFileType = FOUR_CHAR_CODE(
316  'thng'), /* Type of a Component Manager Module file [v1.0]... */
317  kALMComponentStateModuleFileType =
318  FOUR_CHAR_CODE('almn'), /* Type of a CM 'state' Module file... */
319  kALMComponentActionModuleFileType =
320  FOUR_CHAR_CODE('almb'), /* Type of a CM 'action' Module file... */
321  kALMCFMStateModuleFileType =
322  FOUR_CHAR_CODE('almm'), /* Type of a CFM 'state' Module file... */
323  kALMCFMActionModuleFileType =
324  FOUR_CHAR_CODE('alma') /* Type of a CFM 'action' Module file... */
325  };
326 
327  /* Component Manager 'thng' info... */
328 
329  enum
330  {
331  kALMComponentRsrcType = FOUR_CHAR_CODE('thng'),
332  kALMComponentType = FOUR_CHAR_CODE('walk')
333  };
334 
335  /* CFM Modules require a bit of information (replacing some of the 'thng'
336  * resource)... */
337 
338  enum
339  {
340  kALMModuleInfoRsrcType = FOUR_CHAR_CODE('walk'),
341  kALMModuleInfoOriginalVersion = 0
342  };
343 
344  /* These masks apply to the "Flags" field in the 'thng' or 'walk' resource... */
345 
346  enum
347  {
348  kALMMultiplePerLocation =
349  0x00000001, /* Module can be added more than once to a Location... */
350  kALMDescriptionGetsStale =
351  0x00000002 /* Descriptions may change though the setting didn't... */
352  };
353 
354  /* Misc stuff for older implementations
355  * ------------------------------------------------------------ */
356 
357 #if OLDROUTINENAMES
358  /* Old error codes for compatibility - new names are in Errors interface... */
359  enum
360  {
361  ALMInternalErr = -30049, /* use kALMInternalErr */
362  ALMLocationNotFound = -30048, /* use kALMLocationNotFoundErr */
363  ALMNoSuchModuleErr = -30047, /* use kALMNoSuchModuleErr */
364  ALMModuleCommunicationErr = -30046, /* use kALMModuleCommunicationErr */
365  ALMDuplicateModuleErr = -30045, /* use kALMDuplicateModuleErr */
366  ALMInstallationErr = -30044, /* use kALMInstallationErr */
367  ALMDeferSwitchErr = -30043 /* use kALMDeferSwitchErr */
368  };
369 
370  /* Old ALMConfirmName constants... */
371 
372  enum
373  {
374  ALMConfirmRenameConfig = kALMConfirmRename,
375  ALMConfirmReplaceConfig = kALMConfirmReplace
376  };
377 
378  /* Old AppleEvents... */
379 
380  enum
381  {
382  kAELocationNotice = kAELocationChangedNoticeKey
383  };
384 
385  typedef ALMScriptManagerInfo ALMScriptMgrInfo;
386  typedef UInt32 ALMComponentFlagsEnum;
387 #endif /* OLDROUTINENAMES */
388 
389  /* Location Manager API
390  * ----------------------------------------------------------------------------
391  */
392 
393  /* The following 7 routines are present if gestaltALMAttr has bit
394  * gestaltALMPresent set... */
395 
396 #if CALL_NOT_IN_CARBON
405  OSErr
406  ALMGetCurrentLocation(SInt16 *index, ALMToken *token, ALMLocationName name);
407 
416  OSErr
417  ALMGetIndLocation(SInt16 index, ALMToken *token, ALMLocationName name);
418 
427  OSErr
428  ALMCountLocations(SInt16 *locationCount);
429 
438  OSErr
439  ALMSwitchToLocation(ALMToken newLocation, ALMSwitchActionFlags switchFlags);
440 
449  OSErr
450  ALMRegisterNotifyProc(ALMNotificationUPP notificationProc,
451  const ProcessSerialNumber *whichPSN);
452 
461  OSErr
462  ALMRemoveNotifyProc(ALMNotificationUPP notificationProc,
463  const ProcessSerialNumber *whichPSN);
464 
473  OSErr
474  ALMConfirmName(ConstStr255Param message, Str255 theName,
475  ALMConfirmChoice *choice, ModalFilterUPP filter);
476 
477  /* The following 3 routines are present if gestaltALMAttr has bit
478  * gestaltALMHasSFLocation set... */
479 
488  OSErr
489  ALMPutLocation(ConstStr255Param prompt, ALMLocationName name, SInt16 numTypes,
490  ConstALMModuleTypeListPtr typeList, ModalFilterYDUPP filter,
491  void *yourDataPtr);
492 
501  OSErr
502  ALMGetLocation(ConstStr255Param prompt, ALMLocationName name,
503  ModalFilterYDUPP filter, void *yourDataPtr);
504 
513  OSErr
514  ALMMergeLocation(ConstStr255Param prompt, ALMLocationName name, SInt16 numTypes,
515  ConstALMModuleTypeListPtr typeList, ModalFilterYDUPP filter,
516  void *yourDataPtr);
517 
518 #endif /* CALL_NOT_IN_CARBON */
519 
520 #if PRAGMA_STRUCT_ALIGN
521 #pragma options align = reset
522 #elif PRAGMA_STRUCT_PACKPUSH
523 #pragma pack(pop)
524 #elif PRAGMA_STRUCT_PACK
525 #pragma pack()
526 #endif
527 
528 #ifdef PRAGMA_IMPORT_OFF
529 #pragma import off
530 #elif PRAGMA_IMPORT
531 #pragma import reset
532 #endif
533 
534 #ifdef __cplusplus
535 }
536 #endif
537 
538 #endif /* __LOCATIONMANAGER__ */
AppleEvent Package Interfaces.
Component Manager Interfaces.
Dialog Manager interfaces.
ALMNotificationUPP NewALMNotificationUPP(ALMNotificationProcPtr userRoutine)
OSErr ALMRemoveNotifyProc(ALMNotificationUPP notificationProc, const ProcessSerialNumber *whichPSN)
OSErr ALMGetIndLocation(SInt16 index, ALMToken *token, ALMLocationName name)
OSErr ALMSwitchToLocation(ALMToken newLocation, ALMSwitchActionFlags switchFlags)
OSErr ALMRegisterNotifyProc(ALMNotificationUPP notificationProc, const ProcessSerialNumber *whichPSN)
void InvokeALMNotificationUPP(AppleEvent *theEvent, ALMNotificationUPP userUPP)
OSErr ALMGetLocation(ConstStr255Param prompt, ALMLocationName name, ModalFilterYDUPP filter, void *yourDataPtr)
OSErr ALMConfirmName(ConstStr255Param message, Str255 theName, ALMConfirmChoice *choice, ModalFilterUPP filter)
OSErr ALMGetCurrentLocation(SInt16 *index, ALMToken *token, ALMLocationName name)
OSErr ALMPutLocation(ConstStr255Param prompt, ALMLocationName name, SInt16 numTypes, ConstALMModuleTypeListPtr typeList, ModalFilterYDUPP filter, void *yourDataPtr)
void DisposeALMNotificationUPP(ALMNotificationUPP userUPP)
OSErr ALMCountLocations(SInt16 *locationCount)
OSErr ALMMergeLocation(ConstStr255Param prompt, ALMLocationName name, SInt16 numTypes, ConstALMModuleTypeListPtr typeList, ModalFilterYDUPP filter, void *yourDataPtr)
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
#define STACK_UPP_TYPE(name)
Definition: MixedMode.h:734
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
Process Manager Interfaces.
Standard File package Interfaces.
Definition: AEDataModel.h:175
Definition: LocationManager.h:275
Definition: LocationManager.h:260
Definition: Events.h:224
Definition: Processes.h:65