Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

593 lines
19 KiB

  1. /*
  2. File: Balloons.h
  3. Contains: Balloon Help Package Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1990-2001 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __BALLOONS__
  11. #define __BALLOONS__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __MACERRORS__
  16. #include <MacErrors.h>
  17. #endif
  18. #ifndef __QUICKDRAW__
  19. #include <Quickdraw.h>
  20. #endif
  21. #ifndef __MENUS__
  22. #include <Menus.h>
  23. #endif
  24. #ifndef __TEXTEDIT__
  25. #include <TextEdit.h>
  26. #endif
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #if PRAGMA_IMPORT
  34. #pragma import on
  35. #endif
  36. #if PRAGMA_STRUCT_ALIGN
  37. #pragma options align=mac68k
  38. #elif PRAGMA_STRUCT_PACKPUSH
  39. #pragma pack(push, 2)
  40. #elif PRAGMA_STRUCT_PACK
  41. #pragma pack(2)
  42. #endif
  43. /*
  44. Carbon clients should use MacHelp. The definitions below will NOT work for Carbon and
  45. are only defined for those files that need to build pre-Carbon applications.
  46. */
  47. /* o.constants*/
  48. typedef SInt16 BalloonVariant;
  49. enum {
  50. kTopLeftTipPointsLeftVariant = 0,
  51. kTopLeftTipPointsUpVariant = 1,
  52. kTopRightTipPointsUpVariant = 2,
  53. kTopRightTipPointsRightVariant = 3,
  54. kBottomRightTipPointsRightVariant = 4,
  55. kBottomRightTipPointsDownVariant = 5,
  56. kBottomLeftTipPointsDownVariant = 6,
  57. kBottomLeftTipPointsLeftVariant = 7,
  58. kBalloonVariantCount = 8
  59. };
  60. enum {
  61. hmBalloonHelpVersion = 0x0002 /* The real version of the Help Manager */
  62. };
  63. enum {
  64. kHMHelpMenuID = -16490, /* Resource ID and menu ID of help menu */
  65. kHMAboutHelpItem = 1, /* help menu item number of About Balloon Help... */
  66. kHMShowBalloonsItem = 3 /* help menu item number of Show/Hide Balloons */
  67. };
  68. enum {
  69. kHMHelpID = -5696, /* ID of various Help Mgr package resources (in Pack14 range) */
  70. kBalloonWDEFID = 126 /* Resource ID of the WDEF proc used in standard balloons */
  71. };
  72. enum {
  73. /* Dialog item template type constant */
  74. helpItem = 1 /* key value in DITL template that corresponds to the help item */
  75. };
  76. enum {
  77. /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  78. hmDefaultOptions = 0, /* default options for help manager resources */
  79. hmUseSubIDBit = 0,
  80. hmAbsoluteCoordsBit = 1,
  81. hmSaveBitsNoWindowBit = 2,
  82. hmSaveBitsWindowBit = 3,
  83. hmMatchInTitleBit = 4,
  84. hmUseSubIDMask = (1 << hmUseSubIDBit), /* treat resID's in resources as subID's of driver base ID (for Desk Accessories) */
  85. hmAbsoluteCoordsMask = (1 << hmAbsoluteCoordsBit), /* ignore window port origin and treat rectangles as absolute coords (local to window) */
  86. hmSaveBitsNoWindowMask = (1 << hmSaveBitsNoWindowBit), /* don't create a window, just blast bits on screen. No update event is generated */
  87. hmSaveBitsWindowMask = (1 << hmSaveBitsWindowBit), /* create a window, but restore bits behind window when window goes away & generate update event */
  88. hmMatchInTitleMask = (1 << hmMatchInTitleBit) /* for hwin resources, match string anywhere in window title string */
  89. };
  90. #if OLDROUTINENAMES
  91. enum {
  92. hmUseSubID = hmUseSubIDMask,
  93. hmAbsoluteCoords = hmAbsoluteCoordsMask,
  94. hmSaveBitsNoWindow = hmSaveBitsNoWindowMask,
  95. hmSaveBitsWindow = hmSaveBitsWindowMask,
  96. hmMatchInTitle = hmMatchInTitleMask
  97. };
  98. #endif /* OLDROUTINENAMES */
  99. enum {
  100. /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  101. kHMStringItem = 1, /* pstring used in resource */
  102. kHMPictItem = 2, /* 'PICT' ResID used in resource */
  103. kHMStringResItem = 3, /* 'STR#' ResID & index used in resource */
  104. kHMTEResItem = 6, /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  105. kHMSTRResItem = 7, /* 'STR ' ResID used in resource */
  106. kHMSkipItem = 256, /* don't display a balloon */
  107. kHMCompareItem = 512, /* Compare pstring in menu item w/ PString in resource item ('hmnu' only) */
  108. kHMNamedResourceItem = 1024, /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  109. kHMTrackCntlItem = 2048 /* Reserved */
  110. };
  111. enum {
  112. /* Constants for hmmHelpType's when filling out HMMessageRecord */
  113. khmmString = 1, /* help message contains a PString */
  114. khmmPict = 2, /* help message contains a resource ID to a 'PICT' resource */
  115. khmmStringRes = 3, /* help message contains a res ID & index to a 'STR#' resource */
  116. khmmTEHandle = 4, /* help message contains a Text Edit handle */
  117. khmmPictHandle = 5, /* help message contains a Picture handle */
  118. khmmTERes = 6, /* help message contains a res ID to 'TEXT' & 'styl' resources */
  119. khmmSTRRes = 7, /* help message contains a res ID to a 'STR ' resource */
  120. kHMEnabledItem = 0 /* item is enabled, but not checked or control value = 0 */
  121. };
  122. enum {
  123. /* ResTypes for Styled TE Handles in Resources */
  124. kHMTETextResType = FOUR_CHAR_CODE('TEXT'), /* Resource Type of text data for styled TE record w/o style info */
  125. kHMTEStyleResType = FOUR_CHAR_CODE('styl') /* Resource Type of style information for styled TE record */
  126. };
  127. enum {
  128. kHMDisabledItem = 1, /* item is disabled, grayed in menus or disabled in dialogs */
  129. kHMCheckedItem = 2, /* item is enabled, and checked or control value = 1 */
  130. kHMOtherItem = 3, /* item is enabled, and control value > 1 */
  131. /* Method parameters to pass to HMShowBalloon */
  132. kHMRegularWindow = 0, /* Create a regular window floating above all windows */
  133. kHMSaveBitsNoWindow = 1, /* Just save the bits and draw (for MDEF calls) */
  134. kHMSaveBitsWindow = 2 /* Regular window, save bits behind, AND generate update event */
  135. };
  136. enum {
  137. /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  138. kHMMenuResType = FOUR_CHAR_CODE('hmnu'), /* ResType of help resource for supporting menus */
  139. kHMDialogResType = FOUR_CHAR_CODE('hdlg'), /* ResType of help resource for supporting dialogs */
  140. kHMWindListResType = FOUR_CHAR_CODE('hwin'), /* ResType of help resource for supporting windows */
  141. kHMRectListResType = FOUR_CHAR_CODE('hrct'), /* ResType of help resource for rectangles in windows */
  142. kHMOverrideResType = FOUR_CHAR_CODE('hovr'), /* ResType of help resource for overriding system balloons */
  143. kHMFinderApplResType = FOUR_CHAR_CODE('hfdr') /* ResType of help resource for custom balloon in Finder */
  144. };
  145. struct HMStringResType {
  146. short hmmResID;
  147. short hmmIndex;
  148. };
  149. typedef struct HMStringResType HMStringResType;
  150. struct HMMessageRecord {
  151. SInt16 hmmHelpType;
  152. union {
  153. Str255 hmmString;
  154. SInt16 hmmPict;
  155. TEHandle hmmTEHandle;
  156. HMStringResType hmmStringRes;
  157. SInt16 hmmPictRes;
  158. PicHandle hmmPictHandle;
  159. SInt16 hmmTERes;
  160. SInt16 hmmSTRRes;
  161. } u;
  162. };
  163. typedef struct HMMessageRecord HMMessageRecord;
  164. typedef HMMessageRecord * HMMessageRecPtr;
  165. typedef CALLBACK_API( OSErr , TipFunctionProcPtr )(Point tip, RgnHandle structure, Rect *r, BalloonVariant *balloonVariant);
  166. typedef STACK_UPP_TYPE(TipFunctionProcPtr) TipFunctionUPP;
  167. #if CALL_NOT_IN_CARBON
  168. /*
  169. * NewTipFunctionUPP()
  170. *
  171. * Availability:
  172. * Non-Carbon CFM: available as macro/inline
  173. * CarbonLib: not available
  174. * Mac OS X: not available
  175. */
  176. EXTERN_API_C( TipFunctionUPP )
  177. NewTipFunctionUPP(TipFunctionProcPtr userRoutine);
  178. #if !OPAQUE_UPP_TYPES
  179. enum { uppTipFunctionProcInfo = 0x00003FE0 }; /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  180. #ifdef __cplusplus
  181. inline DEFINE_API_C(TipFunctionUPP) NewTipFunctionUPP(TipFunctionProcPtr userRoutine) { return (TipFunctionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture()); }
  182. #else
  183. #define NewTipFunctionUPP(userRoutine) (TipFunctionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture())
  184. #endif
  185. #endif
  186. /*
  187. * DisposeTipFunctionUPP()
  188. *
  189. * Availability:
  190. * Non-Carbon CFM: available as macro/inline
  191. * CarbonLib: not available
  192. * Mac OS X: not available
  193. */
  194. EXTERN_API_C( void )
  195. DisposeTipFunctionUPP(TipFunctionUPP userUPP);
  196. #if !OPAQUE_UPP_TYPES
  197. #ifdef __cplusplus
  198. inline DEFINE_API_C(void) DisposeTipFunctionUPP(TipFunctionUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  199. #else
  200. #define DisposeTipFunctionUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  201. #endif
  202. #endif
  203. /*
  204. * InvokeTipFunctionUPP()
  205. *
  206. * Availability:
  207. * Non-Carbon CFM: available as macro/inline
  208. * CarbonLib: not available
  209. * Mac OS X: not available
  210. */
  211. EXTERN_API_C( OSErr )
  212. InvokeTipFunctionUPP(
  213. Point tip,
  214. RgnHandle structure,
  215. Rect * r,
  216. BalloonVariant * balloonVariant,
  217. TipFunctionUPP userUPP);
  218. #if !OPAQUE_UPP_TYPES
  219. #ifdef __cplusplus
  220. inline DEFINE_API_C(OSErr) InvokeTipFunctionUPP(Point tip, RgnHandle structure, Rect * r, BalloonVariant * balloonVariant, TipFunctionUPP userUPP) { return (OSErr)CALL_FOUR_PARAMETER_UPP(userUPP, uppTipFunctionProcInfo, tip, structure, r, balloonVariant); }
  221. #else
  222. #define InvokeTipFunctionUPP(tip, structure, r, balloonVariant, userUPP) (OSErr)CALL_FOUR_PARAMETER_UPP((userUPP), uppTipFunctionProcInfo, (tip), (structure), (r), (balloonVariant))
  223. #endif
  224. #endif
  225. #endif /* CALL_NOT_IN_CARBON */
  226. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  227. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  228. #define NewTipFunctionProc(userRoutine) NewTipFunctionUPP(userRoutine)
  229. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant) InvokeTipFunctionUPP(tip, structure, r, balloonVariant, userRoutine)
  230. #endif /* CALL_NOT_IN_CARBON */
  231. /* Public Interfaces */
  232. #if CALL_NOT_IN_CARBON
  233. /*
  234. * HMGetHelpMenuHandle()
  235. *
  236. * Availability:
  237. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  238. * CarbonLib: not available
  239. * Mac OS X: not available
  240. */
  241. EXTERN_API( OSErr )
  242. HMGetHelpMenuHandle(MenuRef * mh) THREEWORDINLINE(0x303C, 0x0200, 0xA830);
  243. #define HMGetHelpMenuRef HMGetHelpMenuHandle
  244. /*
  245. * HMShowBalloon()
  246. *
  247. * Availability:
  248. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  249. * CarbonLib: not available
  250. * Mac OS X: not available
  251. */
  252. EXTERN_API( OSErr )
  253. HMShowBalloon(
  254. const HMMessageRecord * inHelpMessage,
  255. Point inTip,
  256. Rect * inHotRect, /* can be NULL */
  257. TipFunctionUPP inTipProc,
  258. SInt16 inWindowProcID,
  259. BalloonVariant inBalloonVariant,
  260. SInt16 inMethod) THREEWORDINLINE(0x303C, 0x0B01, 0xA830);
  261. /*
  262. * HMShowMenuBalloon()
  263. *
  264. * Availability:
  265. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  266. * CarbonLib: not available
  267. * Mac OS X: not available
  268. */
  269. EXTERN_API( OSErr )
  270. HMShowMenuBalloon(
  271. SInt16 itemNum,
  272. SInt16 itemMenuID,
  273. SInt32 itemFlags,
  274. SInt32 itemReserved,
  275. Point tip,
  276. Rect * alternateRect, /* can be NULL */
  277. TipFunctionUPP tipProc,
  278. SInt16 theProc,
  279. BalloonVariant balloonVariant) THREEWORDINLINE(0x303C, 0x0E05, 0xA830);
  280. /*
  281. * HMRemoveBalloon()
  282. *
  283. * Availability:
  284. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  285. * CarbonLib: not available
  286. * Mac OS X: not available
  287. */
  288. EXTERN_API( OSErr )
  289. HMRemoveBalloon(void) THREEWORDINLINE(0x303C, 0x0002, 0xA830);
  290. /*
  291. * HMGetIndHelpMsg()
  292. *
  293. * Availability:
  294. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  295. * CarbonLib: not available
  296. * Mac OS X: not available
  297. */
  298. EXTERN_API( OSErr )
  299. HMGetIndHelpMsg(
  300. ResType inWhichResType,
  301. SInt16 inWhichResID,
  302. SInt16 inMessageIndex,
  303. SInt16 inMessageState,
  304. UInt32 * outOptions,
  305. Point * outTip,
  306. Rect * outHotRect,
  307. SInt16 * outWindowProcID,
  308. BalloonVariant * outBalloonVariant,
  309. HMMessageRecord * outHelpMessage,
  310. SInt16 * outMessageCount) THREEWORDINLINE(0x303C, 0x1306, 0xA830);
  311. /*
  312. * HMIsBalloon()
  313. *
  314. * Availability:
  315. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  316. * CarbonLib: not available
  317. * Mac OS X: not available
  318. */
  319. EXTERN_API( Boolean )
  320. HMIsBalloon(void) THREEWORDINLINE(0x303C, 0x0007, 0xA830);
  321. /*
  322. * HMGetBalloons()
  323. *
  324. * Availability:
  325. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  326. * CarbonLib: not available
  327. * Mac OS X: not available
  328. */
  329. EXTERN_API( Boolean )
  330. HMGetBalloons(void) THREEWORDINLINE(0x303C, 0x0003, 0xA830);
  331. /*
  332. * HMSetBalloons()
  333. *
  334. * Availability:
  335. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  336. * CarbonLib: not available
  337. * Mac OS X: not available
  338. */
  339. EXTERN_API( OSErr )
  340. HMSetBalloons(Boolean flag) THREEWORDINLINE(0x303C, 0x0104, 0xA830);
  341. /*
  342. * HMSetFont()
  343. *
  344. * Availability:
  345. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  346. * CarbonLib: not available
  347. * Mac OS X: not available
  348. */
  349. EXTERN_API( OSErr )
  350. HMSetFont(SInt16 font) THREEWORDINLINE(0x303C, 0x0108, 0xA830);
  351. /*
  352. * HMSetFontSize()
  353. *
  354. * Availability:
  355. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  356. * CarbonLib: not available
  357. * Mac OS X: not available
  358. */
  359. EXTERN_API( OSErr )
  360. HMSetFontSize(UInt16 fontSize) THREEWORDINLINE(0x303C, 0x0109, 0xA830);
  361. /*
  362. * HMGetFont()
  363. *
  364. * Availability:
  365. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  366. * CarbonLib: not available
  367. * Mac OS X: not available
  368. */
  369. EXTERN_API( OSErr )
  370. HMGetFont(SInt16 * font) THREEWORDINLINE(0x303C, 0x020A, 0xA830);
  371. /*
  372. * HMGetFontSize()
  373. *
  374. * Availability:
  375. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  376. * CarbonLib: not available
  377. * Mac OS X: not available
  378. */
  379. EXTERN_API( OSErr )
  380. HMGetFontSize(UInt16 * fontSize) THREEWORDINLINE(0x303C, 0x020B, 0xA830);
  381. /*
  382. * HMSetDialogResID()
  383. *
  384. * Availability:
  385. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  386. * CarbonLib: not available
  387. * Mac OS X: not available
  388. */
  389. EXTERN_API( OSErr )
  390. HMSetDialogResID(SInt16 resID) THREEWORDINLINE(0x303C, 0x010C, 0xA830);
  391. /*
  392. * HMSetMenuResID()
  393. *
  394. * Availability:
  395. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  396. * CarbonLib: not available
  397. * Mac OS X: not available
  398. */
  399. EXTERN_API( OSErr )
  400. HMSetMenuResID(
  401. SInt16 menuID,
  402. SInt16 resID) THREEWORDINLINE(0x303C, 0x020D, 0xA830);
  403. /*
  404. * HMBalloonRect()
  405. *
  406. * Availability:
  407. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  408. * CarbonLib: not available
  409. * Mac OS X: not available
  410. */
  411. EXTERN_API( OSErr )
  412. HMBalloonRect(
  413. const HMMessageRecord * inMessage,
  414. Rect * outRect) THREEWORDINLINE(0x303C, 0x040E, 0xA830);
  415. /*
  416. * HMBalloonPict()
  417. *
  418. * Availability:
  419. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  420. * CarbonLib: not available
  421. * Mac OS X: not available
  422. */
  423. EXTERN_API( OSErr )
  424. HMBalloonPict(
  425. const HMMessageRecord * inMessage,
  426. PicHandle * outPict) THREEWORDINLINE(0x303C, 0x040F, 0xA830);
  427. /*
  428. * HMScanTemplateItems()
  429. *
  430. * Availability:
  431. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  432. * CarbonLib: not available
  433. * Mac OS X: not available
  434. */
  435. EXTERN_API( OSErr )
  436. HMScanTemplateItems(
  437. SInt16 whichID,
  438. SInt16 whichResFile,
  439. ResType whichType) THREEWORDINLINE(0x303C, 0x0410, 0xA830);
  440. /*
  441. * HMExtractHelpMsg()
  442. *
  443. * Availability:
  444. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  445. * CarbonLib: not available
  446. * Mac OS X: not available
  447. */
  448. EXTERN_API( OSErr )
  449. HMExtractHelpMsg(
  450. ResType inType,
  451. SInt16 inResID,
  452. SInt16 inMessageIndex,
  453. SInt16 inMessageState,
  454. HMMessageRecord * outMessage) THREEWORDINLINE(0x303C, 0x0711, 0xA830);
  455. /*
  456. * HMGetDialogResID()
  457. *
  458. * Availability:
  459. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  460. * CarbonLib: not available
  461. * Mac OS X: not available
  462. */
  463. EXTERN_API( OSErr )
  464. HMGetDialogResID(SInt16 * resID) THREEWORDINLINE(0x303C, 0x0213, 0xA830);
  465. /*
  466. * HMGetMenuResID()
  467. *
  468. * Availability:
  469. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  470. * CarbonLib: not available
  471. * Mac OS X: not available
  472. */
  473. EXTERN_API( OSErr )
  474. HMGetMenuResID(
  475. SInt16 menuID,
  476. SInt16 * resID) THREEWORDINLINE(0x303C, 0x0314, 0xA830);
  477. /*
  478. * HMGetBalloonWindow()
  479. *
  480. * Availability:
  481. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  482. * CarbonLib: not available
  483. * Mac OS X: not available
  484. */
  485. EXTERN_API( OSErr )
  486. HMGetBalloonWindow(WindowRef * window) THREEWORDINLINE(0x303C, 0x0215, 0xA830);
  487. #endif /* CALL_NOT_IN_CARBON */
  488. #if PRAGMA_STRUCT_ALIGN
  489. #pragma options align=reset
  490. #elif PRAGMA_STRUCT_PACKPUSH
  491. #pragma pack(pop)
  492. #elif PRAGMA_STRUCT_PACK
  493. #pragma pack()
  494. #endif
  495. #ifdef PRAGMA_IMPORT_OFF
  496. #pragma import off
  497. #elif PRAGMA_IMPORT
  498. #pragma import reset
  499. #endif
  500. #ifdef __cplusplus
  501. }
  502. #endif
  503. #endif /* __BALLOONS__ */