List of all members | Public Member Functions | Public Attributes
Menu Class Reference

Menu widget. More...

+ Inheritance diagram for Menu:

Public Member Functions

int addItem (string name)
 add a menu item. More...
 
void clear ()
 clear the menu entries.
 
string getText (int index)
 
 Menu (string name, table items)
 creates a menu widget on the user inteface. More...
 
void setItem (int index, string name)
 setItem text for a given index. More...
 
void setValue (number value, bool callChangedCallback=true)
 

Public Attributes

string align
 text alignement: "centred" | "left"| "right" | "top" | "bottom" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight"
 
number alpha
 transparency value between 0.0 and 1.0
 
string arrowColour
 arrow colour: colour string that defines the desired colour. It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format
 
string backgroundColour
 background colour: colour string that defines the desired colour. It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format
 
string backgroundImage
 path to background image
 
table bounds
 widget bounding rect {x,y,width,height}
 
function changed
 callback function used by child widgets to be notified of changes
 
bool displayArrow
 show/hide the arrow on the right of the Menu, default is true
 
string displayName
 widget display name
 
bool enabled
 boolean flag to enable / disable the widget
 
string font
 path to TrueType font
 
number fontSize
 font size
 
int height
 widget height in pixels
 
bool hierarchical
 allows to have sub-menus. The list should define path like entries. example: entries = { "a/1", "a/2", "a/3", "b/1", "b/2", "c/3", "foo/bar/toto", "foo/bar/tata", "foo/jo/bar"}
 
bool interceptsMouseClicks
 boolean flag to toggle mouse handling on widget
 
table items
 table of item names
 
int length
 size of the menu
 
Mapper::Type mapper
 Mapper type, default is Mapper.Linear.
 
int menuHeight
 allows to override the popup menu height. Mostly useful for special cases like having a big Menu on screen, but a standard drop-down list
 
float minimumHorizontalScale
 specifies the minimum amount that the font can be squashed horizontally before it starts using ellipsis. 0 for a default value. 1 for no stretching
 
string name
 widget name
 
string outlineColour
 outline colour: colour string that defines the desired colour. It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format
 
int paramId
 paramter id
 
bool persistent
 flag to tell if the widget values should be serialized when saving. True by default. Persistent widgets will call their changed function on reload
 
string popupBackgroundColour
 Popup menu background colour: colour string that defines the desired colour. It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format.
 
string popupFont
 path to TrueType font for the popup menu
 
string popupHighlightedBackgroundColour
 Popup menu highlighted background colour: colour string that defines the desired colour. It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format.
 
string popupHighlightedTextColour
 Popup menu highlighted text colour: colour string that defines the desired colour. It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format.
 
string popupTextColour
 Popup menu text colour: colour string that defines the desired colour. It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format.
 
table position
 widget position {x,y}
 
int selected
 selected index
 
string selectedText
 selected text
 
bool showLabel
 show widgets label if any
 
table size
 widget size {width, height}
 
string text
 selected text
 
string textColour
 text colour: colour string that defines the desired colour. It can be either a named colour like "blue" or "red" or an hexadecimal string in RGB ("#FF00CC") or ARGB ("#3C00FECD") format
 
string tooltip
 widget tooltip, default is name
 
Unit::Type unit
 Unit type, default is Unit.Generic.
 
int value
 selected index
 
bool visible
 boolean flag to toggle widget visibility
 
int width
 widget width in pixels
 
int x
 x position in pixels
 
int y
 y position in pixels
 

Detailed Description

Menu widget.

creates a menu widget on the user inteface.

m = Menu("menu", {"one", "two", "three"})
m:addItem("four")
m.changed = function(self)
print("menu selection changed:", self.value, self.selectedText)
end
Examples:
Chorder.lua, monoBassLine.lua, and quarterTone.lua.

Constructor & Destructor Documentation

Menu::Menu ( string  name,
table  items 
)

creates a menu widget on the user inteface.

Parameters
namethe name to give to the widget
items(optional) array of strings to be displayed in the menu

Member Function Documentation

int Menu::addItem ( string  name)

add a menu item.

Parameters
namenew menu item text
Returns
index of new menu item
void Menu::setItem ( int  index,
string  name 
)

setItem text for a given index.

Parameters
indexmenu item index to change
namenew menu item text
void Menu::setValue ( number  value,
bool  callChangedCallback = true 
)
Parameters
valuethe new widget's value
callChangedCallbackcall the changed callback function if true
string Menu::getText ( int  index)
Returns
the text for a given index.
Parameters
indexmenu item index to display