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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       MacHelp.h
  3.  
  4.      Contains:   Macintosh Help Package Interfaces.
  5.  
  6.      Version:    Technology: CarbonLib 1.0
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1998-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 __MACHELP__
  18. #define __MACHELP__
  19. #ifndef __CONTROLS__
  20. #include "Controls.h"
  21. #endif
  22. #ifndef __DIALOGS__
  23. #include "Dialogs.h"
  24. #endif
  25. #ifndef __EVENTS__
  26. #include "Events.h"
  27. #endif
  28. #ifndef __MACWINDOWS__
  29. #include "MacWindows.h"
  30. #endif
  31. #ifndef __MENUS__
  32. #include "Menus.h"
  33. #endif
  34. #ifndef __MOVIES__
  35. #include "Movies.h"
  36. #endif
  37. #if PRAGMA_ONCE
  38. #pragma once
  39. #endif
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46. #if PRAGMA_STRUCT_ALIGN
  47.     #pragma options align=mac68k
  48. #elif PRAGMA_STRUCT_PACKPUSH
  49.     #pragma pack(push, 2)
  50. #elif PRAGMA_STRUCT_PACK
  51.     #pragma pack(2)
  52. #endif
  53. /*----------------------------------------------------------------------------------*/
  54. /* Help Manager constants, etc.                                                     */
  55. /*----------------------------------------------------------------------------------*/
  56. #ifndef __BALLOONS__
  57. enum {
  58.     kMacHelpVersion             = 0x0003,
  59.     hmBalloonHelpVersion        = kMacHelpVersion               /* Backwards compatibility */
  60. };
  61. #endif  /* !defined(__BALLOONS__) */
  62. typedef SInt16 HMContentRequest;
  63. enum {
  64.     kHMSupplyContent            = 0,
  65.     kHMDisposeContent           = 1
  66. };
  67. typedef UInt32 HMContentType;
  68. enum {
  69.     kHMNoContent                = FOUR_CHAR_CODE('none'),
  70.     kHMPascalStrContent         = FOUR_CHAR_CODE('pstr'),
  71.     kHMPictResContent           = FOUR_CHAR_CODE('pict'),
  72.     kHMStringResContent         = FOUR_CHAR_CODE('str#'),
  73.     kHMTEHandleContent          = FOUR_CHAR_CODE('txth'),
  74.     kHMPictHandleContent        = FOUR_CHAR_CODE('pcth'),
  75.     kHMTextResContent           = FOUR_CHAR_CODE('text'),
  76.     kHMStrResContent            = FOUR_CHAR_CODE('str '),
  77.     kHMMovieContent             = FOUR_CHAR_CODE('moov')
  78. };
  79. typedef SInt16 HMTagDisplaySide;
  80. enum {
  81.     kHMDefaultSide              = 0,
  82.     kHMTopSide                  = 1,
  83.     kHMLeftSide                 = 2,
  84.     kHMBottomSide               = 3,
  85.     kHMRightSide                = 4,
  86.     kHMTopLeftCorner            = 5,
  87.     kHMTopRightCorner           = 6,
  88.     kHMLeftTopCorner            = 7,
  89.     kHMLeftBottomCorner         = 8,
  90.     kHMBottomLeftCorner         = 9,
  91.     kHMBottomRightCorner        = 10,
  92.     kHMRightTopCorner           = 11,
  93.     kHMRightBottomCorner        = 12
  94. };
  95. typedef SInt16 HMContentProvidedType;
  96. enum {
  97.     kHMContentProvided          = 0,
  98.     kHMContentNotProvided       = 1,
  99.     kHMContentNotProvidedDontPropagate = 2
  100. };
  101. enum {
  102.     kHMMinimumContentIndex      = 0,
  103.     kHMMaximumContentIndex      = 1
  104. };
  105. enum {
  106.     kHMIllegalContentForMinimumState = -1000                    /* *** Need real numbers here*/
  107. };
  108. enum {
  109.     kHMHelpPropertyContentTag   = FOUR_CHAR_CODE('help')
  110. };
  111. #ifndef __BALLOONS__
  112. struct HMStringResType {
  113.     short                           hmmResID;
  114.     short                           hmmIndex;
  115. };
  116. typedef struct HMStringResType          HMStringResType;
  117. #endif  /* !defined(__BALLOONS__) */
  118. struct HMHelpContent {
  119.     HMContentType                   contentType;
  120.     union {
  121.         Str255                          tagString;              /* Pascal String*/
  122.         SInt16                          tagPictID;              /* 'PICT' resource ID*/
  123.         HMStringResType                 tagStringRes;           /* STR# resource ID and index*/
  124.         TEHandle                        tagTEHandle;            /* TextEdit handle*/
  125.         PicHandle                       tagPictHandle;          /* Picture handle*/
  126.         SInt16                          tagTextRes;             /* TEXT/styl resource ID*/
  127.         SInt16                          tagStrRes;              /* STR resource ID*/
  128.         Movie                           tagMovie;               /* QuickTime movie*/
  129.     }                                 u;
  130. };
  131. typedef struct HMHelpContent            HMHelpContent;
  132. struct HMHelpContentRec {
  133.     SInt32                          version;
  134.     Rect                            absHotRect;
  135.     HMTagDisplaySide                tagSide;
  136.     HMHelpContent                   content[2];
  137. };
  138. typedef struct HMHelpContentRec         HMHelpContentRec;
  139. typedef HMHelpContentRec *              HMHelpContentPtr;
  140. /*------------------------------------------------------------------------------------------*/
  141. /* Callback procs                                       */
  142. /*------------------------------------------------------------------------------------------ */
  143. typedef CALLBACK_API( OSStatus , HMControlContentProcPtr )(ControlRef inControl, Point inGlobalMouse, HMContentRequest inRequest, HMContentProvidedType *outContentProvided, HMHelpContentPtr ioHelpContent);
  144. typedef CALLBACK_API( OSStatus , HMWindowContentProcPtr )(WindowPtr inWindow, Point inGlobalMouse, HMContentRequest inRequest, HMContentProvidedType *outContentProvided, HMHelpContentPtr ioHelpContent);
  145. typedef CALLBACK_API( OSStatus , HMMenuTitleContentProcPtr )(MenuHandle inMenu, HMContentRequest inRequest, HMContentProvidedType *outContentProvided, HMHelpContentPtr ioHelpContent);
  146. typedef CALLBACK_API( OSStatus , HMMenuItemContentProcPtr )(const MenuTrackingData *inTrackingData, HMContentRequest inRequest, HMContentProvidedType *outContentProvided, HMHelpContentPtr ioHelpContent);
  147. typedef STACK_UPP_TYPE(HMControlContentProcPtr)                 HMControlContentUPP;
  148. typedef STACK_UPP_TYPE(HMWindowContentProcPtr)                  HMWindowContentUPP;
  149. typedef STACK_UPP_TYPE(HMMenuTitleContentProcPtr)               HMMenuTitleContentUPP;
  150. typedef STACK_UPP_TYPE(HMMenuItemContentProcPtr)                HMMenuItemContentUPP;
  151. #if OPAQUE_UPP_TYPES
  152.     EXTERN_API(HMControlContentUPP)
  153.     NewHMControlContentUPP         (HMControlContentProcPtr userRoutine);
  154.     EXTERN_API(HMWindowContentUPP)
  155.     NewHMWindowContentUPP          (HMWindowContentProcPtr  userRoutine);
  156.     EXTERN_API(HMMenuTitleContentUPP)
  157.     NewHMMenuTitleContentUPP       (HMMenuTitleContentProcPtr userRoutine);
  158.     EXTERN_API(HMMenuItemContentUPP)
  159.     NewHMMenuItemContentUPP        (HMMenuItemContentProcPtr userRoutine);
  160.     EXTERN_API(void)
  161.     DisposeHMControlContentUPP     (HMControlContentUPP     userUPP);
  162.     EXTERN_API(void)
  163.     DisposeHMWindowContentUPP      (HMWindowContentUPP      userUPP);
  164.     EXTERN_API(void)
  165.     DisposeHMMenuTitleContentUPP    (HMMenuTitleContentUPP  userUPP);
  166.     EXTERN_API(void)
  167.     DisposeHMMenuItemContentUPP    (HMMenuItemContentUPP    userUPP);
  168.     EXTERN_API(OSStatus)
  169.     InvokeHMControlContentUPP      (ControlRef              inControl,
  170.                                     Point                   inGlobalMouse,
  171.                                     HMContentRequest        inRequest,
  172.                                     HMContentProvidedType * outContentProvided,
  173.                                     HMHelpContentPtr        ioHelpContent,
  174.                                     HMControlContentUPP     userUPP);
  175.     EXTERN_API(OSStatus)
  176.     InvokeHMWindowContentUPP       (WindowPtr               inWindow,
  177.                                     Point                   inGlobalMouse,
  178.                                     HMContentRequest        inRequest,
  179.                                     HMContentProvidedType * outContentProvided,
  180.                                     HMHelpContentPtr        ioHelpContent,
  181.                                     HMWindowContentUPP      userUPP);
  182.     EXTERN_API(OSStatus)
  183.     InvokeHMMenuTitleContentUPP    (MenuHandle              inMenu,
  184.                                     HMContentRequest        inRequest,
  185.                                     HMContentProvidedType * outContentProvided,
  186.                                     HMHelpContentPtr        ioHelpContent,
  187.                                     HMMenuTitleContentUPP   userUPP);
  188.     EXTERN_API(OSStatus)
  189.     InvokeHMMenuItemContentUPP     (const MenuTrackingData * inTrackingData,
  190.                                     HMContentRequest        inRequest,
  191.                                     HMContentProvidedType * outContentProvided,
  192.                                     HMHelpContentPtr        ioHelpContent,
  193.                                     HMMenuItemContentUPP    userUPP);
  194. #else
  195.     enum { uppHMControlContentProcInfo = 0x0000FBF0 };              /* pascal 4_bytes Func(4_bytes, 4_bytes, 2_bytes, 4_bytes, 4_bytes) */
  196.     enum { uppHMWindowContentProcInfo = 0x0000FBF0 };               /* pascal 4_bytes Func(4_bytes, 4_bytes, 2_bytes, 4_bytes, 4_bytes) */
  197.     enum { uppHMMenuTitleContentProcInfo = 0x00003EF0 };            /* pascal 4_bytes Func(4_bytes, 2_bytes, 4_bytes, 4_bytes) */
  198.     enum { uppHMMenuItemContentProcInfo = 0x00003EF0 };             /* pascal 4_bytes Func(4_bytes, 2_bytes, 4_bytes, 4_bytes) */
  199.     #define NewHMControlContentUPP(userRoutine)                     (HMControlContentUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHMControlContentProcInfo, GetCurrentArchitecture())
  200.     #define NewHMWindowContentUPP(userRoutine)                      (HMWindowContentUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHMWindowContentProcInfo, GetCurrentArchitecture())
  201.     #define NewHMMenuTitleContentUPP(userRoutine)                   (HMMenuTitleContentUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHMMenuTitleContentProcInfo, GetCurrentArchitecture())
  202.     #define NewHMMenuItemContentUPP(userRoutine)                    (HMMenuItemContentUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHMMenuItemContentProcInfo, GetCurrentArchitecture())
  203.     #define DisposeHMControlContentUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  204.     #define DisposeHMWindowContentUPP(userUPP)                      DisposeRoutineDescriptor(userUPP)
  205.     #define DisposeHMMenuTitleContentUPP(userUPP)                   DisposeRoutineDescriptor(userUPP)
  206.     #define DisposeHMMenuItemContentUPP(userUPP)                    DisposeRoutineDescriptor(userUPP)
  207.     #define InvokeHMControlContentUPP(inControl, inGlobalMouse, inRequest, outContentProvided, ioHelpContent, userUPP)  (OSStatus)CALL_FIVE_PARAMETER_UPP((userUPP), uppHMControlContentProcInfo, (inControl), (inGlobalMouse), (inRequest), (outContentProvided), (ioHelpContent))
  208.     #define InvokeHMWindowContentUPP(inWindow, inGlobalMouse, inRequest, outContentProvided, ioHelpContent, userUPP)  (OSStatus)CALL_FIVE_PARAMETER_UPP((userUPP), uppHMWindowContentProcInfo, (inWindow), (inGlobalMouse), (inRequest), (outContentProvided), (ioHelpContent))
  209.     #define InvokeHMMenuTitleContentUPP(inMenu, inRequest, outContentProvided, ioHelpContent, userUPP)  (OSStatus)CALL_FOUR_PARAMETER_UPP((userUPP), uppHMMenuTitleContentProcInfo, (inMenu), (inRequest), (outContentProvided), (ioHelpContent))
  210.     #define InvokeHMMenuItemContentUPP(inTrackingData, inRequest, outContentProvided, ioHelpContent, userUPP)  (OSStatus)CALL_FOUR_PARAMETER_UPP((userUPP), uppHMMenuItemContentProcInfo, (inTrackingData), (inRequest), (outContentProvided), (ioHelpContent))
  211. #endif
  212. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  213. #define NewHMControlContentProc(userRoutine)                    NewHMControlContentUPP(userRoutine)
  214. #define NewHMWindowContentProc(userRoutine)                     NewHMWindowContentUPP(userRoutine)
  215. #define NewHMMenuTitleContentProc(userRoutine)                  NewHMMenuTitleContentUPP(userRoutine)
  216. #define NewHMMenuItemContentProc(userRoutine)                   NewHMMenuItemContentUPP(userRoutine)
  217. #define CallHMControlContentProc(userRoutine, inControl, inGlobalMouse, inRequest, outContentProvided, ioHelpContent) InvokeHMControlContentUPP(inControl, inGlobalMouse, inRequest, outContentProvided, ioHelpContent, userRoutine)
  218. #define CallHMWindowContentProc(userRoutine, inWindow, inGlobalMouse, inRequest, outContentProvided, ioHelpContent) InvokeHMWindowContentUPP(inWindow, inGlobalMouse, inRequest, outContentProvided, ioHelpContent, userRoutine)
  219. #define CallHMMenuTitleContentProc(userRoutine, inMenu, inRequest, outContentProvided, ioHelpContent) InvokeHMMenuTitleContentUPP(inMenu, inRequest, outContentProvided, ioHelpContent, userRoutine)
  220. #define CallHMMenuItemContentProc(userRoutine, inTrackingData, inRequest, outContentProvided, ioHelpContent) InvokeHMMenuItemContentUPP(inTrackingData, inRequest, outContentProvided, ioHelpContent, userRoutine)
  221. /*------------------------------------------------------------------------------------------*/
  222. /* API                                                                                      */
  223. /*------------------------------------------------------------------------------------------*/
  224. /* Installing/Retrieving Content */
  225. EXTERN_API( OSStatus )
  226. HMSetControlHelpContent         (ControlRef             inControl,
  227.                                  const HMHelpContentRec * inContent);
  228. EXTERN_API( OSStatus )
  229. HMGetControlHelpContent         (ControlRef             inControl,
  230.                                  HMHelpContentRec *     outContent);
  231. EXTERN_API( OSStatus )
  232. HMSetWindowHelpContent          (WindowRef              inWindow,
  233.                                  const HMHelpContentRec * inContent);
  234. EXTERN_API( OSStatus )
  235. HMGetWindowHelpContent          (WindowRef              inWindow,
  236.                                  HMHelpContentRec *     outContent);
  237. EXTERN_API( OSStatus )
  238. HMSetMenuItemHelpContent        (MenuRef                inMenu,
  239.                                  MenuItemIndex          inItem,
  240.                                  const HMHelpContentRec * inContent);
  241. EXTERN_API( OSStatus )
  242. HMGetMenuItemHelpContent        (MenuRef                inMenu,
  243.                                  MenuItemIndex          inItem,
  244.                                  HMHelpContentRec *     outContent);
  245. /* Installing/Retrieving Content Callbacks */
  246. EXTERN_API( OSStatus )
  247. HMInstallControlContentCallback (ControlRef             inControl,
  248.                                  HMControlContentUPP    inContentUPP);
  249. EXTERN_API( OSStatus )
  250. HMInstallWindowContentCallback  (WindowRef              inWindow,
  251.                                  HMWindowContentUPP     inContentUPP);
  252. EXTERN_API( OSStatus )
  253. HMInstallMenuTitleContentCallback (MenuRef              inMenu,
  254.                                  HMMenuTitleContentUPP  inContentUPP);
  255. EXTERN_API( OSStatus )
  256. HMInstallMenuItemContentCallback (MenuRef               inMenu,
  257.                                  HMMenuItemContentUPP   inContentUPP);
  258. EXTERN_API( OSStatus )
  259. HMGetControlContentCallback     (ControlRef             inControl,
  260.                                  HMControlContentUPP *  outContentUPP);
  261. EXTERN_API( OSStatus )
  262. HMGetWindowContentCallback      (WindowRef              inWindow,
  263.                                  HMWindowContentUPP *   outContentUPP);
  264. EXTERN_API( OSStatus )
  265. HMGetMenuTitleContentCallback   (MenuRef                inMenu,
  266.                                  HMMenuTitleContentUPP * outContentUPP);
  267. EXTERN_API( OSStatus )
  268. HMGetMenuItemContentCallback    (MenuRef                inMenu,
  269.                                  HMMenuItemContentUPP * outContentUPP);
  270. /* Enabling and Disabling Help Tags */
  271. EXTERN_API( Boolean )
  272. HMAreHelpTagsDisplayed          (void);
  273. EXTERN_API( OSStatus )
  274. HMSetHelpTagsDisplayed          (Boolean                inDisplayTags);
  275. EXTERN_API( OSStatus )
  276. HMSetTagDelay                   (Duration               inDelay);
  277. EXTERN_API( OSStatus )
  278. HMGetTagDelay                   (Duration *             outDelay);
  279. /* Compatibility */
  280. EXTERN_API( OSStatus )
  281. HMSetMenuHelpFromBalloonRsrc    (MenuRef                inMenu,
  282.                                  SInt16                 inHmnuRsrcID);
  283. EXTERN_API( OSStatus )
  284. HMSetDialogHelpFromBalloonRsrc  (DialogRef              inDialog,
  285.                                  SInt16                 inHdlgRsrcID,
  286.                                  SInt16                 inItemStart);
  287. #if PRAGMA_STRUCT_ALIGN
  288.     #pragma options align=reset
  289. #elif PRAGMA_STRUCT_PACKPUSH
  290.     #pragma pack(pop)
  291. #elif PRAGMA_STRUCT_PACK
  292.     #pragma pack()
  293. #endif
  294. #ifdef PRAGMA_IMPORT_OFF
  295. #pragma import off
  296. #elif PRAGMA_IMPORT
  297. #pragma import reset
  298. #endif
  299. #ifdef __cplusplus
  300. }
  301. #endif
  302. #endif /* __MACHELP__ */