home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-05-12 | 3.4 KB | 227 lines | [TEXT/MMCC] |
- // Window handling code....
-
-
- #include "NovelNetwar.h"
-
-
- void windowsInit(void)
- {
-
- }
-
-
- void windowsStartup(void)
- {
-
- }
-
-
- void windowsShutDown(void)
- {
-
- }
-
-
-
-
-
- void DoMouseDown(EventRecord *theEvent)
- {
- WindowPtr whichWindow;
- int windowCode;
-
- switch (windowCode = FindWindow(theEvent->where,&whichWindow))
- {
- case inMenuBar:
- DoCommand(MenuSelect(theEvent->where));
- break;
-
- case inSysWindow:
- SystemClick(theEvent,whichWindow);
- break;
-
- case inContent:
- if (whichWindow != FrontWindow())
- SelectWindow(whichWindow);
-
- else if (IsOurWindow(whichWindow) == noErr)
- DoContent(whichWindow,theEvent);
-
- break;
-
- case inDrag:
- if (whichWindow != FrontWindow())
- SelectWindow(whichWindow);
-
- else if (IsOurWindow(whichWindow) == noErr)
- DoDrag(whichWindow,theEvent);
-
- break;
-
- case inGrow:
- if (whichWindow != FrontWindow())
- SelectWindow(whichWindow);
-
- else if (IsOurWindow(whichWindow) == noErr)
- DoGrow(whichWindow,theEvent);
-
- break;
-
- case inZoomIn:
- case inZoomOut:
- if (whichWindow != FrontWindow())
- SelectWindow(whichWindow);
-
- else if (IsOurWindow(whichWindow) == noErr && TrackBox(whichWindow,theEvent->where,windowCode))
- DoZoom(whichWindow,windowCode);
-
- break;
-
- case inGoAway:
- if (whichWindow != FrontWindow())
- SelectWindow(whichWindow);
-
- else if (IsOurWindow(whichWindow) == noErr && TrackGoAway(whichWindow,theEvent->where))
- DoCloseWindow(whichWindow);
-
- break;
- }
- }
-
-
-
-
-
- void DoActivateDeactivate(WindowPtr whichWindow,char adFlag)
- {
- if (whichWindow && IsOurWindow(whichWindow) == noErr)
- {
- if (helpIsWindow(whichWindow) == noErr)
- {
- helpActivateWindow(whichWindow,adFlag);
- }
-
- else if (gameplayIsWindow(whichWindow) == noErr)
- {
- gameplayActivateWindow(whichWindow,adFlag);
- }
-
- }
- }
-
-
-
- void DoZoom(WindowPtr whichWindow,int windowCode)
- {
- if (whichWindow && IsOurWindow(whichWindow) == noErr)
- {
-
- }
- }
-
-
-
- void DoGrow(WindowPtr whichWindow,EventRecord *theEvent)
- {
- if (whichWindow && IsOurWindow(whichWindow) == noErr)
- {
- if (helpIsWindow(whichWindow) == noErr)
- {
- helpGrowWindow(whichWindow,theEvent);
- }
- }
- }
-
-
-
- void DoCloseWindow(WindowPtr whichWindow)
- {
- if (whichWindow)
- {
- if (helpIsWindow(whichWindow) == noErr)
- {
- helpCloseWindow(whichWindow);
- }
- }
- }
-
-
-
- void DoDrag(WindowPtr whichWindow,EventRecord *theEvent)
- {
- Rect tempRect;
-
- if (whichWindow && IsOurWindow(whichWindow) == noErr)
- {
- if (helpIsWindow(whichWindow) == noErr)
- {
- helpDragWindow(whichWindow,theEvent);
- }
-
- else if (gameplayIsWindow(whichWindow) == noErr)
- {
- gameplayDragWindow(whichWindow,theEvent);
- }
- }
- }
-
-
-
-
-
-
- void DoContent(WindowPtr whichWindow,EventRecord *theEvent)
- {
- if (whichWindow && IsOurWindow(whichWindow) == noErr)
- {
- if (helpIsWindow(whichWindow) == noErr)
- {
- helpDoContent(whichWindow,theEvent);
- }
-
- else if (gameplayIsWindow(whichWindow) == noErr)
- {
- gameplayDoContent(whichWindow,theEvent);
- }
- }
- }
-
-
-
-
- void UpdateWindow(WindowPtr whichWindow)
- {
- if (whichWindow && IsOurWindow(whichWindow) == noErr)
- {
- if (helpIsWindow(whichWindow) == noErr)
- {
- helpUpdateWindow(whichWindow);
- }
-
- else if (gameplayIsWindow(whichWindow) == noErr)
- {
- gameplayUpdateWindow(whichWindow);
- }
- }
- }
-
-
-
-
-
-
- OSErr IsOurWindow(WindowPtr theWPtr)
- {
- if (!theWPtr)
- return(BADWINDOW);
-
- else if (helpIsWindow(theWPtr) == noErr)
- return(noErr);
-
- else if (gameplayIsWindow(theWPtr) == noErr)
- return(noErr);
-
- else
- return(BADWINDOW);
- }
-