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
/
gemf.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-26
|
2KB
|
90 lines
/////////////////////////////////////////////////////////////////////////////
//
// This file is Copyright 1992 by Warwick W. Allison,
// and is freely distributable providing no charge is made.
//
/////////////////////////////////////////////////////////////////////////////
#include "aesbind.h"
#include "gemf.h"
#include "gemo.h"
const int INITCBOs=4;
const int INCCBOs=4;
GEMform::GEMform(int RSCindex) :
myindex(RSCindex),
MaxCBOs(INITCBOs),
CBO(new GEMobject* [MaxCBOs])
{
rsrc_gaddr(R_TREE,myindex,&Obj);
}
GEMform::~GEMform()
{
delete CBO;
}
int GEMform::Do()
{
int x,y,w,h;
form_center(Obj,&x,&y,&w,&h);
return Do(x,y);
}
int GEMform::Do(int x, int y)
{
int X,Y,w,h;
form_center(Obj,&X,&Y,&w,&h);
Obj[0].ob_x+=x-X;
Obj[0].ob_y+=y-Y;
form_dial(FMD_START,0,0,0,0,x,y,w,h);
if (ZoomOn) form_dial(FMD_GROW,0,0,0,0,x,y,w,h);
objc_draw(Obj, ROOT, MAX_DEPTH, x, y, w, h);
int exitor=form_do(Obj,0);
Obj[exitor].ob_state&=~SELECTED;
if (ZoomOn) form_dial(FMD_SHRINK,0,0,0,0,x,y,w,h);
form_dial(FMD_FINISH,0,0,0,0,x,y,w,h);
return exitor;
}
void GEMform::RedrawObject(int RSCindex)
{
objc_draw(Obj,RSCindex,MAX_DEPTH,0,0,600,300);
}
void GEMform::RedrawObject(int RSCindex,int Cx,int Cy,int Cw,int Ch) // Clipped
{
int X,Y;
objc_offset(Obj,RSCindex,&X,&Y);
objc_draw(Obj,RSCindex,MAX_DEPTH,Cx+X,Cy+Y,Cw,Ch);
}
void GEMform::CallBack(GEMobject* O)
{
if (CBOs==MaxCBOs) {
GEMobject* *NewCBO=new GEMobject* [MaxCBOs+INCCBOs];
for (int i=0; i<MaxCBOs; i++) NewCBO[i]=CBO[i];
delete CBO;
CBO=NewCBO;
MaxCBOs+=INCCBOs;
}
CBO[CBOs]=O;
CBOs++;
}
GEMobject* GEMform::Caller(int RSCindex)
{
for (int i=0; i<CBOs; i++) {
if (CBO[i]->myindex==RSCindex) return CBO[i];
}
return 0;
}