AppleGuide.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:20k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       AppleGuide.h
  3.  
  4.      Contains:   Apple Guide Interfaces.
  5.  
  6.      Version:    Technology: Mac OS 8
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1994-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __APPLEGUIDE__
  18. #define __APPLEGUIDE__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __APPLEEVENTS__
  23. #include "AppleEvents.h"
  24. #endif
  25. #ifndef __FILES__
  26. #include "Files.h"
  27. #endif
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38.     #pragma options align=mac68k
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40.     #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42.     #pragma pack(2)
  43. #endif
  44. /* Types*/
  45. typedef UInt32                          AGRefNum;
  46. typedef UInt32                          AGCoachRefNum;
  47. typedef UInt32                          AGContextRefNum;
  48. struct AGAppInfo {
  49.     AEEventID                       eventId;
  50.     long                            refCon;
  51.     void *                          contextObj;                 /* private system field*/
  52. };
  53. typedef struct AGAppInfo                AGAppInfo;
  54. typedef AGAppInfo *                     AGAppInfoPtr;
  55. typedef AGAppInfoPtr *                  AGAppInfoHdl;
  56. typedef CALLBACK_API( OSErr , CoachReplyProcPtr )(Rect *pRect, Ptr name, long refCon);
  57. typedef CALLBACK_API( OSErr , ContextReplyProcPtr )(Ptr pInputData, Size inputDataSize, Ptr *ppOutputData, Size *pOutputDataSize, AGAppInfoHdl hAppInfo);
  58. typedef STACK_UPP_TYPE(CoachReplyProcPtr)                       CoachReplyUPP;
  59. typedef STACK_UPP_TYPE(ContextReplyProcPtr)                     ContextReplyUPP;
  60. #if OPAQUE_UPP_TYPES
  61. #if CALL_NOT_IN_CARBON
  62.     EXTERN_API(CoachReplyUPP)
  63.     NewCoachReplyUPP               (CoachReplyProcPtr       userRoutine);
  64.     EXTERN_API(ContextReplyUPP)
  65.     NewContextReplyUPP             (ContextReplyProcPtr     userRoutine);
  66.     EXTERN_API(void)
  67.     DisposeCoachReplyUPP           (CoachReplyUPP           userUPP);
  68.     EXTERN_API(void)
  69.     DisposeContextReplyUPP         (ContextReplyUPP         userUPP);
  70.     EXTERN_API(OSErr)
  71.     InvokeCoachReplyUPP            (Rect *                  pRect,
  72.                                     Ptr                     name,
  73.                                     long                    refCon,
  74.                                     CoachReplyUPP           userUPP);
  75.     EXTERN_API(OSErr)
  76.     InvokeContextReplyUPP          (Ptr                     pInputData,
  77.                                     Size                    inputDataSize,
  78.                                     Ptr *                   ppOutputData,
  79.                                     Size *                  pOutputDataSize,
  80.                                     AGAppInfoHdl            hAppInfo,
  81.                                     ContextReplyUPP         userUPP);
  82. #endif  /* CALL_NOT_IN_CARBON */
  83. #else
  84.     enum { uppCoachReplyProcInfo = 0x00000FE0 };                    /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  85.     enum { uppContextReplyProcInfo = 0x0000FFE0 };                  /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  86.     #define NewCoachReplyUPP(userRoutine)                           (CoachReplyUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCoachReplyProcInfo, GetCurrentArchitecture())
  87.     #define NewContextReplyUPP(userRoutine)                         (ContextReplyUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppContextReplyProcInfo, GetCurrentArchitecture())
  88.     #define DisposeCoachReplyUPP(userUPP)                           DisposeRoutineDescriptor(userUPP)
  89.     #define DisposeContextReplyUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  90.     #define InvokeCoachReplyUPP(pRect, name, refCon, userUPP)       (OSErr)CALL_THREE_PARAMETER_UPP((userUPP), uppCoachReplyProcInfo, (pRect), (name), (refCon))
  91.     #define InvokeContextReplyUPP(pInputData, inputDataSize, ppOutputData, pOutputDataSize, hAppInfo, userUPP)  (OSErr)CALL_FIVE_PARAMETER_UPP((userUPP), uppContextReplyProcInfo, (pInputData), (inputDataSize), (ppOutputData), (pOutputDataSize), (hAppInfo))
  92. #endif
  93. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  94. #define NewCoachReplyProc(userRoutine)                          NewCoachReplyUPP(userRoutine)
  95. #define NewContextReplyProc(userRoutine)                        NewContextReplyUPP(userRoutine)
  96. #define CallCoachReplyProc(userRoutine, pRect, name, refCon)    InvokeCoachReplyUPP(pRect, name, refCon, userRoutine)
  97. #define CallContextReplyProc(userRoutine, pInputData, inputDataSize, ppOutputData, pOutputDataSize, hAppInfo) InvokeContextReplyUPP(pInputData, inputDataSize, ppOutputData, pOutputDataSize, hAppInfo, userRoutine)
  98. /* Constants*/
  99. enum {
  100.     kAGDefault                  = 0,
  101.     kAGFrontDatabase            = 1,
  102.     kAGNoMixin                  = (-1)
  103. };
  104. enum {
  105.     kAGViewFullHowdy            = 1,                            /* Full-size Howdy*/
  106.     kAGViewTopicAreas           = 2,                            /* Full-size Topic Areas*/
  107.     kAGViewIndex                = 3,                            /* Full-size Index Terms*/
  108.     kAGViewLookFor              = 4,                            /* Full-size Look-For (Search)*/
  109.     kAGViewSingleHowdy          = 5,                            /* Single-list-size Howdy*/
  110.     kAGViewSingleTopics         = 6                             /* Single-list-size Topics*/
  111. };
  112. enum {
  113.     kAGFileMain                 = FOUR_CHAR_CODE('poco'),
  114.     kAGFileMixin                = FOUR_CHAR_CODE('mixn')
  115. };
  116. /* To test against AGGetAvailableDBTypes*/
  117. enum {
  118.     kAGDBTypeBitAny             = 0x00000001,
  119.     kAGDBTypeBitHelp            = 0x00000002,
  120.     kAGDBTypeBitTutorial        = 0x00000004,
  121.     kAGDBTypeBitShortcuts       = 0x00000008,
  122.     kAGDBTypeBitAbout           = 0x00000010,
  123.     kAGDBTypeBitOther           = 0x00000080
  124. };
  125. typedef UInt16                          AGStatus;
  126. /* Returned by AGGetStatus*/
  127. enum {
  128.     kAGIsNotRunning             = 0,
  129.     kAGIsSleeping               = 1,
  130.     kAGIsActive                 = 2
  131. };
  132. /* Flags used in AGOpen, AGOpenWithSearch, AGOpenWithView*/
  133. enum {
  134.     kHelpViewerSearchAll        = (1 << 0)
  135. };
  136. typedef UInt16                          AGWindowKind;
  137. /* Returned by AGGetFrontWindowKind*/
  138. enum {
  139.     kAGNoWindow                 = 0,
  140.     kAGAccessWindow             = 1,
  141.     kAGPresentationWindow       = 2
  142. };
  143. /* Error Codes*/
  144. /* Not an enum, because other OSErrs are valid.*/
  145. typedef SInt16                          AGErr;
  146. /* Apple Guide error codes*/
  147. enum {
  148.                                                                 /* -------------------- Apple event reply codes*/
  149.     kAGErrUnknownEvent          = -2900,
  150.     kAGErrCantStartup           = -2901,
  151.     kAGErrNoAccWin              = -2902,
  152.     kAGErrNoPreWin              = -2903,
  153.     kAGErrNoSequence            = -2904,
  154.     kAGErrNotOopsSequence       = -2905,
  155.     kAGErrReserved06            = -2906,
  156.     kAGErrNoPanel               = -2907,
  157.     kAGErrContentNotFound       = -2908,
  158.     kAGErrMissingString         = -2909,
  159.     kAGErrInfoNotAvail          = -2910,
  160.     kAGErrEventNotAvailable     = -2911,
  161.     kAGErrCannotMakeCoach       = -2912,
  162.     kAGErrSessionIDsNotMatch    = -2913,
  163.     kAGErrMissingDatabaseSpec   = -2914,
  164.     kAGMissingSequenceMap       = -2915,                        /* -------------------- Coach's Chalkboard reply codes*/
  165.     kAGErrItemNotFound          = -2925,
  166.     kAGErrBalloonResourceNotFound = -2926,
  167.     kAGErrChalkResourceNotFound = -2927,
  168.     kAGErrChdvResourceNotFound  = -2928,
  169.     kAGErrAlreadyShowing        = -2929,
  170.     kAGErrBalloonResourceSkip   = -2930,
  171.     kAGErrItemNotVisible        = -2931,
  172.     kAGErrReserved32            = -2932,
  173.     kAGErrNotFrontProcess       = -2933,
  174.     kAGErrMacroResourceNotFound = -2934,                        /* -------------------- API reply codes*/
  175.     kAGErrAppleGuideNotAvailable = -2951,
  176.     kAGErrCannotInitCoach       = -2952,
  177.     kAGErrCannotInitContext     = -2953,
  178.     kAGErrCannotOpenAliasFile   = -2954,
  179.     kAGErrNoAliasResource       = -2955,
  180.     kAGErrDatabaseNotAvailable  = -2956,
  181.     kAGErrDatabaseNotOpen       = -2957,
  182.     kAGErrMissingAppInfoHdl     = -2958,
  183.     kAGErrMissingContextObject  = -2959,
  184.     kAGErrInvalidRefNum         = -2960,
  185.     kAGErrDatabaseOpen          = -2961,
  186.     kAGErrInsufficientMemory    = -2962
  187. };
  188. /* Events*/
  189. /* Not an enum because we want to make assignments.*/
  190. typedef UInt32                          AGEvent;
  191. /* Handy events for AGGeneral.*/
  192. enum {
  193.                                                                 /* Panel actions (Require a presentation window).*/
  194.     kAGEventDoCoach             = FOUR_CHAR_CODE('doco'),
  195.     kAGEventDoHuh               = FOUR_CHAR_CODE('dhuh'),
  196.     kAGEventGoNext              = FOUR_CHAR_CODE('gonp'),
  197.     kAGEventGoPrev              = FOUR_CHAR_CODE('gopp'),
  198.     kAGEventHidePanel           = FOUR_CHAR_CODE('pahi'),
  199.     kAGEventReturnBack          = FOUR_CHAR_CODE('gobk'),
  200.     kAGEventShowPanel           = FOUR_CHAR_CODE('pash'),
  201.     kAGEventTogglePanel         = FOUR_CHAR_CODE('patg')
  202. };
  203. /* Functions*/
  204. /*
  205.    AGClose
  206.    Close the database associated with the AGRefNum.
  207. */
  208. #if CALL_NOT_IN_CARBON
  209. EXTERN_API( AGErr )
  210. AGClose                         (AGRefNum *             refNum)                             TWOWORDINLINE(0x7011, 0xAA6E);
  211. /*
  212.    AGGeneral
  213.    Cause various events to happen.
  214. */
  215. EXTERN_API( AGErr )
  216. AGGeneral                       (AGRefNum               refNum,
  217.                                  AGEvent                theEvent)                           TWOWORDINLINE(0x700D, 0xAA6E);
  218. /*
  219.    AGGetAvailableDBTypes
  220.    Return the database types available for this application.
  221. */
  222. EXTERN_API( UInt32 )
  223. AGGetAvailableDBTypes           (void)                                                      TWOWORDINLINE(0x7008, 0xAA6E);
  224. /*
  225.    AGGetFrontWindowKind
  226.    Return the kind of the front window.
  227. */
  228. EXTERN_API( AGWindowKind )
  229. AGGetFrontWindowKind            (AGRefNum               refNum)                             TWOWORDINLINE(0x700C, 0xAA6E);
  230. /*
  231.    AGGetFSSpec
  232.    Return the FSSpec for the AGRefNum.
  233. */
  234. EXTERN_API( AGErr )
  235. AGGetFSSpec                     (AGRefNum               refNum,
  236.                                  FSSpec *               fileSpec)                           TWOWORDINLINE(0x700F, 0xAA6E);
  237. /*
  238.    AGGetStatus
  239.    Return the status of Apple Guide.
  240. */
  241. EXTERN_API( AGStatus )
  242. AGGetStatus                     (void)                                                      TWOWORDINLINE(0x7009, 0xAA6E);
  243. /*
  244.    AGInstallCoachHandler
  245.    Install a Coach object location query handler.
  246. */
  247. EXTERN_API( AGErr )
  248. AGInstallCoachHandler           (CoachReplyUPP          coachReplyProc,
  249.                                  long                   refCon,
  250.                                  AGCoachRefNum *        resultRefNum)                       TWOWORDINLINE(0x7012, 0xAA6E);
  251. /*
  252.    AGInstallContextHandler
  253.    Install a context check query handler.
  254. */
  255. EXTERN_API( AGErr )
  256. AGInstallContextHandler         (ContextReplyUPP        contextReplyProc,
  257.                                  AEEventID              eventID,
  258.                                  long                   refCon,
  259.                                  AGContextRefNum *      resultRefNum)                       TWOWORDINLINE(0x7013, 0xAA6E);
  260. /*
  261.    AGIsDatabaseOpen
  262.    Return true if the database associated with the AGRefNum is open.
  263. */
  264. EXTERN_API( Boolean )
  265. AGIsDatabaseOpen                (AGRefNum               refNum)                             TWOWORDINLINE(0x7006, 0xAA6E);
  266. /*
  267.    AGOpen
  268.    Open a guide database.
  269. */
  270. EXTERN_API( AGErr )
  271. AGOpen                          (ConstFSSpecPtr         fileSpec,
  272.                                  UInt32                 flags,
  273.                                  Handle                 mixinControl,
  274.                                  AGRefNum *             resultRefNum)                       TWOWORDINLINE(0x7001, 0xAA6E);
  275. /*
  276.    AGOpenWithSearch
  277.    Open a guide database and preset a search string.
  278. */
  279. EXTERN_API( AGErr )
  280. AGOpenWithSearch                (ConstFSSpecPtr         fileSpec,
  281.                                  UInt32                 flags,
  282.                                  Handle                 mixinControl,
  283.                                  ConstStr255Param       searchString,
  284.                                  AGRefNum *             resultRefNum)                       TWOWORDINLINE(0x7002, 0xAA6E);
  285. /*
  286.    AGOpenWithSequence
  287.    Open a guide database and display a presentation window sequence.
  288. */
  289. EXTERN_API( AGErr )
  290. AGOpenWithSequence              (ConstFSSpecPtr         fileSpec,
  291.                                  UInt32                 flags,
  292.                                  Handle                 mixinControl,
  293.                                  short                  sequenceID,
  294.                                  AGRefNum *             resultRefNum)                       TWOWORDINLINE(0x7004, 0xAA6E);
  295. /*
  296.    AGOpenWithView
  297.    Open a guide database and override the default view.
  298. */
  299. EXTERN_API( AGErr )
  300. AGOpenWithView                  (ConstFSSpecPtr         fileSpec,
  301.                                  UInt32                 flags,
  302.                                  Handle                 mixinControl,
  303.                                  short                  viewNum,
  304.                                  AGRefNum *             resultRefNum)                       TWOWORDINLINE(0x7005, 0xAA6E);
  305. /*
  306.    AGQuit
  307.    Make Apple Guide quit.
  308. */
  309. EXTERN_API( AGErr )
  310. AGQuit                          (void)                                                      TWOWORDINLINE(0x7010, 0xAA6E);
  311. /*
  312.    AGRemoveCoachHandler
  313.    Remove the Coach object location query handler.
  314. */
  315. EXTERN_API( AGErr )
  316. AGRemoveCoachHandler            (AGCoachRefNum *        resultRefNum)                       TWOWORDINLINE(0x7014, 0xAA6E);
  317. /*
  318.    AGRemoveContextHandler
  319.    Remove the context check query handler.
  320. */
  321. EXTERN_API( AGErr )
  322. AGRemoveContextHandler          (AGContextRefNum *      resultRefNum)                       TWOWORDINLINE(0x7015, 0xAA6E);
  323. /*
  324.    AGStart
  325.    Start up Apple Guide in the background.
  326. */
  327. EXTERN_API( AGErr )
  328. AGStart                         (void)                                                      TWOWORDINLINE(0x700A, 0xAA6E);
  329. /* typedef's*/
  330. #endif  /* CALL_NOT_IN_CARBON */
  331. typedef FSSpec                          AGFileFSSpecType;
  332. typedef short                           AGFileSelectorCountType;
  333. typedef short                           AGFileSelectorIndexType;
  334. typedef OSType                          AGFileSelectorType;
  335. typedef long                            AGFileSelectorValueType;
  336. typedef short                           AGFileDBType;
  337. typedef Str63                           AGFileDBMenuNamePtr;
  338. typedef short                           AGFileDBScriptType;
  339. typedef short                           AGFileDBRegionType;
  340. typedef short                           AGFileMajorRevType;
  341. typedef short                           AGFileMinorRevType;
  342. typedef short                           AGFileCountType;
  343. /* Database types (for AGFileDBType parameter).*/
  344. enum {
  345.     kAGFileDBTypeAny            = 0,
  346.     kAGFileDBTypeHelp           = 1,
  347.     kAGFileDBTypeTutorial       = 2,
  348.     kAGFileDBTypeShortcuts      = 3,
  349.     kAGFileDBTypeAbout          = 4,
  350.     kAGFileDBTypeOther          = 8
  351. };
  352. #if CALL_NOT_IN_CARBON
  353. EXTERN_API( OSErr )
  354. AGFileGetDBMenuName             (const FSSpec *         fileSpec,
  355.                                  Str63                  menuItemNameString);
  356. /* Get the database type.*/
  357. EXTERN_API( OSErr )
  358. AGFileGetDBType                 (const FSSpec *         fileSpec,
  359.                                  AGFileDBType *         databaseType);
  360. /*
  361.    Get the version of the software
  362.    that created this database.
  363. */
  364. EXTERN_API( OSErr )
  365. AGFileGetDBVersion              (const FSSpec *         fileSpec,
  366.                                  AGFileMajorRevType *   majorRev,
  367.                                  AGFileMinorRevType *   minorRev);
  368. /* Get the database script and region information.*/
  369. EXTERN_API( OSErr )
  370. AGFileGetDBCountry              (const FSSpec *         fileSpec,
  371.                                  AGFileDBScriptType *   script,
  372.                                  AGFileDBRegionType *   region);
  373. /* Return the number of selectors in database.*/
  374. EXTERN_API( AGFileSelectorCountType )
  375. AGFileGetSelectorCount          (const FSSpec *         fileSpec);
  376. /*
  377.    Get the i-th database selector (1 to AGFileSelectorCountType)
  378.    and its value.
  379. */
  380. EXTERN_API( OSErr )
  381. AGFileGetSelector               (const FSSpec *         fileSpec,
  382.                                  AGFileSelectorIndexType  selectorNumber,
  383.                                  AGFileSelectorType *   selector,
  384.                                  AGFileSelectorValueType * value);
  385. /* Return true if database is mixin.*/
  386. EXTERN_API( Boolean )
  387. AGFileIsMixin                   (const FSSpec *         fileSpec);
  388. /*
  389.    Return the number of database files
  390.    of the specified databaseType and main/mixin.
  391.    Any file creator is acceptible,
  392.    but type must be kAGFileMain or kAGFileMixin.
  393. */
  394. EXTERN_API( AGFileCountType )
  395. AGFileGetDBCount                (short                  vRefNum,
  396.                                  long                   dirID,
  397.                                  AGFileDBType           databaseType,
  398.                                  Boolean                wantMixin);
  399. /*
  400.    Get the FSSpec for the dbIndex-th database
  401.    of the specified databaseType and main/mixin.
  402.    Any file creator is acceptible,
  403.    but type must be kAGFileMain or kAGFileMixin.
  404. */
  405. EXTERN_API( OSErr )
  406. AGFileGetIndDB                  (short                  vRefNum,
  407.                                  long                   dirID,
  408.                                  AGFileDBType           databaseType,
  409.                                  Boolean                wantMixin,
  410.                                  short                  dbIndex,
  411.                                  FSSpec *               fileSpec);
  412. /*
  413.    This selector must match with the application
  414.    creator in order for this file to appear in the 
  415.    application's Help menu. Ignored for mixin files
  416.    because they never appear in the Help menu anyway.
  417.    If empty (zeros), will appear in the Help menu
  418.    of any host application.
  419. */
  420. EXTERN_API( OSErr )
  421. AGFileGetHelpMenuAppCreator     (const FSSpec *         fileSpec,
  422.                                  OSType *               helpMenuAppCreator);
  423. /*
  424.    This selector must match in the main and mixin
  425.    files in order for the mixin to mix-in with the main.
  426.    Empty (zeros) selectors are valid matches.
  427.    A '****' selector will mix-in with any main.
  428. */
  429. EXTERN_API( OSErr )
  430. AGFileGetMixinMatchSelector     (const FSSpec *         fileSpec,
  431.                                  OSType *               mixinMatchSelector);
  432. /*
  433.    This is the text of the balloon for the
  434.    Help menu item for this database.
  435. */
  436. EXTERN_API( OSErr )
  437. AGFileGetHelpMenuBalloonText    (const FSSpec *         fileSpec,
  438.                                  Str255                 helpMenuBalloonString);
  439. EXTERN_API( OSErr )
  440. AGGetSystemDB                   (AGFileDBType           databaseType,
  441.                                  Boolean                wantMixin,
  442.                                  FSSpec *               pFileSpec);
  443. #endif  /* CALL_NOT_IN_CARBON */
  444. #if PRAGMA_STRUCT_ALIGN
  445.     #pragma options align=reset
  446. #elif PRAGMA_STRUCT_PACKPUSH
  447.     #pragma pack(pop)
  448. #elif PRAGMA_STRUCT_PACK
  449.     #pragma pack()
  450. #endif
  451. #ifdef PRAGMA_IMPORT_OFF
  452. #pragma import off
  453. #elif PRAGMA_IMPORT
  454. #pragma import reset
  455. #endif
  456. #ifdef __cplusplus
  457. }
  458. #endif
  459. #endif /* __APPLEGUIDE__ */