//----- private void init() { med = new Mediator(pic); //create Mediator commands = new Hashtable(); //and Hash table //create the command objectsb RectButton rbutn = new RectButton(med, tbar.Buttons[0]); UndoButton ubutn = new UndoButton(med, tbar.Buttons[1]); ClrButton clrbutn = new ClrButton(med); med.registerRectButton(rbutn); //add them to the hashtable using the button hash values commands.Add(btRect.GetHashCode(), rbutn); commands.Add(btUndo.GetHashCode(), ubutn); commands.Add(btClear.GetHashCode(), clrbutn); pic.Paint += new PaintEventHandler(paintHandler); }
//----- public void registerRectButton(RectButton rb) { rect = rb; }