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

MultiStateButton widget. More...

+ Inheritance diagram for MultiStateButton:

Public Member Functions

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

Public Attributes

number alpha
 transparency value between 0.0 and 1.0
 
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 the background image strip
 
table bounds
 widget bounding rect {x,y,width,height}
 
function changed
 callback function used by child widgets to be notified of changes
 
string displayName
 widget display name
 
bool enabled
 boolean flag to enable / disable the widget
 
int height
 widget height in pixels
 
bool interceptsMouseClicks
 boolean flag to toggle mouse handling on widget
 
int length
 size of the menu
 
Mapper::Type mapper
 Mapper type, default is Mapper.Linear.
 
string name
 widget name
 
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
 
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

MultiStateButton widget.

creates a multi-state button widget on the user inteface.

m = MultiStateButton("Multi", {"one", "two", "three"})
m:addItem("four")
m.changed = function(self)
print("multi state changed:", self.value, self.selectedText)
end

Constructor & Destructor Documentation

MultiStateButton::MultiStateButton ( string  name,
table  entries 
)

creates a menu widget on the user inteface.

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

Member Function Documentation

int MultiStateButton::addItem ( string  name)

add a menu item.

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

setItem text for given index.

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