C_BOX.CPP

 //int RETURN_PUSHED_CONTROL_B_ID(int x1,int y1);
//void CB_PRESS_OR_RELEASE(int CB_ID,int P_or_R,FORM *df);

struct CB_DIM
{

int CB_left;
int CB_top;
int CB_right;
int CB_bot;
int CB_id;

CB_DIM * nextcb;
};

class CONTROL_BOX
{
public:

int t_left;
int t_top;
int t_right;
int t_bot;

int CB_MIN_left;
int CB_MIN_top;
int CB_MIN_right;
int CB_MIN_bot;
int CB_MIN_col;
int CB_MIN_midx;
int CB_MIN_midy;

int CB_MAX_left;
int CB_MAX_top;
int CB_MAX_right;
int CB_MAX_bot;
int CB_MAX_col;
int CB_MAX_midx;
int CB_MAX_midy;

int CB_CLOSE_left;
int CB_CLOSE_top;
int CB_CLOSE_right;
int CB_CLOSE_bot;
int CB_CLOSE_col;
int CB_CLOSE_midx;
int CB_CLOSE_midy;

int CB_width;
int CB_height;

int CB_BUTTON_width;
int FULL_CB;    //Boolean

int TITLE_B_width;
int TITLE_B_height;
//int CF_ID;

int Temp_Y;

CB_DIM * firstcb;
CB_DIM * lastcb;

public:

CONTROL_BOX()
{
t_left=50;
t_top=50;
t_right=300;
t_bot=t_top+20;

TITLE_B_width=t_right-t_left;
TITLE_B_height=t_bot-t_top;

CB_width=36+3;
CB_height=12;
CB_BUTTON_width=12;

CB_MIN_left=t_left+TITLE_B_width-9-36;
CB_MIN_top=t_top+4;
CB_MIN_right=CB_MIN_left+CB_BUTTON_width;
CB_MIN_bot=CB_MIN_top+CB_BUTTON_width;
CB_MIN_col=9;

CB_MIN_midx=(CB_MIN_right-CB_MIN_left)/2;
CB_MIN_midy=(CB_MIN_bot-CB_MIN_top)/2;



CB_MAX_left=CB_MIN_right+2;
CB_MAX_top=t_top+4;
CB_MAX_right=CB_MAX_left+CB_BUTTON_width;
CB_MAX_bot=CB_MAX_top+CB_BUTTON_width;
CB_MAX_col=9;

CB_CLOSE_left=CB_MAX_right+2;
CB_CLOSE_top=t_top+4;
CB_CLOSE_right=CB_CLOSE_left+CB_BUTTON_width;
CB_CLOSE_bot=CB_CLOSE_top+CB_BUTTON_width;
CB_CLOSE_col=12;
CB_CLOSE_midx=(CB_CLOSE_right-CB_CLOSE_left)/2;
CB_CLOSE_midy=(CB_CLOSE_bot-CB_CLOSE_top)/2;


FULL_CB=1;

}


CONTROL_BOX(int tx,int ty,int bx,int by,int c_box)
{
t_left=tx;
t_top=ty;
t_right=bx;
t_bot=by;

TITLE_B_width=t_right-t_left;
TITLE_B_height=t_bot-t_top;

CB_width=36+3;
CB_height=12;
CB_BUTTON_width=12;

CB_MIN_left=t_left+TITLE_B_width-9-36;
CB_MIN_top=t_top+4;
CB_MIN_right=CB_MIN_left+CB_BUTTON_width;
CB_MIN_bot=CB_MIN_top+CB_BUTTON_width;
CB_MIN_col=9;

CB_MIN_midx=(CB_MIN_right-CB_MIN_left)/2;
CB_MIN_midy=(CB_MIN_bot-CB_MIN_top)/2;



CB_MAX_left=CB_MIN_right+2;
CB_MAX_top=t_top+4;
CB_MAX_right=CB_MAX_left+CB_BUTTON_width;
CB_MAX_bot=CB_MAX_top+CB_BUTTON_width;
CB_MAX_col=9;

CB_CLOSE_left=CB_MAX_right+2;
CB_CLOSE_top=t_top+4;
CB_CLOSE_right=CB_CLOSE_left+CB_BUTTON_width;
CB_CLOSE_bot=CB_CLOSE_top+CB_BUTTON_width;
CB_CLOSE_col=12;
CB_CLOSE_midx=(CB_CLOSE_right-CB_CLOSE_left)/2;
CB_CLOSE_midy=(CB_CLOSE_bot-CB_CLOSE_top)/2;


firstcb=NULL;
lastcb=NULL;

CB_DIM * newcb=new CB_DIM;
newcb->CB_left=CB_CLOSE_left;
newcb->CB_top=CB_CLOSE_top;
newcb->CB_right=CB_CLOSE_right;
newcb->CB_bot=CB_CLOSE_bot;
newcb->CB_id=3;
newcb->nextcb=NULL;
firstcb=newcb;
lastcb=firstcb;
////
newcb=new CB_DIM;
newcb->CB_left=CB_MAX_left;
newcb->CB_top=CB_MAX_top;
newcb->CB_right=CB_MAX_right;
newcb->CB_bot=CB_MAX_bot;
newcb->CB_id=2;
newcb->nextcb=NULL;
lastcb->nextcb=newcb;
lastcb=newcb;
///
////
newcb=new CB_DIM;
newcb->CB_left=CB_MIN_left;
newcb->CB_top=CB_MIN_top;
newcb->CB_right=CB_MIN_right;
newcb->CB_bot=CB_MIN_bot;
newcb->CB_id=1;
newcb->nextcb=NULL;
lastcb->nextcb=newcb;
lastcb=newcb;

FULL_CB=c_box;

}

void CB_MIN_Paint()
{
CB_MIN_Released();
}
void CB_MIN_Released()
{
hidemouseptr();
setviewport(0,0,getmaxx(),getmaxy(),1);
setviewport(CB_MIN_left,CB_MIN_top,CB_MIN_right,CB_MIN_bot,1);

clearviewport();

setcolor(15);
rectangle(0,0,12,12);
setfillstyle(1,CB_MIN_col);
floodfill(2,2,15);
setcolor(3);
rectangle(0,0,12,12);
setlinestyle(0,0,1);
setcolor(1);
line(11,1,11,11);
line(1,11,11,11);
setlinestyle(0,0,2);
setcolor(15);
//line(4,7,8,7);
line(4,8,8,8);

setviewport(0,0,getmaxx(),getmaxy(),1);
showmouseptr();
}

void CB_MAX_Paint()
{
CB_MAX_Released();
}

void CB_MAX_Released()
{
hidemouseptr();
setviewport(0,0,getmaxx(),getmaxy(),1);
setviewport(CB_MAX_left,CB_MAX_top,CB_MAX_right,CB_MAX_bot,1);
clearviewport();
setcolor(15);
rectangle(0,0,12,12);
setfillstyle(1,CB_MAX_col);
floodfill(2,2,15);
setcolor(3);
rectangle(0,0,12,12);
setlinestyle(0,0,1);
setcolor(1);
line(11,1,11,11);
line(1,11,11,11);

setcolor(15);
rectangle(3,3,9,9);
setlinestyle(0,0,1);
line(4,4,8,4);
setviewport(0,0,getmaxx(),getmaxy(),1);
showmouseptr();
}

void CB_CLOSE_Paint()
{
CB_CLOSE_Released();
}

void CB_CLOSE_Released()
{
hidemouseptr();
setviewport(0,0,getmaxx(),getmaxy(),1);
setviewport(CB_CLOSE_left,CB_CLOSE_top,CB_CLOSE_right,CB_CLOSE_bot,1);

clearviewport();

setcolor(15);
rectangle(0,0,12,12);
setfillstyle(1,CB_CLOSE_col);
floodfill(2,2,15);
setcolor(3);
rectangle(0,0,12,12);
setlinestyle(0,0,1);
setcolor(4);
line(11,1,11,11);
line(1,11,11,11);

settextstyle(2,0,7);
setusercharsize(2,3,4,4);
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(15);
outtextxy(CB_CLOSE_midx,CB_CLOSE_midy-1,"X");
/////////////
//line(CB_CLOSE_midx-3,CB_CLOSE_midy-3,CB_CLOSE_midx+3,CB_CLOSE_midy+3);
//line(CB_CLOSE_midx+3,CB_CLOSE_midy+3,CB_CLOSE_midx-3,CB_CLOSE_midy-3);
settextjustify(LEFT_TEXT,TOP_TEXT);
setviewport(0,0,getmaxx(),getmaxy(),1);
showmouseptr();
}

void CB_MIN_Pushed()
{
hidemouseptr();
setviewport(0,0,getmaxx(),getmaxy(),1);
setviewport(CB_MIN_left,CB_MIN_top,CB_MIN_right,CB_MIN_bot,1);

clearviewport();

setcolor(15);
rectangle(0,0,12,12);
setfillstyle(1,CB_MIN_col);
floodfill(2,2,15);
setcolor(3);
rectangle(0,0,12,12);
setlinestyle(0,0,1);
setcolor(1);
line(1,1,11,1);
line(1,1,1,11);
setlinestyle(0,0,2);
setcolor(15);
//line(4,7,8,7);
line(5,9,9,9);

setviewport(0,0,getmaxx(),getmaxy(),1);
showmouseptr();
}

void CB_MAX_Pushed()
{
hidemouseptr();
setviewport(0,0,getmaxx(),getmaxy(),1);
setviewport(CB_MAX_left,CB_MAX_top,CB_MAX_right,CB_MAX_bot,1);
clearviewport();
setcolor(15);
rectangle(0,0,12,12);
setfillstyle(1,CB_MAX_col);
floodfill(2,2,15);
setcolor(3);
rectangle(0,0,12,12);
setlinestyle(0,0,1);
setcolor(1);
line(1,1,11,1);
line(1,1,1,11);
setcolor(15);
rectangle(3,3,9,9);
setlinestyle(0,0,1);
line(4,4,8,4);
setviewport(0,0,getmaxx(),getmaxy(),1);
showmouseptr();
}

void CB_CLOSE_Pushed()
{
setviewport(0,0,getmaxx(),getmaxy(),1);
setviewport(CB_CLOSE_left,CB_CLOSE_top,CB_CLOSE_right,CB_CLOSE_bot,1);
hidemouseptr();
clearviewport();

setcolor(15);
rectangle(0,0,12,12);
setfillstyle(1,CB_CLOSE_col);
floodfill(2,2,15);
setcolor(3);
rectangle(0,0,12,12);
setlinestyle(0,0,1);
setcolor(4);
line(1,1,11,1);
line(1,1,1,11);

settextstyle(2,0,7);
setusercharsize(2,3,4,4);
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(15);
outtextxy(CB_CLOSE_midx,CB_CLOSE_midy,"X");
//line(CB_CLOSE_midx-3,CB_CLOSE_midy-3,CB_CLOSE_midx+3,CB_CLOSE_midy+3);
//line(CB_CLOSE_midx+3,CB_CLOSE_midy+3,CB_CLOSE_midx-3,CB_CLOSE_midy-3);
settextjustify(LEFT_TEXT,TOP_TEXT);
setviewport(0,0,getmaxx(),getmaxy(),1);
showmouseptr();
}

};



Project Homepage: