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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Balloons.h
  3.  
  4.      Contains:   Balloon Help Package Interfaces.
  5.  
  6.      Version:    Technology: System 7.0
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1990-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 __BALLOONS__
  18. #define __BALLOONS__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __QUICKDRAW__
  23. #include "Quickdraw.h"
  24. #endif
  25. #ifndef __MENUS__
  26. #include "Menus.h"
  27. #endif
  28. #ifndef __TEXTEDIT__
  29. #include "TextEdit.h"
  30. #endif
  31. #ifndef __MACERRORS__
  32. #include "MacErrors.h"
  33. #endif
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50. /*
  51.    Carbon clients should use MacHelp. The definitions below will NOT work for Carbon and
  52.    are only defined for those files that need to build pre-Carbon applications.
  53. */
  54. /* o.constants*/
  55. typedef SInt16 BalloonVariant;
  56. enum {
  57.     kTopLeftTipPointsLeftVariant = 0,
  58.     kTopLeftTipPointsUpVariant  = 1,
  59.     kTopRightTipPointsUpVariant = 2,
  60.     kTopRightTipPointsRightVariant = 3,
  61.     kBottomRightTipPointsRightVariant = 4,
  62.     kBottomRightTipPointsDownVariant = 5,
  63.     kBottomLeftTipPointsDownVariant = 6,
  64.     kBottomLeftTipPointsLeftVariant = 7,
  65.     kBalloonVariantCount        = 8
  66. };
  67. #ifndef __MACHELP__
  68. enum {
  69.     hmBalloonHelpVersion        = 0x0002                        /* The real version of the Help Manager */
  70. };
  71. #endif  /* !defined(__MACHELP__) */
  72. enum {
  73.     kHMHelpMenuID               = -16490,                       /* Resource ID and menu ID of help menu */
  74.     kHMAboutHelpItem            = 1,                            /* help menu item number of About Balloon Help... */
  75.     kHMShowBalloonsItem         = 3                             /* help menu item number of Show/Hide Balloons */
  76. };
  77. enum {
  78.     kHMHelpID                   = -5696,                        /* ID of various Help Mgr package resources (in Pack14 range) */
  79.     kBalloonWDEFID              = 126                           /* Resource ID of the WDEF proc used in standard balloons */
  80. };
  81. enum {
  82.                                                                 /* Dialog item template type constant */
  83.     helpItem                    = 1                             /* key value in DITL template that corresponds to the help item */
  84. };
  85. enum {
  86.                                                                 /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  87.     hmDefaultOptions            = 0,                            /* default options for help manager resources */
  88.     hmUseSubID                  = 1,                            /* treat resID's in resources as subID's of driver base ID (for Desk Accessories) */
  89.     hmAbsoluteCoords            = 2                             /* ignore window port origin and treat rectangles as absolute coords (local to window) */
  90. };
  91. enum {
  92.     hmSaveBitsNoWindow          = 4,                            /* don't create a window, just blast bits on screen. No update event is generated */
  93.     hmSaveBitsWindow            = 8,                            /* create a window, but restore bits behind window when window goes away & generate update event */
  94.     hmMatchInTitle              = 16                            /* for hwin resources, match string anywhere in window title string */
  95. };
  96. enum {
  97.                                                                 /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  98.     kHMStringItem               = 1,                            /* pstring used in resource */
  99.     kHMPictItem                 = 2,                            /* 'PICT' ResID used in resource */
  100.     kHMStringResItem            = 3,                            /* 'STR#' ResID & index used in resource */
  101.     kHMTEResItem                = 6,                            /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  102.     kHMSTRResItem               = 7,                            /* 'STR ' ResID used in resource */
  103.     kHMSkipItem                 = 256,                          /* don't display a balloon */
  104.     kHMCompareItem              = 512,                          /* Compare pstring in menu item w/ PString in resource item ('hmnu' only) */
  105.     kHMNamedResourceItem        = 1024,                         /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  106.     kHMTrackCntlItem            = 2048                          /* Reserved */
  107. };
  108. enum {
  109.                                                                 /* Constants for hmmHelpType's when filling out HMMessageRecord */
  110.     khmmString                  = 1,                            /* help message contains a PString */
  111.     khmmPict                    = 2,                            /* help message contains a resource ID to a 'PICT' resource */
  112.     khmmStringRes               = 3,                            /* help message contains a res ID & index to a 'STR#' resource */
  113.     khmmTEHandle                = 4,                            /* help message contains a Text Edit handle */
  114.     khmmPictHandle              = 5,                            /* help message contains a Picture handle */
  115.     khmmTERes                   = 6,                            /* help message contains a res ID to 'TEXT' & 'styl' resources */
  116.     khmmSTRRes                  = 7,                            /* help message contains a res ID to a 'STR ' resource */
  117.     kHMEnabledItem              = 0                             /* item is enabled, but not checked or control value = 0 */
  118. };
  119. enum {
  120.                                                                 /* ResTypes for Styled TE Handles in Resources */
  121.     kHMTETextResType            = FOUR_CHAR_CODE('TEXT'),       /* Resource Type of text data for styled TE record w/o style info */
  122.     kHMTEStyleResType           = FOUR_CHAR_CODE('styl')        /* Resource Type of style information for styled TE record */
  123. };
  124. enum {
  125.     kHMDisabledItem             = 1,                            /* item is disabled, grayed in menus or disabled in dialogs */
  126.     kHMCheckedItem              = 2,                            /* item is enabled, and checked or control value = 1 */
  127.     kHMOtherItem                = 3,                            /* item is enabled, and control value > 1 */
  128.                                                                 /* Method parameters to pass to HMShowBalloon */
  129.     kHMRegularWindow            = 0,                            /* Create a regular window floating above all windows */
  130.     kHMSaveBitsNoWindow         = 1,                            /* Just save the bits and draw (for MDEF calls) */
  131.     kHMSaveBitsWindow           = 2                             /* Regular window, save bits behind, AND generate update event */
  132. };
  133. enum {
  134.                                                                 /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  135.     kHMMenuResType              = FOUR_CHAR_CODE('hmnu'),       /* ResType of help resource for supporting menus */
  136.     kHMDialogResType            = FOUR_CHAR_CODE('hdlg'),       /* ResType of help resource for supporting dialogs */
  137.     kHMWindListResType          = FOUR_CHAR_CODE('hwin'),       /* ResType of help resource for supporting windows */
  138.     kHMRectListResType          = FOUR_CHAR_CODE('hrct'),       /* ResType of help resource for rectangles in windows */
  139.     kHMOverrideResType          = FOUR_CHAR_CODE('hovr'),       /* ResType of help resource for overriding system balloons */
  140.     kHMFinderApplResType        = FOUR_CHAR_CODE('hfdr')        /* ResType of help resource for custom balloon in Finder */
  141. };
  142. #ifndef __MACHELP__
  143. struct HMStringResType {
  144.     short                           hmmResID;
  145.     short                           hmmIndex;
  146. };
  147. typedef struct HMStringResType          HMStringResType;
  148. #endif  /* !defined(__MACHELP__) */
  149. struct HMMessageRecord {
  150.     SInt16                          hmmHelpType;
  151.     union {
  152.         Str255                          hmmString;
  153.         SInt16                          hmmPict;
  154.         TEHandle                        hmmTEHandle;
  155.         HMStringResType                 hmmStringRes;
  156.         SInt16                          hmmPictRes;
  157.         PicHandle                       hmmPictHandle;
  158.         SInt16                          hmmTERes;
  159.         SInt16                          hmmSTRRes;
  160.     }                                 u;
  161. };
  162. typedef struct HMMessageRecord          HMMessageRecord;
  163. typedef HMMessageRecord *               HMMessageRecPtr;
  164. typedef CALLBACK_API( OSErr , TipFunctionProcPtr )(Point tip, RgnHandle structure, Rect *r, BalloonVariant *balloonVariant);
  165. typedef STACK_UPP_TYPE(TipFunctionProcPtr)                      TipFunctionUPP;
  166. #if OPAQUE_UPP_TYPES
  167. #if CALL_NOT_IN_CARBON
  168.     EXTERN_API(TipFunctionUPP)
  169.     NewTipFunctionUPP              (TipFunctionProcPtr      userRoutine);
  170.     EXTERN_API(void)
  171.     DisposeTipFunctionUPP          (TipFunctionUPP          userUPP);
  172.     EXTERN_API(OSErr)
  173.     InvokeTipFunctionUPP           (Point                   tip,
  174.                                     RgnHandle               structure,
  175.                                     Rect *                  r,
  176.                                     BalloonVariant *        balloonVariant,
  177.                                     TipFunctionUPP          userUPP);
  178. #endif  /* CALL_NOT_IN_CARBON */
  179. #else
  180.     enum { uppTipFunctionProcInfo = 0x00003FE0 };                   /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  181.     #define NewTipFunctionUPP(userRoutine)                          (TipFunctionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture())
  182.     #define DisposeTipFunctionUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  183.     #define InvokeTipFunctionUPP(tip, structure, r, balloonVariant, userUPP)  (OSErr)CALL_FOUR_PARAMETER_UPP((userUPP), uppTipFunctionProcInfo, (tip), (structure), (r), (balloonVariant))
  184. #endif
  185. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  186. #define NewTipFunctionProc(userRoutine)                         NewTipFunctionUPP(userRoutine)
  187. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant) InvokeTipFunctionUPP(tip, structure, r, balloonVariant, userRoutine)
  188. /*  Public Interfaces  */
  189. #if CALL_NOT_IN_CARBON
  190. EXTERN_API( OSErr )
  191. HMGetHelpMenuHandle             (MenuHandle *           mh)                                 THREEWORDINLINE(0x303C, 0x0200, 0xA830);
  192. EXTERN_API( OSErr )
  193. HMShowBalloon                   (const HMMessageRecord * inHelpMessage,
  194.                                  Point                  inTip,
  195.                                  Rect *                 inHotRect, /* can be NULL */
  196.                                  TipFunctionUPP         inTipProc,
  197.                                  SInt16                 inWindowProcID,
  198.                                  BalloonVariant         inBalloonVariant,
  199.                                  SInt16                 inMethod)                           THREEWORDINLINE(0x303C, 0x0B01, 0xA830);
  200. EXTERN_API( OSErr )
  201. HMShowMenuBalloon               (SInt16                 itemNum,
  202.                                  SInt16                 itemMenuID,
  203.                                  SInt32                 itemFlags,
  204.                                  SInt32                 itemReserved,
  205.                                  Point                  tip,
  206.                                  Rect *                 alternateRect, /* can be NULL */
  207.                                  TipFunctionUPP         tipProc,
  208.                                  SInt16                 theProc,
  209.                                  BalloonVariant         balloonVariant)                     THREEWORDINLINE(0x303C, 0x0E05, 0xA830);
  210. EXTERN_API( OSErr )
  211. HMRemoveBalloon                 (void)                                                      THREEWORDINLINE(0x303C, 0x0002, 0xA830);
  212. EXTERN_API( OSErr )
  213. HMGetIndHelpMsg                 (ResType                inWhichResType,
  214.                                  SInt16                 inWhichResID,
  215.                                  SInt16                 inMessageIndex,
  216.                                  SInt16                 inMessageState,
  217.                                  UInt32 *               outOptions,
  218.                                  Point *                outTip,
  219.                                  Rect *                 outHotRect,
  220.                                  SInt16 *               outWindowProcID,
  221.                                  BalloonVariant *       outBalloonVariant,
  222.                                  HMMessageRecord *      outHelpMessage,
  223.                                  SInt16 *               outMessageCount)                    THREEWORDINLINE(0x303C, 0x1306, 0xA830);
  224. EXTERN_API( Boolean )
  225. HMIsBalloon                     (void)                                                      THREEWORDINLINE(0x303C, 0x0007, 0xA830);
  226. EXTERN_API( Boolean )
  227. HMGetBalloons                   (void)                                                      THREEWORDINLINE(0x303C, 0x0003, 0xA830);
  228. EXTERN_API( OSErr )
  229. HMSetBalloons                   (Boolean                flag)                               THREEWORDINLINE(0x303C, 0x0104, 0xA830);
  230. EXTERN_API( OSErr )
  231. HMSetFont                       (SInt16                 font)                               THREEWORDINLINE(0x303C, 0x0108, 0xA830);
  232. EXTERN_API( OSErr )
  233. HMSetFontSize                   (UInt16                 fontSize)                           THREEWORDINLINE(0x303C, 0x0109, 0xA830);
  234. EXTERN_API( OSErr )
  235. HMGetFont                       (SInt16 *               font)                               THREEWORDINLINE(0x303C, 0x020A, 0xA830);
  236. EXTERN_API( OSErr )
  237. HMGetFontSize                   (UInt16 *               fontSize)                           THREEWORDINLINE(0x303C, 0x020B, 0xA830);
  238. EXTERN_API( OSErr )
  239. HMSetDialogResID                (SInt16                 resID)                              THREEWORDINLINE(0x303C, 0x010C, 0xA830);
  240. EXTERN_API( OSErr )
  241. HMSetMenuResID                  (SInt16                 menuID,
  242.                                  SInt16                 resID)                              THREEWORDINLINE(0x303C, 0x020D, 0xA830);
  243. EXTERN_API( OSErr )
  244. HMBalloonRect                   (const HMMessageRecord * inMessage,
  245.                                  Rect *                 outRect)                            THREEWORDINLINE(0x303C, 0x040E, 0xA830);
  246. EXTERN_API( OSErr )
  247. HMBalloonPict                   (const HMMessageRecord * inMessage,
  248.                                  PicHandle *            outPict)                            THREEWORDINLINE(0x303C, 0x040F, 0xA830);
  249. EXTERN_API( OSErr )
  250. HMScanTemplateItems             (SInt16                 whichID,
  251.                                  SInt16                 whichResFile,
  252.                                  ResType                whichType)                          THREEWORDINLINE(0x303C, 0x0410, 0xA830);
  253. EXTERN_API( OSErr )
  254. HMExtractHelpMsg                (ResType                inType,
  255.                                  SInt16                 inResID,
  256.                                  SInt16                 inMessageIndex,
  257.                                  SInt16                 inMessageState,
  258.                                  HMMessageRecord *      outMessage)                         THREEWORDINLINE(0x303C, 0x0711, 0xA830);
  259. EXTERN_API( OSErr )
  260. HMGetDialogResID                (SInt16 *               resID)                              THREEWORDINLINE(0x303C, 0x0213, 0xA830);
  261. EXTERN_API( OSErr )
  262. HMGetMenuResID                  (SInt16                 menuID,
  263.                                  SInt16 *               resID)                              THREEWORDINLINE(0x303C, 0x0314, 0xA830);
  264. EXTERN_API( OSErr )
  265. HMGetBalloonWindow              (WindowPtr *            window)                             THREEWORDINLINE(0x303C, 0x0215, 0xA830);
  266. #endif  /* CALL_NOT_IN_CARBON */
  267. #if PRAGMA_STRUCT_ALIGN
  268.     #pragma options align=reset
  269. #elif PRAGMA_STRUCT_PACKPUSH
  270.     #pragma pack(pop)
  271. #elif PRAGMA_STRUCT_PACK
  272.     #pragma pack()
  273. #endif
  274. #ifdef PRAGMA_IMPORT_OFF
  275. #pragma import off
  276. #elif PRAGMA_IMPORT
  277. #pragma import reset
  278. #endif
  279. #ifdef __cplusplus
  280. }
  281. #endif
  282. #endif /* __BALLOONS__ */