home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-08-11 | 4.7 KB | 111 lines | [TEXT/KAHL] |
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- // //
- // //
- // Copyright PennyWise Software, 1994. //
- // //
- // Part of the PennyWise Software Application Framework //
- // //
- // //
- // DefaultHandlers.c Written by Peter Kaplan //
- // //
- // //
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- // //
- // This file contains the default handlers. The default handlers are the //
- // handlers that get called when no window is present. //
- // //
- // The only default that is not in this file is the menu default. //
- // It is in the file “HandleMenus.c” and is called “GlobalMenuDispatch” //
- // //
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- // Default handlers
- #include "DefaultHandlers.h"
- #include "HandleMenus.h"
- #include <PWFramework.h>
- #include <PWWindowList.h>
- #include "WindowID.h"
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- void InitDefaultHandlers()
- {
- // Even though most of these routines don't need to do anything
- // we still have to pass in a routine.
- PWInstallWindowType (kWINDOW_ID_NONE, kWINDOW_TYPE_APPLICATION);
- PWInstallCreate (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallDispose (kWINDOW_ID_NONE, defaultWindowClose);
- PWInstallZoomIn (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallZoomOut (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallResize (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallClick (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallUpdate (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallActivate (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallDeactivate (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallIdle (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallCursor (kWINDOW_ID_NONE, defaultWindowCursor);
- PWInstallKeyDown (kWINDOW_ID_NONE, defaultKeyDown);
- PWInstallDrag (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallPreMenu (kWINDOW_ID_NONE, defaultPreMenu);
- PWInstallMenu (kWINDOW_ID_NONE, GlobalMenuDispatch);
- PWInstallPostMenu (kWINDOW_ID_NONE, defaultPostMenu);
- PWInstallGrowRect (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallBackground (kWINDOW_ID_NONE, NULL);
- PWInstallScrap2Appl (kWINDOW_ID_NONE, defaultWindowNothing);
- PWInstallAppl2Scrap (kWINDOW_ID_NONE, defaultWindowNothing);
- }
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- void defaultWindowNothing(EventRecord* theEvent, WindowPtr theWindow)
- {
- // Do nothing. This will be used as filler for the unused functions
- }
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- short defaultWindowClose(EventRecord* theEvent, WindowPtr theWindow)
- {
- return TRUE; // We have nothing to close, so its closed
- }
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- void defaultWindowCursor(EventRecord* theEvent, WindowPtr theWindow)
- {
- // Make the gMouseMovedRgn the whole qd coord system
- // and then set cursor to arrow
- SetRectRgn(gMouseMovedRgn,-32768,-32768,32767,32767);
- SetCursor(&qd.arrow);
- }
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- void defaultPreMenu(EventRecord* theEvent, WindowPtr theWindow)
- {
- // We have no window, so we can Disable these
- DisableItem( gMenuFile, kFILE_CLOSE);
- DisableItem( gMenuFile, kFILE_SAVE);
- DisableItem( gMenuFile, kFILE_SAVEAS);
- DisableItem( gMenuFile, kFILE_PRINT);
- DisableItem( gMenuFile, kFILE_PONE);
-
- DisableItem( gMenuEdit, kEDIT_UNDO);
- DisableItem( gMenuEdit, kEDIT_CUT);
- DisableItem( gMenuEdit, kEDIT_COPY);
- DisableItem( gMenuEdit, kEDIT_PASTE);
- DisableItem( gMenuEdit, kEDIT_CLEAR);
- DisableItem( gMenuEdit, kEDIT_SEL_ALL);
- }
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- void defaultPostMenu(EventRecord* theEvent, WindowPtr theWindow)
- {
- // we must Enable what we Disabled
- EnableItem( gMenuFile, kFILE_CLOSE);
- EnableItem( gMenuFile, kFILE_PRINT);
- EnableItem( gMenuFile, kFILE_SAVE);
- EnableItem( gMenuFile, kFILE_SAVEAS);
- EnableItem( gMenuFile, kFILE_PONE);
-
- EnableItem( gMenuEdit, kEDIT_UNDO);
- EnableItem( gMenuEdit, kEDIT_CUT);
- EnableItem( gMenuEdit, kEDIT_COPY);
- EnableItem( gMenuEdit, kEDIT_PASTE);
- EnableItem( gMenuEdit, kEDIT_CLEAR);
- EnableItem( gMenuEdit, kEDIT_SEL_ALL);
- }
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- void defaultKeyDown(EventRecord* theEvent, WindowPtr theWindow)
- {
- SysBeep(1); // They pressed a key, Beep at 'em
- }
- //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••