Algorithmic Solutions > LEDA > LEDA Guide > Windows and Panels > Panel Items > Example Panel Item Types

Examples Panel Item Types

The following program generates a panel with all different item types possible in LEDA.

On the right there is a screenshot of the program. Clicking on the picture shows the window in original size.

Picture of Convex Hull
#include <LEDA/graphics/window.h>
#include <LEDA/graphics/bitmaps/button32.h>
#include <LEDA/system/file.h>
#include <LEDA/core/string.h>

using namespace leda;

static unsigned 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, c1=0, c2=0, cm=5, N=100, but_num=5;
  string s0="string0", s="dummy", s1="menu";
  list<string> M1=get_files("."), M2 = get_files(".");
  list<string> CML;
  CML.append("0"); CML.append("1"); CML.append("2");
  CML.append("3"); CML.append("4");

  for(;;) {
    panel P(500,500,"PANEL DEMO");
    string text;
    text += " The panel section of a window is used for displaying text";
    text += " and for updating the values of variables. It consists";
    text += " of a list of panel items and a list of buttons.";
    text += " All operations adding panel items or buttons to the panel";
    text += " section of a window have to be called before";
    text += " the window is displayed for the first time.";
    P.text_item("");
    P.text_item("\\bf\\blue A Text Item");
    P.text_item("");
    P.text_item(text);
    P.text_item("");
	 
    P.text_item("\\bf\\blue A Bool Item");
    P.bool_item("bool item",B);

    P.text_item("\\bf\\blue A Color Item");
    P.color_item("color item",col);
    P.text_item("");

    P.text_item("\\bf\\blue A Slider Item");
    P.int_item("slider item(1,20)",but_num,-1,20);
    P.text_item("");

    P.text_item("\\bf\\blue Simple Items");
    P.string_item("string item",s);
    P.int_item("int item",N);
    P.double_item("double item",R);
    P.text_item("");

    P.text_item("\\bf\\blue String Menu Items");
    P.string_item("string menu",s0,M1,8);
    P.text_item("");

    P.text_item("\\bf\\blue Choice Items");
    P.choice_item("simple choice",c,"one","two","three","four","five");			
    P.choice_mult_item("multiple choice",cm,CML);
    P.int_item("integer choice",c1,0,80,20);
    P.choice_item("bitmap choice",c2,6,32,32,bm_bits);
    P.text_item("");

    P.text_item("\\bf\\blue Buttons");
	
    for(t i=0;i<but_num-1;i++) P.button(string("button %d",i));
    P.button(string("Exit",but_num-1));
			
    P.display(); P.screenshot("panel_items");
    if (P.open(window::center,window::center) == but_num-1) break;
  }	

  return 0;
}  

See also:

Windows and Panels

Panel Items

Panel Buttons

Bitmaps

Files and Directories

Strings

Colors

Linear Lists


Manual Pages:

Manual Page Windows




Please send any suggestions, comments or questions to leda@algorithmic-solutions.com
© Copyright 2001-2003, Algorithmic Solutions Software GmbH