#include #include #include #include class Fl_Monobjet : public Fl_Widget { public: Fl_Monobjet(int, int, int, int, const char *); virtual int handle(int); virtual void draw(); int actif, x1, y1, x2, y2; }; Fl_Monobjet::Fl_Monobjet(int x, int y, int w, int h, const char *label) : Fl_Widget(x, y, w, h, label) { actif = 0; x1 = w/4; x2 = x1 + w/2; y1 = h/4; y2 = y1 + h/2; } void Fl_Monobjet::draw() { if (actif) fl_color(255, 0, 0); else fl_color(0, 0, 255); fl_rectf(x1, y1, x2-x1, y2-y1); } int Fl_Monobjet::handle(int event) { int x, y; if (event==FL_PUSH) { x = Fl::event_x(); y = Fl::event_y(); if (x>=x1 && x=y1 && ybegin(); obj = new Fl_Monobjet(0, 0, win->w(), win->h(), ""); win->end(); win->show(); return Fl::run(); }