home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / macify13.shr / macify.hqx / Source / U / EventsMacify.c < prev    next >
Text File  |  1991-03-15  |  4KB  |  114 lines

  1. /*  EventsMacify                                                            Additional event handler routines
  2.  
  3. File name:  EventsMacify.c  
  4. Function:  This module contains the extra event handler routines
  5.      These routines allow us to override events in the main loop,
  6.      and to handle unique events.
  7. /* History: 3/15/91 Original by Prototyper 3.0   */
  8.  
  9. #include "PCommonMacify.h"    /* Common */
  10. #include "Common_Macify.h"    /* Common */
  11. #include "PUtils_Macify.h"    /* General Utilities */
  12. #include "Utils_Macify.h"    /* General Utilities */
  13.  
  14. #include "EventsMacify.h"    /* This file */
  15.  
  16.  
  17. /* ======================================================= */
  18.  
  19. /* Routine: HandleKey */
  20. /* Purpose: Allow us to filter key strokes and special key combinations. */
  21. /*     Return TRUE if we let the main loop handle the key stroke, return */
  22. /*         FALSE if we handle it and want the main loop to ignore it. */
  23.  
  24. Boolean HandleKey(myevent)
  25. EventRecord *myevent;
  26. {
  27. short    charCode;                                                           /* Key code */
  28. char    ch;                                                                     /* Key pressed in Ascii */
  29. Boolean    CmdKeyPressed;                                                 /* Command key pressed */
  30. Boolean    OptionKeyPressed;                                              /* Option key pressed */
  31. Boolean    ShiftKeyPressed;                                                /* Shift key pressed */
  32. Boolean    theHandleKey;                                                    /* value to return */
  33.  
  34. theHandleKey = TRUE;                                                      /* Let the main loop handle it */
  35.  
  36. charCode = myevent->message & charCodeMask;                     /* Get the character */
  37. ch = (char)charCode;                                                        /* Change it to ASCII */
  38.  
  39. CmdKeyPressed = ((myevent->modifiers & cmdKey) != 0);          /* See if Command key is down */
  40. OptionKeyPressed = ((myevent->modifiers & optionKey) != 0);/* See if Option key is down */
  41. ShiftKeyPressed = ((myevent->modifiers & shiftKey) != 0);/* See if Shift key is down */
  42.  
  43. return(theHandleKey);                                                      /* Return if we let main routine handle it */
  44. }
  45.  
  46. /* ======================================================= */
  47.  
  48. /* Routine: HandleDisk */
  49. /* Purpose: Allow us to handle disk inserted events specially. */
  50. /*     Return TRUE if we let the main loop handle the key stroke, return */
  51. /*         FALSE if we handle it and want the main loop to ignore it. */
  52.  
  53. Boolean HandleDisk(myevent)
  54. EventRecord *myevent;
  55. {
  56. Boolean    theHandleDisk;                                                   /* value to return */
  57.  
  58. theHandleDisk = TRUE;                                                      /* Let the main loop handle it */
  59.  
  60. return(theHandleDisk);                                                     /* Return if we let main routine handle it */
  61. }
  62.  
  63. /* ======================================================= */
  64.  
  65. /* Routine: ApplLoop_Macify */
  66. /* Purpose: At the top of the main loop, called each time thru the main */
  67. /*     loop.  This is very often if WNE was false.  If WNE was true then */
  68. /*     how often this routine is called depends on the setting of SleepValue */
  69. /*     in the ApplInit routine. */
  70.  
  71. void ApplLoop_Macify()
  72. {
  73.  
  74. }
  75.  
  76. /* ======================================================= */
  77.  
  78. /* Routine: ApplEvent_Macify */
  79. /* Purpose: Allow us to filter all events before the main loop handles them. */
  80. /*     Set  DoIt  to TRUE to let the main loop handle the event.  Set  DoIt to */
  81. /*         FALSE if we handle it and want the main loop to ignore it. */
  82.  
  83. void ApplEvent_Macify(DoIt, myEvent)
  84. Boolean    *DoIt;
  85. EventRecord *myEvent;
  86. {
  87.  
  88. *DoIt = TRUE;                                                                /* Let the main loop handle it */
  89.  
  90. if (myEvent->what == app4Evt)                                           /* Handle a Suspend or Resume event*/
  91.     {
  92.     *DoIt = FALSE;                                                           /* Tell the main loop to skip it*/
  93.     }
  94. else if (myEvent->what == 0)                                              /* Handle a NULL event*/
  95.     {
  96.     *DoIt = FALSE;                                                           /* Tell the main loop to skip it*/
  97.     }
  98.  
  99. }
  100.  
  101. /* ======================================================= */
  102.  
  103. /* Routine: Handle_UserEvent */
  104. /* Purpose: Handle our special user events */
  105.  
  106. void Handle_UserEvent(TheUserEvent)
  107. UserEventRec    *TheUserEvent;
  108. {
  109.  
  110. }
  111.  
  112. /* ======================================================= */
  113.  
  114.