home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_10_11
/
1011052b
< prev
next >
Wrap
Text File
|
1992-09-08
|
695b
|
50 lines
******************************************************
// REGION.CPP (Listing 8)
// Screen region package -- Williams
#include "region.h"
region::region(int x0,int y0, int x1, int y1,int save)
{
left=x0;
top=y0;
right=x1;
bot=y1;
buf=NULL;
if (save)
reinit();
}
void region::reinit(void)
{
if (buf) delete buf;
buf=new char[2*(1+right-left)*(1+bot-top)];
gettext(left,top,right,bot,buf);
}
void region::restore(void)
{
if (buf)
{
puttext(left,top,right,bot,buf);
destroy();
}
}
region::~region()
{
restore();
}
void region::destroy(void)
{
if (buf)
{
delete buf;
buf=NULL;
}
}