namespace Tickypip { public class ComputerCell : ConnectorCell { private Gnome.CanvasPixbuf mPixbuf; public ComputerCell(Board board) : base(board, ConnectorType.Terminator) { ActiveChanged += new ActiveChangedEventHandler(OnActiveChanged); mPixbuf = new Gnome.CanvasPixbuf(this); mPixbuf.X = 3; mPixbuf.Y = 3; mPixbuf.Width = WIDTH - 2 * mPixbuf.X - 2; mPixbuf.Height = HEIGHT - 2 * mPixbuf.Y - 2; mPixbuf.RaiseToTop(); UpdateImage(); /* Gnome.CanvasRect rect = new Gnome.CanvasRect(this); rect.FillColorGdk = new Gdk.Color(0, 0, 255); rect.X1 = 5; rect.Y1 = 5; rect.X2 = WIDTH - 6; rect.Y2 = HEIGHT - 6; */ } private void OnActiveChanged(Cell cell) { if (Active) Board.ActiveComputers++; else Board.ActiveComputers--; UpdateImage(); } private void UpdateImage() { string filename; if (Active) filename = "terminal-on.svg"; else filename = "terminal-off.svg"; mPixbuf.Pixbuf = ImageLoader.Load(filename, (int)mPixbuf.Width, (int)mPixbuf.Height); } } }