Mac OS 9
Balloons.h
Go to the documentation of this file.
1 
19 #ifndef __BALLOONS__
20 #define __BALLOONS__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __QUICKDRAW__
27 #include <Quickdraw.h>
28 #endif
29 
30 #ifndef __MENUS__
31 #include <Menus.h>
32 #endif
33 
34 #ifndef __TEXTEDIT__
35 #include <TextEdit.h>
36 #endif
37 
38 #ifndef __MACERRORS__
39 #include <MacErrors.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 
68  /* ©©constants*/
69 
70  typedef SInt16 BalloonVariant;
71  enum
72  {
73  kTopLeftTipPointsLeftVariant = 0,
74  kTopLeftTipPointsUpVariant = 1,
75  kTopRightTipPointsUpVariant = 2,
76  kTopRightTipPointsRightVariant = 3,
77  kBottomRightTipPointsRightVariant = 4,
78  kBottomRightTipPointsDownVariant = 5,
79  kBottomLeftTipPointsDownVariant = 6,
80  kBottomLeftTipPointsLeftVariant = 7,
81  kBalloonVariantCount = 8
82  };
83 
84  enum
85  {
86  hmBalloonHelpVersion = 0x0002 /* The real version of the Help Manager */
87  };
88 
89  enum
90  {
91  kHMHelpMenuID = -16490, /* Resource ID and menu ID of help menu */
92  kHMAboutHelpItem = 1, /* help menu item number of About Balloon Help© */
93  kHMShowBalloonsItem = 3 /* help menu item number of Show/Hide Balloons */
94  };
95 
96  enum
97  {
98  kHMHelpID =
99  -5696, /* ID of various Help Mgr package resources (in Pack14 range) */
100  kBalloonWDEFID =
101  126 /* Resource ID of the WDEF proc used in standard balloons */
102  };
103 
104  enum
105  {
106  /* Dialog item template type constant */
107  helpItem =
108  1 /* key value in DITL template that corresponds to the help item */
109  };
110 
111  enum
112  {
113  /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', &
114  'hfdr' resources */
115  hmDefaultOptions = 0, /* default options for help manager resources */
116  hmUseSubIDBit = 0,
117  hmAbsoluteCoordsBit = 1,
118  hmSaveBitsNoWindowBit = 2,
119  hmSaveBitsWindowBit = 3,
120  hmMatchInTitleBit = 4,
121  hmUseSubIDMask =
122  (1 << hmUseSubIDBit), /* treat resID's in resources as subID's of driver
123  base ID (for Desk Accessories) */
124  hmAbsoluteCoordsMask =
125  (1 << hmAbsoluteCoordsBit), /* ignore window port origin and treat
126  rectangles as absolute coords (local to
127  window) */
128  hmSaveBitsNoWindowMask =
129  (1 << hmSaveBitsNoWindowBit), /* don't create a window, just blast bits on
130  screen. No update event is generated */
131  hmSaveBitsWindowMask =
132  (1 << hmSaveBitsWindowBit), /* create a window, but restore bits behind
133  window when window goes away & generate
134  update event */
135  hmMatchInTitleMask =
136  (1 << hmMatchInTitleBit) /* for hwin resources, match string anywhere in
137  window title string */
138  };
139 
140 #if OLDROUTINENAMES
141  enum
142  {
143  hmUseSubID = hmUseSubIDMask,
144  hmAbsoluteCoords = hmAbsoluteCoordsMask,
145  hmSaveBitsNoWindow = hmSaveBitsNoWindowMask,
146  hmSaveBitsWindow = hmSaveBitsWindowMask,
147  hmMatchInTitle = hmMatchInTitleMask
148  };
149 
150 #endif /* OLDROUTINENAMES */
151 
152  enum
153  {
154  /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr'
155  resources */
156  kHMStringItem = 1, /* pstring used in resource */
157  kHMPictItem = 2, /* 'PICT' ResID used in resource */
158  kHMStringResItem = 3, /* 'STR#' ResID & index used in resource */
159  kHMTEResItem =
160  6, /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
161  kHMSTRResItem = 7, /* 'STR ' ResID used in resource */
162  kHMSkipItem = 256, /* don't display a balloon */
163  kHMCompareItem = 512, /* Compare pstring in menu item w/ PString in resource
164  item ('hmnu' only) */
165  kHMNamedResourceItem = 1024, /* Use pstring in menu item to get 'STR#',
166  'PICT', or 'STR ' resource ('hmnu' only) */
167  kHMTrackCntlItem = 2048 /* Reserved */
168  };
169 
170  enum
171  {
172  /* Constants for hmmHelpType's when filling out HMMessageRecord */
173  khmmString = 1, /* help message contains a PString */
174  khmmPict = 2, /* help message contains a resource ID to a 'PICT' resource */
175  khmmStringRes =
176  3, /* help message contains a res ID & index to a 'STR#' resource */
177  khmmTEHandle = 4, /* help message contains a Text Edit handle */
178  khmmPictHandle = 5, /* help message contains a Picture handle */
179  khmmTERes =
180  6, /* help message contains a res ID to 'TEXT' & 'styl' resources */
181  khmmSTRRes = 7, /* help message contains a res ID to a 'STR ' resource */
182  kHMEnabledItem = 0 /* item is enabled, but not checked or control value = 0 */
183  };
184 
185  enum
186  {
187  /* ResTypes for Styled TE Handles in Resources */
188  kHMTETextResType =
189  FOUR_CHAR_CODE('TEXT'), /* Resource Type of text data for styled TE record
190  w/o style info */
191  kHMTEStyleResType = FOUR_CHAR_CODE(
192  'styl') /* Resource Type of style information for styled TE record */
193  };
194 
195  enum
196  {
197  kHMDisabledItem =
198  1, /* item is disabled, grayed in menus or disabled in dialogs */
199  kHMCheckedItem = 2, /* item is enabled, and checked or control value = 1 */
200  kHMOtherItem = 3, /* item is enabled, and control value > 1 */
201  /* Method parameters to pass to HMShowBalloon */
202  kHMRegularWindow = 0, /* Create a regular window floating above all windows */
203  kHMSaveBitsNoWindow = 1, /* Just save the bits and draw (for MDEF calls) */
204  kHMSaveBitsWindow =
205  2 /* Regular window, save bits behind, AND generate update event */
206  };
207 
208  enum
209  {
210  /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg'
211  messages */
212  kHMMenuResType = FOUR_CHAR_CODE(
213  'hmnu'), /* ResType of help resource for supporting menus */
214  kHMDialogResType = FOUR_CHAR_CODE(
215  'hdlg'), /* ResType of help resource for supporting dialogs */
216  kHMWindListResType = FOUR_CHAR_CODE(
217  'hwin'), /* ResType of help resource for supporting windows */
218  kHMRectListResType = FOUR_CHAR_CODE(
219  'hrct'), /* ResType of help resource for rectangles in windows */
220  kHMOverrideResType = FOUR_CHAR_CODE(
221  'hovr'), /* ResType of help resource for overriding system balloons */
222  kHMFinderApplResType = FOUR_CHAR_CODE(
223  'hfdr') /* ResType of help resource for custom balloon in Finder */
224  };
225 
227  {
228  short hmmResID;
229  short hmmIndex;
230  };
231  typedef struct HMStringResType HMStringResType;
233  {
234  SInt16 hmmHelpType;
235  union
236  {
237  Str255 hmmString;
238  SInt16 hmmPict;
239  TEHandle hmmTEHandle;
240  HMStringResType hmmStringRes;
241  SInt16 hmmPictRes;
242  PicHandle hmmPictHandle;
243  SInt16 hmmTERes;
244  SInt16 hmmSTRRes;
245  } u;
246  };
247  typedef struct HMMessageRecord HMMessageRecord;
249  typedef CALLBACK_API(OSErr, TipFunctionProcPtr)(Point tip, RgnHandle structure,
250  Rect *r,
251  BalloonVariant *balloonVariant);
252  typedef STACK_UPP_TYPE(TipFunctionProcPtr) TipFunctionUPP;
253 #if CALL_NOT_IN_CARBON
262  TipFunctionUPP
263  NewTipFunctionUPP(TipFunctionProcPtr userRoutine);
264 #if !OPAQUE_UPP_TYPES
265  enum
266  {
267  uppTipFunctionProcInfo = 0x00003FE0
268  }; /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
269 #ifdef __cplusplus
270  inline TipFunctionUPP NewTipFunctionUPP(TipFunctionProcPtr userRoutine)
271  {
272  return (TipFunctionUPP)NewRoutineDescriptor(
273  (ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture());
274  }
275 #else
276 #define NewTipFunctionUPP(userRoutine) \
277  (TipFunctionUPP) \
278  NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, \
279  GetCurrentArchitecture())
280 #endif
281 #endif
282 
291  void
292  DisposeTipFunctionUPP(TipFunctionUPP userUPP);
293 #if !OPAQUE_UPP_TYPES
294 #ifdef __cplusplus
295  inline void DisposeTipFunctionUPP(TipFunctionUPP userUPP)
296  {
297  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
298  }
299 #else
300 #define DisposeTipFunctionUPP(userUPP) DisposeRoutineDescriptor(userUPP)
301 #endif
302 #endif
303 
312  OSErr
314  BalloonVariant *balloonVariant, TipFunctionUPP userUPP);
315 #if !OPAQUE_UPP_TYPES
316 #ifdef __cplusplus
317  inline OSErr InvokeTipFunctionUPP(Point tip, RgnHandle structure, Rect *r,
318  BalloonVariant *balloonVariant,
319  TipFunctionUPP userUPP)
320  {
321  return (OSErr)CALL_FOUR_PARAMETER_UPP(userUPP, uppTipFunctionProcInfo, tip,
322  structure, r, balloonVariant);
323  }
324 #else
325 #define InvokeTipFunctionUPP(tip, structure, r, balloonVariant, userUPP) \
326  (OSErr) CALL_FOUR_PARAMETER_UPP((userUPP), uppTipFunctionProcInfo, (tip), \
327  (structure), (r), (balloonVariant))
328 #endif
329 #endif
330 
331 #endif /* CALL_NOT_IN_CARBON */
332 
333 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
334 /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
335 #define NewTipFunctionProc(userRoutine) NewTipFunctionUPP(userRoutine)
336 #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant) \
337  InvokeTipFunctionUPP(tip, structure, r, balloonVariant, userRoutine)
338 #endif /* CALL_NOT_IN_CARBON */
339 
340 /* Public Interfaces */
341 #if CALL_NOT_IN_CARBON
350  OSErr
352 
353 #define HMGetHelpMenuRef HMGetHelpMenuHandle
362  OSErr
363  HMShowBalloon(const HMMessageRecord *inHelpMessage, Point inTip,
364  Rect *inHotRect, /* can be NULL */
365  TipFunctionUPP inTipProc, SInt16 inWindowProcID,
366  BalloonVariant inBalloonVariant, SInt16 inMethod);
367 
376  OSErr
377  HMShowMenuBalloon(SInt16 itemNum, SInt16 itemMenuID, SInt32 itemFlags,
378  SInt32 itemReserved, Point tip,
379  Rect *alternateRect, /* can be NULL */
380  TipFunctionUPP tipProc, SInt16 theProc,
381  BalloonVariant balloonVariant);
382 
391  OSErr
393 
402  OSErr
403  HMGetIndHelpMsg(ResType inWhichResType, SInt16 inWhichResID,
404  SInt16 inMessageIndex, SInt16 inMessageState,
405  UInt32 *outOptions, Point *outTip, Rect *outHotRect,
406  SInt16 *outWindowProcID, BalloonVariant *outBalloonVariant,
407  HMMessageRecord *outHelpMessage, SInt16 *outMessageCount);
408 
417  Boolean
418  HMIsBalloon(void);
419 
447  Boolean
449 
458  OSErr
460 
469  OSErr
470  HMSetFont(SInt16 font);
471 
480  OSErr
481  HMSetFontSize(UInt16 fontSize);
482 
491  OSErr
492  HMGetFont(SInt16 *font);
493 
502  OSErr
503  HMGetFontSize(UInt16 *fontSize);
504 
513  OSErr
514  HMSetDialogResID(SInt16 resID);
515 
524  OSErr
525  HMSetMenuResID(SInt16 menuID, SInt16 resID);
526 
535  OSErr
536  HMBalloonRect(const HMMessageRecord *inMessage, Rect *outRect);
537 
546  OSErr
547  HMBalloonPict(const HMMessageRecord *inMessage, PicHandle *outPict);
548 
557  OSErr
558  HMScanTemplateItems(SInt16 whichID, SInt16 whichResFile, ResType whichType);
559 
568  OSErr
569  HMExtractHelpMsg(ResType inType, SInt16 inResID, SInt16 inMessageIndex,
570  SInt16 inMessageState, HMMessageRecord *outMessage);
571 
580  OSErr
581  HMGetDialogResID(SInt16 *resID);
582 
591  OSErr
592  HMGetMenuResID(SInt16 menuID, SInt16 *resID);
593 
602  OSErr
604 
605 #endif /* CALL_NOT_IN_CARBON */
606 
607 #if PRAGMA_STRUCT_ALIGN
608 #pragma options align = reset
609 #elif PRAGMA_STRUCT_PACKPUSH
610 #pragma pack(pop)
611 #elif PRAGMA_STRUCT_PACK
612 #pragma pack()
613 #endif
614 
615 #ifdef PRAGMA_IMPORT_OFF
616 #pragma import off
617 #elif PRAGMA_IMPORT
618 #pragma import reset
619 #endif
620 
621 #ifdef __cplusplus
622 }
623 #endif
624 
625 #endif /* __BALLOONS__ */
626 * /
OSErr HMShowBalloon(const HMMessageRecord *inHelpMessage, Point inTip, Rect *inHotRect, TipFunctionUPP inTipProc, SInt16 inWindowProcID, BalloonVariant inBalloonVariant, SInt16 inMethod)
OSErr HMRemoveBalloon(void)
OSErr HMSetFont(SInt16 font)
OSErr HMSetBalloons(Boolean flag)
OSErr HMSetMenuResID(SInt16 menuID, SInt16 resID)
OSErr HMGetMenuResID(SInt16 menuID, SInt16 *resID)
OSErr HMExtractHelpMsg(ResType inType, SInt16 inResID, SInt16 inMessageIndex, SInt16 inMessageState, HMMessageRecord *outMessage)
OSErr HMBalloonRect(const HMMessageRecord *inMessage, Rect *outRect)
OSErr InvokeTipFunctionUPP(Point tip, RgnHandle structure, Rect *r, BalloonVariant *balloonVariant, TipFunctionUPP userUPP)
void DisposeTipFunctionUPP(TipFunctionUPP userUPP)
TipFunctionUPP NewTipFunctionUPP(TipFunctionProcPtr userRoutine)
OSErr HMGetFontSize(UInt16 *fontSize)
OSErr HMGetBalloonWindow(WindowRef *window)
OSErr HMGetIndHelpMsg(ResType inWhichResType, SInt16 inWhichResID, SInt16 inMessageIndex, SInt16 inMessageState, UInt32 *outOptions, Point *outTip, Rect *outHotRect, SInt16 *outWindowProcID, BalloonVariant *outBalloonVariant, HMMessageRecord *outHelpMessage, SInt16 *outMessageCount)
OSErr HMGetFont(SInt16 *font)
SInt16 BalloonVariant
Definition: Balloons.h:70
OSErr HMSetFontSize(UInt16 fontSize)
Boolean HMIsBalloon(void)
OSErr HMGetHelpMenuHandle(MenuRef *mh)
OSErr HMBalloonPict(const HMMessageRecord *inMessage, PicHandle *outPict)
OSErr HMGetDialogResID(SInt16 *resID)
OSErr HMScanTemplateItems(SInt16 whichID, SInt16 whichResFile, ResType whichType)
OSErr HMSetDialogResID(SInt16 resID)
Boolean HMGetBalloons(void)
Is Balloon Help on or off?
OSErr HMShowMenuBalloon(SInt16 itemNum, SInt16 itemMenuID, SInt32 itemFlags, SInt32 itemReserved, Point tip, Rect *alternateRect, TipFunctionUPP tipProc, SInt16 theProc, BalloonVariant balloonVariant)
OSErr codes.
FrameRect & r
Lock a handle's data area (keep it from moving)
Definition: MacMemory.h:927
Basic Macintosh data types.
unsigned char Boolean
Definition: MacTypes.h:318
Menu Manager Interfaces.
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
#define STACK_UPP_TYPE(name)
Definition: MixedMode.h:734
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
Interface to Quickdraw Graphics.
TextEdit Interfaces.
Definition: Quickdraw.h:1648
Definition: Balloons.h:233
Definition: Balloons.h:227
Definition: Quickdraw.h:306
Definition: Menus.h:753
Definition: Quickdraw.h:326
Definition: MacTypes.h:520
Definition: MacTypes.h:527
Definition: TextEdit.h:272