home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel Volume 2 #1
/
carousel.iso
/
mactosh
/
lang
/
skel_azt.sha
/
select.c
< prev
next >
Wrap
C/C++ Source or Header
|
1986-07-08
|
2KB
|
67 lines
/*
* select.c -- handle an activate or deactivate event for any window
*/
#include <quickdraw.h>
#include <control.h>
#include <event.h>
#include <menu.h>
#include <textedit.h>
#include <window.h>
#include "qdv.h"
#include "def.h"
void
select(ev)
EventRecord *ev; /* return value from GetNextEvent */
{
extern QDVar *QD;
extern ControlHandle hscroll[NWINDOWS];
extern TEHandle hTE;
int i;
extern MenuHandle mh[NMENUS + 1];
extern GrafPtr screenport; /* the whole screen */
extern int swi; /* scroll window index */
extern ControlHandle vscroll[NWINDOWS];
extern WindowPtr wp[NWINDOWS];
for (i = 0; i < NWINDOWS; i++) {
if ((WindowPtr)ev->message == wp[i]) {
if (ev->modifiers & 1) {
/* odd means an activate event */
SetPort(wp[i]);
/* must allow for changing to scroll bars, HiLited
* or not, and (IMPORTANT) must be after SetPort to
* have the correct QuickDraw Origin.
* And -- include the grow icon, too!
*/
(*vscroll[i])->contrlRect.bottom += 16;
InvalRect(&(*vscroll[i])->contrlRect);
(*vscroll[i])->contrlRect.bottom -= 16;
InvalRect(&(*hscroll[i])->contrlRect);
swi = i;
if (i == 1 && hTE) {
EnableItem(mh[3], 0);
TEActivate(hTE);
};
}
else {
/* must allow for whitening out the scroll bars and
* (IMPORTANT) must be before SetPort to have the
* correct QuickDraw Origin.
*/
(*vscroll[i])->contrlRect.bottom += 16;
InvalRect(&(*vscroll[i])->contrlRect);
(*vscroll[i])->contrlRect.bottom -= 16;
InvalRect(&(*hscroll[i])->contrlRect);
SetPort(screenport);
if (i == 1 && hTE)
TEDeactivate(hTE);
};
break;
};
};
} /* end of select */