home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Frameworks / PennyWise™ Framework / PennyView / Source / HandleMenus.c < prev    next >
Encoding:
Text File  |  1994-08-10  |  4.5 KB  |  140 lines  |  [TEXT/KAHL]

  1. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  2. //                                                                                //
  3. //                                                                                //
  4. //                    Copyright PennyWise Software, 1994.                            //
  5. //                                                                                //
  6. //            Part of the PennyWise Software Application Framework                //
  7. //                                                                                //
  8. //                                                                                //
  9. //            HandleMenus.c            Written by Peter Kaplan                        //
  10. //                                                                                //
  11. //                                                                                //
  12. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  13. //                                                                                //
  14. //                            HandleMenus.c                                        //
  15. //                                                                                //
  16. //    This file contains the menu processing core. All menu processing is handled    //
  17. //    from either this file, or the front most windows file.                        //
  18. //                                                                                //
  19. //    This file contains three routines:                                            //
  20. //                                                                                //
  21. //        GlobalMenuDispatch(EventRecord*, WindowPtr, short, short, short)        //
  22. //                                                                                //
  23. //            It gets installed in the default handlers as the MenuDispatch.        //
  24. //            This will get called when users make a menu selection (or keyboard     //
  25. //            combination). It will be called only when there is NO open             //
  26. //            application window or dialog OR the frontmost window passes it on    //
  27. //            without processing it. Once this routine is called the event is     //
  28. //            assumed handled.                                                    //
  29. //                                                                                //
  30. //                                                                                //
  31. //        GlobalPreMenu(void)                                                        //
  32. //                                                                                //
  33. //            It works the same way as a windows PreMenu, you can make any         //
  34. //            changes to the menus you would like, but this routine is not        //
  35. //            limited to one window type. It is called for all menu clicks.        //
  36. //            The reason I implemented this was for building a "Windows" Menu        //
  37. //            where the same routine has to get called no matter what the         //
  38. //            window type.                                                        //
  39. //            It gets called before the front most windows PreMenu call.            //
  40. //                                                                                //
  41. //        GlobalPostMenu(void)                                                    //
  42. //                                                                                //
  43. //            It works the same way as a windows PostMenu, you should reverse        //
  44. //            changes to the menus you made in GlobalPreMenu. It is called for    //
  45. //            all menu clicks.                                                    //
  46. //                                                                                //
  47. //        NOTE:     THESE ROUTINES ARE CALLED FROM THE FRAMEWORK LIBRARY SO YOU        //
  48. //                CAN NOT REMOVE THEM OR CHANGE THE NAMES. IF YOU DON'T WANT        //
  49. //                TO USE THEM, JUST LEAVE THEM EMPTY.                                //
  50. //                                                                                //
  51. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  52. #include "HandleMenus.h"
  53. #include "PWAboutBox.h"
  54. #include <PWFramework.h>
  55. #include <PWWindowList.h>
  56. #include <SegLoad.h>
  57. #include <TextServices.h>
  58. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  59. // Added for PennyView
  60. #include "OpenFiles.h"
  61. #include <PWPrintUtils.h>
  62. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  63. // Global Variables
  64. // All of the menus will have a definition here 
  65. // and an external reference in the HeaderFile
  66. MenuHandle    gMenuApple;
  67. MenuHandle    gMenuFile;
  68. MenuHandle    gMenuEdit;
  69.  
  70. // Add your menus here
  71.  
  72. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  73. short GlobalMenuDispatch(    EventRecord* theEvent, 
  74.                             WindowPtr theWindow, 
  75.                             short theMenu, 
  76.                             short theItem, 
  77.                             short theWindowType)
  78. {
  79.     switch (theMenu) {
  80.         case kMENU_ID_APPLE:
  81.             switch (theItem) {
  82.                 short    DNA;                     
  83.                 Str63    DAName;
  84.                 GrafPtr    oldPort;
  85.     
  86.                 case kAPPLE_ABOUT:
  87.                     DoAboutDialog();
  88.                     UnloadSeg(DoAboutDialog);
  89.                     break;
  90.                 default:                                                              
  91.                     GetPort(&oldPort);                                          
  92.                     GetItem(gMenuApple, theItem, DAName);
  93.                     DNA = OpenDeskAcc(DAName); 
  94.                     SetPort(oldPort); 
  95.                     break;
  96.                 }
  97.             break;
  98.         case kMENU_ID_FILE:
  99.             switch (theItem) {
  100.                 case kFILE_NEW:
  101.                     break;
  102.                 case kFILE_OPEN:
  103.                     AllWindowsGetFileOpen();    //•••••••••••Added For PennyView
  104.                     break;
  105.                 case kFILE_CLOSE:
  106.                     PWCallClose(theEvent, theWindow);
  107.                     break;
  108.                 case kFILE_PSETUP:
  109.                     DoPageSetup();
  110.                     break;
  111.                 case kFILE_PRINT:
  112.                     break;
  113.                 case kFILE_PONE:
  114.                     break;
  115.                 case kFILE_QUIT:
  116.                     PWQuitApplication();
  117.                     break;
  118.                 }
  119.             break;
  120.         case kMENU_ID_EDIT:
  121.             switch (theItem) {
  122.                 default:
  123.                     break;
  124.                 }
  125.             break;
  126.         }
  127. return TRUE;
  128. }
  129. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  130. void GlobalPreMenu(void)
  131. {
  132.  
  133. }
  134. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  135. void GlobalPostMenu(void)
  136. {
  137.  
  138. }
  139. //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  140.