summaryrefslogtreecommitdiff
path: root/sys/mac/MacHandleEv.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/mac/MacHandleEv.c')
-rw-r--r--sys/mac/MacHandleEv.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/sys/mac/MacHandleEv.c b/sys/mac/MacHandleEv.c
new file mode 100644
index 0000000..d6516c0
--- /dev/null
+++ b/sys/mac/MacHandleEv.c
@@ -0,0 +1,64 @@
+#include <MacTypes.h>
+#include <Quickdraw.h>
+#include <Windows.h>
+#include <Controls.h>
+#include <ToolUtils.h>
+#include "macint.h"
+
+extern WindowPtr gCommandWin, gGraphicsWin;
+extern Boolean gCommandWinResized;
+extern Rect dragRect, sizeRect;
+
+//=============================================================================
+// Hanlde Mouse Down Events
+//=============================================================================
+
+void DoMouseDown (EventRecord *theEvent) {
+ WindowPtr whichWindow;
+ short int thePart = FindWindow (theEvent->where, &whichWindow);
+
+ switch (thePart) {
+ case inSysWindow:
+ SystemClick (theEvent, whichWindow);
+ break;
+ case inDrag:
+ DragWindow (whichWindow, theEvent->where, &dragRect);
+ break;
+ case inMenuBar: {
+ long choice;
+ AdjustMenus ();
+ choice = MenuSelect (theEvent->where);
+ if (choice) DoMenu (choice);
+ break;
+ }
+ case inGoAway:
+ if ((whichWindow == gGraphicsWin)
+ && (TrackGoAway (whichWindow, theEvent->where)))
+ HideGrafWin ();
+ break;
+ case inContent:
+ if ((FrontWindow () == gCommandWin) && (whichWindow == gCommandWin))
+ DoContent (theEvent);
+ else SelectWindow (whichWindow);
+ break;
+ case inGrow:
+ case inZoomIn:
+ case inZoomOut: {
+ long newSize;
+ GrafPtr oldPort;
+ if (thePart == inGrow) newSize = GrowWindow (whichWindow, theEvent->where, &sizeRect);
+ if (((thePart == inGrow) && newSize)
+ || ((thePart != inGrow) && TrackBox (whichWindow, theEvent->where, thePart))) {
+ GetPort (&oldPort);
+ SetPort (whichWindow);
+ EraseRect (&whichWindow->portRect);
+ if (thePart == inGrow) SizeWindow (whichWindow, LoWord (newSize), HiWord (newSize), -1);
+ else ZoomWindow (whichWindow, thePart, 0);
+ gCommandWinResized = true;
+ InvalRect (&whichWindow->portRect);
+ SetPort (oldPort);
+ }
+ break;
+ }
+ }
+}