Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
14
Добавлен:
17.04.2013
Размер:
1.66 Кб
Скачать
#include <graphics.h>

int witch_btn(int xx,int yy);       //Є Є п Є­®ЇЄ  ­ ¦ в 

class Buttons
{
 public:
   int  btn[10];
   void Btn_Up(int sx,int sy,char t[10]);
   void Btn_Down(int sx,int sy,char t[10]);
   void click(int sx,int sy,char t[10],int w);
				   };

void Buttons::Btn_Down(int sx,int sy,char t[10])
{
   int btn[10]=
			 { sx,sy,
			   sx,sy+20,
			   sx+60,sy+20,
			   sx+60,sy,
			   sx,sy
					  };
setcolor(7);
setfillstyle(SOLID_FILL,8);
fillpoly(5,btn);
setcolor(7);
outtextxy(sx+10,sy+7,t);
				   }

void Buttons::Btn_Up(int sx,int sy,char t[10])
{
   int btn[10]=
			 { sx,sy,
			   sx,sy+20,
			   sx+60,sy+20,
			   sx+60,sy,
			   sx,sy
					  };
setcolor(WHITE);
setfillstyle(SOLID_FILL,8);
fillpoly(5,btn);
setcolor(15);
outtextxy(sx+10,sy+7,t);
				   }

void Buttons::click(int sx,int sy,char t[10],int w)
{
 hidemouse();
 Btn_Down(sx,sy,t);
 delay(60);
 showmouse();
	while((mousepressed()!=0) && (witch_btn(mousegetx(),mousegety()) ==w))  {};
 hidemouse();
 Btn_Up(sx,sy,t);
 showmouse();
			 }

int witch_btn(int xx,int yy)       //Є Є п Є­®ЇЄ  ­ ¦ в 
{
 if ((xx>19) && (xx<81) && (yy>49)  && (yy<71))  return 1;
 if ((xx>19) && (xx<81) && (yy>99)  && (yy<121)) return 2;
 if ((xx>19) && (xx<81) && (yy>149) && (yy<171)) return 3;
 if ((xx>19) && (xx<81) && (yy>199) && (yy<221)) return 4;
 if ((xx>19) && (xx<81) && (yy>249) && (yy<271)) return 5;
 if ((xx>19) && (xx<81) && (yy>299) && (yy<321)) return 6;
 if ((xx>19) && (xx<81) && (yy>349) && (yy<371)) return 7;
 if ((xx>19) && (xx<81) && (yy>399) && (yy<421)) return 8;
		   return 0;      								}
Соседние файлы в папке GRAPH_RD