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
/
gemw.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-26
|
2KB
|
121 lines
/////////////////////////////////////////////////////////////////////////////
//
// This file is Copyright 1992 by Warwick W. Allison,
// and is freely distributable providing no charge is made.
//
/////////////////////////////////////////////////////////////////////////////
#include "aesbind.h"
#include "gemw.h"
#include <bool.h>
#define LOHI(x) (int)(x) & 0xffff, (int)(x) >> 16
#define HILO(x) (int)(x) >> 16, (int)(x) & 0xffff
static char *DefaultTitle=" <untitled> ";
void GEMwindow::RedrawOverlaps(GRECT& area)
{
GRECT box;
GRECT dirty_source, dirty_dest;
GRECT work_area;
wind_get(Handle, WF_WORKXYWH,
&work_area.g_x, &work_area.g_y,
&work_area.g_w, &work_area.g_h);
graf_mouse(M_OFF,0);
wind_get(Handle, WF_FIRSTXYWH, &box.g_x, &box.g_y, &box.g_w, &box.g_h);
while ( box.g_w && box.g_h )
{
if (rc_intersect(&area, &box))
{
rc_copy(&box, &dirty_dest);
if (rc_intersect(&work_area, &dirty_dest))
{
Redraw(dirty_dest);
}
}
wind_get(Handle, WF_NEXTXYWH, &box.g_x, &box.g_y, &box.g_w, &box.g_h);
}
graf_mouse(M_ON,0);
}
int wind_with_parts(GEMwindow* w, int Parts, GRECT& R)
{
int h;
if (Parts<0) {
h=0; // ie. Desktop
} else {
h=wind_create(Parts, R.g_x, R.g_y, R.g_w, R.g_h);
}
if (Parts&NAME && h) {
wind_set(h,WF_NAME,DefaultTitle); // only NAMEd windows?
}
if (h) wind_set(h,WF_NAME,DefaultTitle); // or always?
return h;
}
GEMwindow::GEMwindow(int Parts, GRECT& R) :
parts(Parts),
Open(FALSE)
{
Pos=R;
Handle=wind_with_parts(this,Parts,R);
}
GEMwindow::GEMwindow(int Parts=0) :
parts(Parts),
Open(FALSE)
{
wind_get(0,WF_WORKXYWH,&Pos.g_x,&Pos.g_y,&Pos.g_w,&Pos.g_h);
Handle=wind_with_parts(this,Parts,Pos);
}
GEMwindow::~GEMwindow()
{
wind_delete(Handle);
}
void GEMwindow::open()
{
if (!Open) {
wind_open(Handle,Pos.g_x,Pos.g_y,Pos.g_w,Pos.g_h);
Open=TRUE;
}
}
void GEMwindow::close()
{
if (Open) {
wind_close(Handle);
Open=FALSE;
}
}
void GEMwindow::move(int x, int y)
{
Pos.g_x=x;
Pos.g_y=y;
wind_set(Handle,WF_CURRXYWH,Pos.g_x,Pos.g_y,Pos.g_w,Pos.g_h);
}
void GEMwindow::top(int x, int y)
{
wind_set(Handle,WF_TOP);
}
ClickResult GEMwindow::click(int x, int y)
{
return ContinueInteraction;
}
void GEMwindow::title(const char *T)
{
wind_set(Handle,WF_NAME,LOHI(T));
}