// FlTk demo program for CS638 // Fall, 1999, Richard Yu Gu // Comments added, Fall 2000, Michael Gleicher // implementation of EventBox class - see documentation in header #include "EventBox.h" EventBox::EventBox(int t, int l, int width, int height) :Fl_Box(FL_UP_BOX, t, l, width, height, "") { labelfont(FL_ITALIC); labelsize(24); labeltype(FL_SHADOW_LABEL); label("Hello"); } int EventBox::handle(int e) { switch(e) { case FL_ENTER: color (FL_RED); labelcolor(FL_BLACK); damage(1); return 1; case FL_LEAVE: color(FL_GRAY); labelcolor(FL_BLACK); damage(1); return 1; case FL_PUSH: labelcolor(FL_BLUE); damage(1); return 1; case FL_RELEASE: labelcolor(FL_BLACK); damage(1); return 1; case FL_DRAG: labelcolor(FL_YELLOW); damage(1); return 1; default: return Fl_Box::handle(e); }; }