home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Club Elmshorn Atari PD
/
CCE_PD.iso
/
pc
/
0400
/
CCE_0423.ZIP
/
CCE_0423.PD
/
GEM.ZOO
/
gema.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-26
|
2KB
|
100 lines
/////////////////////////////////////////////////////////////////////////////
//
// This file is Copyright 1992 by Warwick W. Allison,
// and is freely distributable providing no charge is made.
//
/////////////////////////////////////////////////////////////////////////////
#include "aesbind.h"
#include "gema.h"
GEMactivity::GEMactivity(GEMmenu& m, GEMdesktop& d) :
Menu(&m), Desk(&d)
{
AddWindow(*Desk);
}
GEMactivity::GEMactivity(GEMmenu& m) :
Menu(&m), Desk(0)
{ }
GEMactivity::~GEMactivity()
{ }
void GEMactivity::AddWindow(GEMwindow& w)
{
W=new struct WL(&w,W);
}
void GEMactivity::Do()
{
int Pipe[32];
int mx,my,button,meta,key,count;
ClickResult r=ContinueInteraction;
int applid=appl_init();
Menu->Show();
graf_mouse(ARROW,0);
while (r==ContinueInteraction) {
int got=evnt_multi(MU_KEYBD|MU_BUTTON|MU_MESAG,
1,1,1,0,0,0,0,0,0,0,0,0,0,
Pipe,0,&mx,&my,&button,&meta,&key,&count
);
if (got&MU_KEYBD) {
// call key processor
}
if (got&MU_BUTTON) {
GEMwindow *win=0;
for (WL* c=W; c && !win; c=c->Next) {
int X,Y,W,H;
wind_get(c->Window->handle(),WF_WORKXYWH,&X,&Y,&W,&H);
if (mx>=X && mx<X+W && my>=Y && my<Y+H)
win=c->Window;
}
if (win) win->click(mx,my);
}
if (got&MU_MESAG) {
if (Pipe[0]==MN_SELECTED) {
r=Menu->Do(Pipe[4]);
menu_tnormal(Menu->Obj,Pipe[3],1);
} else {
GEMwindow* To=Window(Pipe[3]);
if (To) {
switch (Pipe[0]) {
case WM_REDRAW:
GRECT R;
R.g_x=Pipe[4];
R.g_y=Pipe[5];
R.g_w=Pipe[6];
R.g_h=Pipe[7];
To->RedrawOverlaps(R);
break; case WM_CLOSED:
To->close();
break; case WM_MOVED:
To->move(Pipe[4],Pipe[5]);
break; case WM_TOPPED:
To->top(mx,my);
}
}
}
}
}
Menu->Hide();
appl_exit();
}
GEMwindow* GEMactivity::Window(int ID)
{
for (WL* c=W; c && c->Window->handle()!=ID; c=c->Next);
return c ? c->Window : 0;
}