home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / diverses / leda / prog / graphics / panel_de.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  1.4 KB  |  81 lines

  1. #include <LEDA/window.h>
  2.  
  3.  
  4. main()
  5.  
  6.  
  7.   bool   B     = false;
  8.   real   R     = 3.1415;
  9.   int    C     = 0;
  10.   int    C1    = 0;
  11.   int    N     = 100;
  12.   string S     = "dummy";
  13.   string S1    = "menu";
  14.  
  15.   int    but_num = 16;
  16.   int    but_per_line = 4;
  17.  
  18.   list(string) menu;
  19.   cmd_istream ls("ls");
  20.   menu.read(ls);
  21.  
  22. for(;;)
  23. {
  24.  
  25.   panel P("PANEL DEMO");
  26.  
  27.   P.text_item("This program demonstrates the use of panels. "); 
  28.   P.text_item("                                             ");
  29.  
  30.   P.bool_item("BOOL",B);
  31.  
  32.   P.choice_item("CHOICE",C,"ZERO","ONE","TWO","THREE", "FOUR");
  33.  
  34.   P.int_item("INT",N);
  35.   P.int_item("INT (CHOICE)",C1,0,100,20);
  36.   P.int_item("INT (SLIDER)",but_num,1,64);
  37.  
  38.   P.real_item("REAL",R);
  39.  
  40.   P.string_item("STRING",S);
  41.   P.string_item("STRING (MENU)",S1,menu);
  42.  
  43.  
  44.   P.text_item(""); 
  45.   P.text_item("BUTTONS "); 
  46.  
  47.   int i;
  48.  
  49.   for(i = 1; i <= but_num; i++) 
  50.    { P.button(form("%2d",i));
  51.      if (i % but_per_line == 0) P.new_button_line();
  52.     }
  53.  
  54.   P.new_button_line();
  55.  
  56.   P.button("QUIT");
  57.  
  58.   int button = P.open();
  59.  
  60.  
  61.   printf("BOOL          = %d\n",B);
  62.   printf("CHOICE        = %d\n",C);
  63.   printf("INT (CHOICE)  = %d\n",C1);
  64.   printf("INT (SLIDER)  = %d\n",but_num);
  65.   printf("INT           = %d\n",N);
  66.   printf("REAL          = %f\n",~R);
  67.   printf("STRING        = %s\n",~S);
  68.   printf("STRING (MENU) = %s\n",~S1);
  69.   printf("BUTTON        = %d\n",button);
  70.   newline;
  71.  
  72.   if (button==but_num) break;
  73.  
  74.   but_per_line = button+1;
  75.  
  76.  }
  77.  
  78. }
  79.  
  80.