home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Fab Libraries / CursorBalloon.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-12  |  2.9 KB  |  99 lines  |  [TEXT/MPS ]

  1. #ifndef __FABCURSORBALLOON__
  2. #define __FABCURSORBALLOON__
  3.  
  4. /* this distinguishes a normal window from a window with objects */
  5.  
  6. enum windowclasses {
  7. kFabWindowClass = 10
  8. };
  9.  
  10. /* this is a generic object belonging to a window */
  11.  
  12. struct RgnBalloonCurs {
  13.     void (*recalcRgnProc)(FabWindowPtr, RgnBalloonCursPtr);
  14.     RgnHandle    zoneLocal;
  15.     RgnHandle    zoneGlobal;
  16.     CursHandle    curs;
  17.     unsigned long    myBalloon;
  18.     short        balloonVariant;
  19.     short        reserved; /* alignment */
  20.     };
  21.  
  22. typedef struct RgnBalloonCurs RgnBalloonCurs;
  23. typedef RgnBalloonCurs *RgnBalloonCursPtr;
  24. typedef RgnBalloonCursPtr *RgnBalloonCursHandle;
  25.  
  26. /* this is my window record, containing the standard Window Manager record,
  27. the procedures normally called when handling events (if you do not want to
  28. undertake special actions i.e. for dragging, pass nil), the number of
  29. objects, and a Handle to the objects */
  30.  
  31. struct FabWindowRecord {
  32.     WindowRecord    w;
  33.     ProcPtr        activateProc,
  34.                 updateProc,
  35.                 dragProc,
  36.                 growProc,
  37.                 zoomProc,
  38.                 goAwayProc,
  39.                 contentProc;
  40.     unsigned long    objCount;
  41.     RgnBalloonCursHandle    myZones;
  42.     };
  43.  
  44. typedef struct FabWindowRecord FabWindowRecord;
  45. typedef FabWindowRecord *FabWindowPtr;
  46.  
  47.  
  48. OSErr InstallRgnHandler(FabWindowPtr w, RgnHandle whichRgn, void (*recalcProc)(FabWindowPtr, RgnBalloonCursPtr),
  49.                         CursHandle cursor,
  50.                         unsigned long balloon, short ballnVariant);
  51. void RecalcMouseRegion(WindowPtr w, Point mouse);
  52. void ResizeObjects(FabWindowPtr w);
  53. void RecalcGlobalCoords(FabWindowPtr w);
  54. void DisposFabWindow(FabWindowPtr w);
  55. void ForceMouseMovedEvent(void);
  56.  
  57. /* useful macros */
  58.  
  59. #define toBalloon(m, i)        (((long)m << 16) + i)
  60.  
  61. #define Zones(w)            (((FabWindowPtr)w)->myZones)
  62.  
  63. #define InitFabWindow(w)    { Zones(w) = (RgnBalloonCursHandle)NewHandle(0); \
  64.                                 ((WindowPeek)w)->windowKind = kFabWindowClass; }
  65.  
  66. /* macros for setting the event handlers for the window, and
  67. prototypes of the handlers */
  68.  
  69. // void DoActivateWindow(WindowPtr w, Boolean becomingActive);
  70. #define SetActivate(w, p)    ((FabWindowPtr)w)->activateProc = (ProcPtr)(p)
  71.  
  72. // void DoUpdateWindow(WindowPtr w);
  73. #define SetUpdate(w, p)        ((FabWindowPtr)w)->updateProc = (ProcPtr)(p)
  74.  
  75. // void DoDragWindow(WindowPtr w);
  76. #define SetDrag(w, p)        ((FabWindowPtr)w)->dragProc = (ProcPtr)(p)
  77.  
  78. // void DoGrowWindow(WindowPtr w, EventRecord    *event);
  79. #define SetGrow(w, p)        ((FabWindowPtr)w)->growProc = (ProcPtr)(p)
  80.  
  81. // void DoZoomWindow(WindowPtr w);
  82. #define SetZoom(w, p)        ((FabWindowPtr)w)->zoomProc = (ProcPtr)(p)
  83.  
  84. // void DoCloseWindow(WindowPtr w);
  85. #define SetGoAway(w, p)        ((FabWindowPtr)w)->goAwayProc = (ProcPtr)(p)
  86.  
  87. // void DoContentClick(WindowPtr w, EventRecord *event);
  88. #define SetContent(w, p)    ((FabWindowPtr)w)->contentProc = (ProcPtr)(p)
  89.  
  90. #define NumObjects(w)        (((FabWindowPtr)w)->objCount)
  91. #define OneMoreObject(w)    (((FabWindowPtr)w)->objCount++)
  92.  
  93. #define IsFabWindow(w)        (((WindowPeek)w)->windowKind == kFabWindowClass)
  94.  
  95. extern RgnHandle    mouseRgn, wideOpenRgn;
  96.  
  97. #endif
  98.  
  99.