31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

in this section add panel items or buttons to the panel section of W . Note that they have<br />

to be called before the window is displayed the first time.<br />

In general, a panel item consists of a string label and an associated variable of a certain<br />

type (int, bool, string, double, color). <strong>The</strong> value of this variable can be manipulated<br />

through the item. Each button has a label (displayed on the button) and an associated<br />

number. <strong>The</strong> number of a button is either defined by the user or is the rank of the button<br />

in the list of all buttons. If a button is pressed (i.e. selected by a mouse click) during a<br />

read mouse operation its number is returned.<br />

Action functions can be associated with buttons and some items (e.g. slider items) whenever<br />

a button with an associated action function is pressed this function is called with the<br />

number of the button as actual parameter. Action functions of items are called whenever<br />

the value of the corresponding variable is changed with the new value as actual parameter.<br />

All action functions must have the type void func(int).<br />

Another way to define a button is to associate another window with it. In this case the<br />

button will have a menu sign and as soon as it is pressed the attached window will open.<br />

This method can be used to implement pop-up menues. <strong>The</strong> return value of the current<br />

read mouse operation will be the number associated with the button in the menu.<br />

3.9.1 General Settings<br />

void W.set panel bg color(color c)<br />

void W.buttons per line(int n)<br />

void W.set button space(int s)<br />

void W.set item height(int h)<br />

void W.set item width(int w)<br />

void W.set bitmap colors(int c 0 , int c 1 )<br />

3.9.2 Simple Panel Items<br />

sets the background color of the panel area to c.<br />

defines the maximal number n of buttons per line.<br />

sets the space between to adjacent buttons to s<br />

pixels.<br />

sets the vertical size of all items to h pixels.<br />

sets the horizontal size of all slider and string items<br />

to w pixels.<br />

sets the unpressed/pressed colors used for drawing<br />

the pixels in bitmap buttons to c 0 and c 1 .<br />

panel item W.text item(string s) adds a text item s to W .

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!