#include <LEDA/window.h>

color col = green2;

window* Wp;

void draw_disc() 
{ Wp->start_buffering();
  Wp->draw_filled_circle(50,35,30,col);
  Wp->flush_buffer();  
  Wp->stop_buffering();
}

void slider_red(int x)   { col.set_red(x);   draw_disc(); }
void slider_green(int x) { col.set_green(x); draw_disc(); }
void slider_blue(int x)  { col.set_blue(x);  draw_disc(); }


int main()
{
  window W(450,450,"define color");

  Wp = &W;

  int r,g,b;
  col.get_rgb(r,g,b);
  W.int_item("red  ",r,0,255,slider_red);   // sliders with actions
  W.int_item("green",g,0,255,slider_green);
  W.int_item("blue ",b,0,255,slider_blue);
  W.button("quit",0);

  W.set_redraw(draw_disc);

  W.display(window::center,window::center);

  draw_disc();

  W.read_mouse();

  return 0;
}
