home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-30 | 3.9 KB | 172 lines | [TEXT/KAHL] |
- /* ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
-
- CCTBDesktop.c
-
- CommToolbox compatible Desktop.
-
- SUPERCLASS = CDesktop / CFWDesktop.
-
- Copyright © 1992 Romain Vignes. All rights reserved.
-
- ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ */
-
- #include <CBartender.h> /* TCL includes */
- #include <Constants.h>
- #include <CWindow.h>
- #include <Global.h>
-
- #include "CCTBApp.h" /* Other includes */
- #include "CCTBDesktop.h"
- #include "CFileTransfer.h"
- #include "CTermPane.h"
-
-
- /* Application globals */
-
- extern CApplication *gApplication;
- extern CBartender *gBartender;
- extern CBureaucrat *gGopher;
-
-
- /*
- * ICTBDesktop
- *
- * Initialization of the Desktop object
- *
- * aSupervisor: desktop supervisor in the chain of command
- *
- */
-
- void CCTBDesktop::ICTBDesktop(CBureaucrat *aSupervisor)
- {
-
- #if USE_FLOATING_WINDOWS
- inherited::IFWDesktop(aSupervisor); /* Superclass initialisation */
- #else
- inherited::IDesktop(aSupervisor); /* Superclass initialisation */
- #endif
-
- }
-
-
- /* ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ */
-
- /*
- * DispatchClick
- *
- * Mouse clicks dispatching
- *
- * macEvent: Pointer on the mouse event record
- *
- */
-
- void CCTBDesktop::DispatchClick(EventRecord *macEvent)
- {
- short thePart,theMenu,theItem;
- WindowPeek macWindow;
- register CWindow *theWindow;
- register long menuChoice;
- Boolean toolMenu;
-
- thePart = FindWindow(macEvent->where, (WindowPtr*)&macWindow);
- /* Click position */
-
- if (macWindow != NULL)
- {
- if (macWindow->windowKind != OBJ_WINDOW_KIND)
- return;
- theWindow = (CWindow*) GetWRefCon((WindowPtr) macWindow);
- /* WIndow object linked to the window record */
- }
- else theWindow = NULL;
-
- if (topWindow && (theWindow != topWindow) && topWindow->IsModal())
- /* Active modal window ? */
- {
- if (thePart != inMenuBar) /* Inactive window click */
- {
- SysBeep( 3);
- return;
- }
- }
-
- switch (thePart) {
-
- case inDesk: /* Desk click */
- CountClicks(this, macEvent);
- DoClick(macEvent->where, macEvent->modifiers, macEvent->when);
- break;
-
- case inMenuBar: /* Menu bar click */
- gBartender->UpdateAllMenus();
- menuChoice = MenuSelect(macEvent->where); /* Element selected */
-
- theMenu = HiShort(menuChoice);
- theItem = LoShort(menuChoice);
-
- toolMenu = CFileTransfer::cTestToolMenu(theMenu,theItem);
-
- if (!toolMenu)
- toolMenu = CTermPane::cTestToolMenu(theMenu, theItem);
-
- if (theMenu && !toolMenu) {
- gGopher->DoCommand(gBartender->FindCmdNumber(theMenu, theItem));
- /* Send the command to the gopher */
- }
-
- HiliteMenu(0);
- break;
-
- case inSysWindow: /* DA window ? */
- SystemClick(macEvent, (WindowPtr) macWindow);
- break;
-
- case inContent: /* Window content ? */
- if (!theWindow->active || ( (theWindow->floating &&
- ((WindowPtr)macWindow != FrontWindow())))) {
-
- theWindow->Select(); /* Window activation */
-
- if (!theWindow->actClick) {
- break; /* Activation click */
- }
-
- else
- theWindow->Activate(); /* Auto activation */
- }
-
- if (theWindow->wantsClicks) {
- UpdateWindows();
-
- theWindow->DispatchClick(macEvent);
-
-
- } else {
- CountClicks(this, macEvent); /* Desk click */
- DoClick(macEvent->where, macEvent->modifiers, macEvent->when);
- }
- break;
-
- case inDrag:
- theWindow->Drag(macEvent);
- break;
-
- case inGrow:
- theWindow->Resize(macEvent);
- break;
-
- case inGoAway:
- if (TrackGoAway((WindowPtr) macWindow, macEvent->where))
- theWindow->Close();
- break;
-
- case inZoomIn:
- case inZoomOut:
- if (TrackBox( (WindowPtr)macWindow, macEvent->where, thePart))
- theWindow->Zoom(thePart);
- break;
- }
- }
-
-
- /* ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞ */