// // Vivio SimpleButton // // Copyright (c) 1996 - 2003 jones@cs.tcd.ie // // 03/06/97 first version // 10/08/02 vivio v2.0 // class SimpleButton(int x, int y, int w, int h, Brush b0, Brush b1, Brush txtbrush, Font font, string txt) int enabled = 1; Rectangle button = Rectangle(0, 0, 0, blackpen, b0, x, y, w-2, h-2, txtbrush, font, txt); function down() button.setpos(x+2, y+2); end; function up() button.setpos(x, y); button.setbrush(b0); end; function setborderpen(Pen pen) button.setpen(pen); end; when button.eventEE(int enter, int xx, int yy) if (enabled) if (enter) button.setbrush(b1); else up(); end; end; end; when button.eventLB(int downx, int xx, int yy) if (enabled) if (downx) down(); else up(); end; end; end; when button.eventRB(int downx, int xx, int yy) if (enabled) if (downx) down(); else up(); end; end; end; end; // eof