home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / PlainTalk™ Speech Technologies / Text to Speech / Programming Stuff / Examples / SpeakFile / BigEasy.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-15  |  6.8 KB  |  175 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        BigEasy.h
  3.  
  4.     Contains:    Prototypes for BigEasy
  5.  
  6.     Written by:    The Utility Muffin Research Kitchen
  7.  
  8.     Copyright:    © 1991-1992 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.         <10>     4/11/92    JDR        Removed anything necessary for the SADISM project, and added
  13.                                     other things from the file Utilities.h which was removed from
  14.                                     the project.
  15.          <9>     3/26/92    JDR        Added the AssertErr macro.
  16.          <8>     3/24/92    JDR        Corrected the names of the exception macros.
  17.          <7>     2/16/92    JDR        Conditional for the Think C MacHeaders or MPW's MacHeaders.
  18.                                     Created the exception macros.
  19.          <6>     1/16/92    JDR        Using MacHeaders instead of all those includes to make builds go
  20.                                     faster. Adding the debugging macros.
  21.          <5>    12/19/91    JDR        Don't need to add the define for DEBUG here, but using the
  22.                                     prefix page of ThinkC instead.
  23.          <4>     12/4/91    JDR        Need to add the define for DEBUG
  24.          <3>    11/15/91    JDR        Changed the event loop to call idle procs. Made a global sleep
  25.                                     parameter to adjust the idle time.
  26.          <2>    10/16/91    JDR        Added a WIND version of InstallWindow, and change the parameters
  27.                                     to the event handlers.
  28.          <1>     9/17/91    KIP        first checked in
  29.     To Do:
  30. */
  31.  
  32. #pragma once
  33.  
  34. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35. // contants
  36. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  37.  
  38. // this is the standard sleep value for typical event loop
  39. #define kStandardSleep        1
  40.  
  41. // this is the faster sleep value for tight and fast event looping
  42. #define kFastEventPolling    0
  43.  
  44. #define kButtonFrameSize        3            /* button frame’s pen size */
  45. #define kButtonFrameInset        (-4)        /* inset rectangle adjustment around button */
  46.  
  47. #define kControlInvisible        0
  48. #define kControlVisible            0xFF
  49. #define kCntlActivate            0            /* enabled control’s hilite state */
  50. #define kCntlDeactivate            0xFF        /* disabled control’s hilite state */
  51. #define kCntlOn                    1            /* control’s value when truned on */
  52. #define kCntlOff                0            /* control’s value when truned off */
  53. #define kSelect                    1            /* select the control */
  54. #define kDeselect                0            /* deselect the control */
  55.  
  56. #define kDelayTime                8            /* For the delay time when flashing the
  57.                                                menubar and highlighting a button.
  58.                                                8/60ths of a second*/
  59.  
  60. #define kSelectionDelay            30            /* number of ticks the icon is being selected
  61.                                                before we condiser it being a mode switch */
  62.  
  63. #define charBackspace            '\b'        /* ASCII code for Backspace character */
  64. #define charClear                '\033'        /* ASCII code for Clear key (aka ESC) */
  65. #define charDown                '\037'        /* ASCII code for down arrow */
  66. #define charEnd                    '\004'        /* ASCII code for the End key */
  67. #define charEnter                '\003'        /* ASCII code for Enter character */
  68. #define charEscape                '\033'        /* ASCII code for Escape (aka Clear) key */
  69. #define charFunction            '\020'        /* ASCII code for any function key */
  70. #define charFwdDelete            '\177'        /* ASCII code for forward delete */
  71. #define charHelp                '\005'        /* ASCII code for Help key */
  72. #define charHome                '\001'        /* ASCII code for the Home key */
  73. #define charLeft                '\034'        /* ASCII code for left arrow */
  74. #define charPageDown            '\f'        /* ASCII code for Page Down key */
  75. #define charPageUp                '\013'        /* ASCII code for Page Up key */
  76. #define charReturn                '\r'        /* ASCII code for Return character */
  77. #define charRight                '\035'        /* ASCII code for right arrow */
  78. #define charSpace                ' '            /* ASCII code for Space character */
  79. #define charTab                    '\t'        /* ASCII code for Tab character */
  80. #define charUp                    '\036'        /* ASCII code for up arrow */
  81.  
  82.  
  83. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  84. // types
  85. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  86.  
  87.  
  88. struct    WindowTemplate    {                /*template to a WIND resource*/
  89.     Rect        boundsRect;
  90.     short        procID;
  91.     Boolean        visible;
  92.     Boolean        filler1;
  93.     Boolean        goAwayFlag;
  94.     Boolean        filler2;
  95.     long        refCon;
  96.     Str255        title;
  97. };
  98. typedef    struct WindowTemplate WindowTemplate;
  99. typedef WindowTemplate *WindowTPtr, **WindowTHndl;
  100.  
  101.  
  102. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103. // applications globals
  104. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  105.  
  106. extern Boolean     gQuitApp;
  107. extern long        gSleepTime;
  108. extern long        gLastMenuSelect;
  109.  
  110.  
  111. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  112. // Macros
  113. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  114.  
  115. // this is much better than the toolbox calls
  116. #define HiWrd(aLong)    (((aLong) >> 16) & 0xFFFF)
  117. #define LoWrd(aLong)    ((aLong) & 0xFFFF)
  118.  
  119.  
  120.  
  121. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  122. // Method Defintions
  123. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  124.  
  125.  
  126. typedef void (*IFP)(void);        /* Integer Function Pointer */
  127.  
  128. typedef void (*UpdateProc)(Ptr globals);
  129. typedef void (*ClickProc)(Ptr globals, Point p, short mods, long when);
  130. typedef void (*GrowProc)(Ptr globals, Point p, short mods);
  131. typedef void (*KeyProc)(Ptr globals, long k, short mods);
  132. typedef void (*CloseProc)(Ptr globals);
  133. typedef void (*DeathProc)(Ptr globals);
  134. typedef void (*ActivateProc)(Ptr globals);
  135. typedef void (*DeactivateProc)(Ptr globals);
  136. typedef void (*LoopyProc)(Ptr globals);
  137.  
  138. /* Default Methods */
  139.  
  140. void        DefaultUpdate(Ptr globals);
  141. void        DefaultClick(Ptr globals, Point p, short mods, long when);
  142. void        DefaultGrow(Ptr globals, Point p, short mods);
  143. void        DefaultKey(Ptr globals, long k, short mods);
  144. void        DefaultClose(Ptr globals);
  145. void         DefaultDeath(Ptr globals);
  146. void        DefaultActivate(Ptr globals);
  147. void        DefaultDeactivate(Ptr globals);
  148. void        DefaultLoopy(Ptr globals);
  149. void        pnull(void);
  150.  
  151. Ptr            InstallWindow(Rect *iRect, short iType, Boolean iGoway, unsigned char *iTitle,
  152.                 UpdateProc iUpdate, ClickProc iClick, GrowProc iGrow, KeyProc iKey, CloseProc iClose, DeathProc iDeath, 
  153.                 ActivateProc iActivate, DeactivateProc iDeactive, LoopyProc iLoopy, long iGlobalsSize,
  154.                 WindowPtr *thisWindowPtr);
  155. Ptr            GetInstallWindow(short windID, UpdateProc iUpdate, ClickProc iClick, GrowProc iGrow,
  156.                 KeyProc iKey, CloseProc iClose, DeathProc iDeath, ActivateProc iActivate, DeactivateProc iDeactive,
  157.                 LoopyProc iLoopy, long iGlobalsSize, WindowPtr *thisWindowPtr);
  158. Ptr            InstallDialog(short iResID, ClickProc iClick, CloseProc iClose, long iGlobalsSize,
  159.                 DialogPtr *thisWindowPtr);
  160. void        UninstallWindow(WindowPtr uWindow);
  161. void        UninstallDialog(DialogPtr uDialog);
  162. void        DoCloseWindow(void);
  163. void        DoQuit(void);
  164.  
  165. void        InstallMenu(Str255 s);
  166. void        InstallItem(Str255 s, IFP action);
  167. void        InstallEditMenu(IFP Xundo, IFP Xcut, IFP Xcopy, IFP Xpaste, IFP Xclear);
  168.  
  169.  
  170. void        Bootstrap(void);
  171. void         CopyStr(Str255 source, Str255 dest);
  172. void         AppendStr(Str255 source, Str255 dest);
  173. void         TrapError(Str255 s, OSErr err, Boolean breakIt, Boolean fatal);
  174. Ptr         GetWindowStorage(WindowPtr w);
  175.