#include RgbBox::RgbBox(int x, int y, int w, int h, ColorRGB *c) : Fl_Box(x,y,w,h), sujeto(c) { box(FL_EMBOSSED_BOX); actualizar(c); sujeto->suscribir(this); } void RgbBox::actualizar(Sujeto *s) { static uchar r, g, b; if (s == sujeto) { sujeto->getRGB(r,g,b); _setRGB(r,g,b); } } void RgbBox::getRGB(uchar &r, uchar &g, uchar &b) { sujeto->getRGB(r,g,b); // or by reading the color of the box } void RgbBox::_setRGB(int r, int g, int b) { color(fl_rgb_color(r,g,b)); redraw(); // important! } void RgbBox::setRGB(int r, int g, int b) { sujeto->setRGB(r,g,b); }