#include <LEDA/window.h>
#include <LEDA/stream.h>
#include <LEDA/bitmaps/button32.h>

static char* bm_bits [] = {
  triang_bits,
  voro_bits,
  empty_circle_bits,
  encl_circle_bits,
  grid_bits,
  hull_bits,
};


int main()
{ 
  bool   B     = false;
  color  col   = blue2;
  double R     = 3.1415;
  int    C     = 0;
  int    C1    = 0;
  int    C2    = 0;
  int    CM    = 0;
  int    N     = 100;
  string S0    = "string0";
  string S     = "dummy";
  string S1    = "menu";

  int but_num = 5;

  list<string> M1;
#if defined(unix)
  cmd_istream LS1("ls -1 *.c");
  M1.read(LS1);
#else
  for(int j = 0; j<16; j++) M1.append(string("menu-item-%d",j));
#endif


  list<string> M2;
#if defined(unix_)
  cmd_istream LS2("ls -1 *.o");
  M2.read(LS2);
#else
  M2.append("menu-item-0");
  M2.append("menu-item-1");
  M2.append("menu-item-2");
  M2.append("menu-item-3");
  M2.append("menu-item-4");
#endif

  list<string> CML;

  CML.append("0");
  CML.append("1");
  CML.append("2");
  CML.append("3");
  CML.append("4");


  for(;;)
  {
    panel P("PANEL DEMO");
    string text;
    text += " The panel section of a window is used for displaying text";
    text += " messages and for updating the values of variables. It consists";
    text += " of a list of panel items and a list of buttons.";
    text += " The operations in this section add panel items or buttons to ";
    text += " the panel section of W. Note that they have to be called before";
    text += " the window is displayed the first time.";
  
    P.text_item(text);
    P.text_item("");
  
    P.bool_item("bool_item",B);
    panel_item it1 = P.color_item("color_item",col);
    P.int_item("int_item(1,20)",but_num,-1,20);
    P.string_item("string_item(M1)",S0,M1);
    //P.string_item("string_item(M2)",S1,M2);
    P.string_item("string_item",S);
    P.int_item("int_item",N);
    P.double_item("double_item",R);
    P.choice_item("choice_item",C,"zero","gone","two","three", "four");
    P.choice_mult_item("choice_mult_item",CM,CML);
    P.int_item("int_item(0,80,20)",C1,0,80,20);
    panel_item it2 = P.choice_item("bitmap",C2,6,32,32,bm_bits);
  
    int i;
    for(i=0; i < but_num; i++) P.button(string("%d",i));
  
    P.button("quit");
    //P.button(19,19,c_bits,"hallo");

    P.display();

/*
    panel_item it;
    forall_items(it,P) 
    { string l = P.get_label(it);
      if (l != "" && Yes(string("Disable Item %s ?",~l)))
         P.disable_item(it);
     }
*/
  
    int button = P.open();

    cout << "CM = " << CM << endl;
    newline;
    cout << "button = " << button << endl;
    newline;
  
    if (button == i) break;
   }
 
  return 0;
}
  
