int gettop()const {return top;};
int getleft()const {return left;};
int getonoff()const {return onoff;};
int getcol()const {return color;};
const char* getcapt(){return caption;};
virtual void mousemove(int i);
virtual void setpos(int x,int y, char* capt,int i=0);
protected:
int width;
int height;
int top;
int left;
int onoff;
int color;
char *caption;
};
class TMeny:public TButton
{
public:
TMeny();
~TMeny(){};
virtual void Draw();
virtual void setonoff(int x)
onoff=x;
if (!onoff) color=colornotsel;
else color=colorsel;
Draw();
virtual void close(int p=0);
void DrowMenyAll(TMeny FirstMeny[],int FMeny, int p=0);
//////////////////////////////////////////////////////////////////////////////
//ОБЪЯВЛЕНИЕ ОБЪЕКТОВ
///////////////////////////////////////////////////////////////////////////////////////////
TButton button[ButtonN];
TMeny FMeny1[Meny1],FMeny2[Meny2],FMeny3[Meny3],
FPMeny2[PMeny2],FPMeny1[PMeny1];
//////////////////////////////////////////////////////////////////////////////////////////
void TMeny::close(int p)
if (!p)
setonoff(0);
mouseoff();
putimage(xy1-2,yy1-2, arrow, 0);
mouseon();
free(arrow);
}
else
putimage(xy1p-2,yy1p-2, arrowp, 0);
free(arrowp);
void TMeny::mousemove(int i)
if (mousein(left,top,left+width,top+height))
if (!getbutton(1))
{ //Не нажата
if (!onoff) setonoff(1);
if ((BoolMeny2)&&(!OnPMenu))
switch (i)
case 0:
if (BoolPMeny2)
FPMeny2[0].close(1);
BoolPMeny2=0;
if (!BoolPMeny1)
DrowMenyAll(FPMeny1,PMeny1,1);
BoolPMeny1=1;
break;
case 1:
if (BoolPMeny1)
FPMeny1[0].close(1);
BoolPMeny1=0;
if (!BoolPMeny2)
DrowMenyAll(FPMeny2,PMeny2,1);
BoolPMeny2=1;
if ((onoff)&&(!(MenN2)))
//Нажата
close(OnPMenu);
if (BoolMeny2) FMeny2[0].close();
DoSome(i+100);
DoSome(i+110);
if (BoolMeny1) DoSome(i+20); else
if (BoolMeny2) DoSome(i+30);else
if (BoolMeny3) DoSome(i+40);else
if (BoolMeny4) DoSome(i+50);else
if (BoolMeny5) DoSome(i+60);else
if (BoolMeny6) DoSome(i+70);
BoolMeny1=0;
BoolMeny2=0;
BoolMeny3=0;
BoolMeny4=0;
BoolMeny5=0;
BoolMeny6=0;
if ((getbutton(1))&&(!OnPMenu)&&(!MenN2))
if (!mousein(xy1,yy1,xy2+6,yy2+yy1+4))
else if (onoff) setonoff(0);
void TMeny::setpos(int x,int y, char* capt,int i)
left=x;
top=y;
caption=capt;
if (i) Draw();
void TMeny::Draw()// Метод постройки кнопок------------
int i;
setfillstyle(1,7);
setlinestyle(0,0,0);
setcolor(color);
bar(left,top,left+width,top+height);
moveto(5+left,5+top);
outtext(caption);
if (color==colornotsel) setcolor(7);
rectangle(left,top,left+width,top+height);
rectangle(left+2,top+2,left+width-2,top+height-2);
} // Метод постройки кнопок--------------------------------
TMeny::TMeny()
caption='\0';
width=180;
height=18;
top=0;
left=0;
color=colornotsel;
onoff=0;
void DrowMenyAll(TMeny FirstMeny[],int FMeny, int p)
xy1=FirstMeny[0].getleft()-4;
yy1=FirstMeny[0].gettop()-4;
xy2=FirstMeny[0].getleft()+FirstMeny[0].getwidth();
yy2=FirstMeny[FMeny-1].gettop()-FirstMeny[0].gettop()+FirstMeny[0].getheight()+8;
size = imagesize(xy1-2, yy1-2, xy2+6, yy1+yy2+4);
arrow = malloc(size);
getimage(xy1-2, yy1-2, xy2+6, yy1+yy2+4, arrow);
int dx=(xy2-xy1+4)/5;
int dy=(yy2+2)/5;
for (int k=1;k<=5; k++)
windows(xy1,yy1,dx*k,dy*k,7,"",0);
delay(30);
windows(xy1,yy1,xy2-xy1+4,yy2+2,7,"",0);
windows(xy1+2,yy1+2,xy2-xy1,yy2-2,7,"",1);
for (int gg=0;gg<FMeny;gg++)
FirstMeny[gg].Draw();
xy1p=FirstMeny[0].getleft()-4;
yy1p=FirstMeny[0].gettop()-4;
xy2p=FirstMeny[0].getleft()+FirstMeny[0].getwidth();
yy2p=FirstMeny[FMeny-1].gettop()-FirstMeny[0].gettop()+FirstMeny[0].getheight()+8;
sizep = imagesize(xy1p-2, yy1p-2, xy2p+6, yy1p+yy2p+4);
arrowp = malloc(sizep);
getimage(xy1p-2, yy1p-2, xy2p+6, yy1p+yy2p+4, arrowp);
int dx=(xy2p-xy1p+4)/5;
int dy=(yy2p+2)/5;
windows(xy1p,yy1p,dx*k,dy*k,7,"",0);
windows(xy1p,yy1p,xy2p-xy1p+4,yy2p+2,7,"",0);
windows(xy1p+2,yy1p+2,xy2p-xy1p,yy2p-2,7,"",1);
void mysound()
sound(1000);
nosound();
void messageabout()
{ mysound();
size=imagesize(199,99,200+241,241);
arrow=malloc(size);
getimage(199,99,200+241,241,arrow);
windows(200,100,240,140,7,"",0);
windows(202,102,236,15,colorhead,"Про програму",1);
setcolor(11);
outtextxy(230,130," КУРСОВА РОБОТА ");
outtextxy(230,150," ");
outtextxy(230,170," iнтерполяцiя по");
outtextxy(230,190," Лагранжу i Ньютону ");
outtextxy(230,210,"");
while (getbutton(1));
while ((!getbutton(1))&&(!kbhit()));
putimage(199,99,arrow,0);
while (kbhit()) getch();
void messageaboutavt()
Страницы: 1, 2, 3, 4, 5, 6, 7, 8