/*_|_| begin WINDERS.CPP (part 4 of 5) **
_|_|_| PUBLIC DOMAIN by Kurt Kuzba 12/25/1997 **
_|_|_| A simple example of using windowed text in Borland C++. **
_|_|_| No warrantees or guarantees given or implied. **
_|_|*/
// define double shadowed window class derived from MyWindows ***
class DoubleShadowWindow : public MyWindows{
public:
void Create(WIN_DEF, char*);
void Create(int, int, int, int, int, int, char*);
};
//********** DoubleShadowWindow functions
void DoubleShadowWindow::Create(int l = 2, int t = 2, int r = WIDE - 3,
int b = HIGH - 2, int a = 0x1f, int ba = 0x19,
char *brd = "\xd5\xb8\xd4\xbe\xcd\xb3")
{
if(psBuffer)
return;
WIN_DEF wd = { l, t, r, b, a, ba };
Create(wd, brd);
}
void DoubleShadowWindow::Create(WIN_DEF wd,
char *brd = "\xd5\xb8\xd4\xbe\xcd\xb3")
{
if(psBuffer)
return;
int iBuf, iGray, iWide;
char *psGray;
wd1.nL = (wd.nL WIDE - 3) ? 2 : wd.nL;
wd1.nR = (wd.nR WIDE - 3) ? WIDE - 3 : wd.nR;
wd1.nT = (wd.nT HIGH - 2) ? 2 : wd.nT;
wd1.nB = (wd.nB HIGH - 2) ? HIGH - 2 : wd.nB;
wd1.nA = wd2.nA = wd.nA;
wd1.nBA = wd2.nBA = wd.nBA;
wd2.nL = wd1.nL - 1;
wd2.nR = wd1.nR + 3;
wd2.nT = wd1.nT - 1;
wd2.nB = wd1.nB + 2;
psGray = new char[iBuf = Grab()];
memmove(psGray, psBuffer, iBuf);
iWide = (wd2.nR - wd2.nL + 1) * 2;
for(iGray = iWide * 2 - 3; iGray < iBuf; iGray += iWide)
{
psGray[iGray] = char(0x08);
psGray[iGray + 2] = char(0x08);
}
for(iGray = iBuf - iWide + 2; iGray < iBuf; iGray++)
{
if(iGray & 1)
psGray[iGray] = char(0x08);
}
puttext(wd2.nL, wd2.nT, wd2.nR, wd2.nB, psGray);
delete psGray;
char szOut[81], szFormat[81], szFiller[81];
szFiller[80] = char('\0');
sprintf(szFormat, "%s%d%s", "%c%.", 1 + wd1.nR - wd1.nL, "s%c");
memset(szFiller, brd[4], 80);
sprintf(szOut, szFormat, brd[0], szFiller, brd[1]);
gotoxy(1, 1);
textattr(wd1.nBA);
cprintf(szOut);
memset(szFiller, ' ', 80);
sprintf(szOut, szFormat, brd[5], szFiller, brd[5]);
for(iGray = wd1.nT; iGray <= wd1.nB; iGray++)
cprintf("\n\r%s", szOut);
memset(szFiller, brd[4], 80);
sprintf(szOut, szFormat, brd[2], szFiller, brd[3]);
cprintf("\n\r%s", szOut);
window(wd1.nL, wd1.nT, wd1.nR, wd1.nB);
textattr(wd1.nA);
clrscr();
_wscroll = 1;
}
/*_|_| end WINDERS.CPP (part 4 of 5) */
> ] I did a Web search for MY MORALS, but didn't find anything..
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)
|