uvi-script
Musical event scripting with Lua
MultiStateButton Class Reference

MultiStateButton widget. More...

Inheritance diagram for MultiStateButton:
ParamWidget Widget

Public Member Functions

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

Public Attributes

int length
 number of states (read-only)
 
int value
 selected index
 
int selected
 selected index
 
int default
 1-based index of the default state
 
string selectedText
 selected text (read-only)
 
string text
 selected text (read-only)
 
bool showPopupDisplay
 show/hide the value popup display (if any)
 
string backgroundImage
 path to the background image strip
 
string backgroundColour
 background colour: colour string that defines the desired colour.
 
string textColour
 text colour: colour string that defines the desired
 
- Public Attributes inherited from ParamWidget
Mapper::Type mapper
 Mapper type, default is Mapper.Linear.
 
Unit::Type unit
 Unit type, default is Unit.Generic.
 
int paramId
 parameter id, assigned automatically (read-only)
 
bool exported
 default: false, set it to true to export this parameter as an automatable parameter
 
- Public Attributes inherited from Widget
string name
 widget name, given at construction (read-only)
 
string displayName
 widget display name
 
string displayText
 custom text to display in place of the standard value display, on widgets that show one.
 
string tooltip
 widget tooltip, default is name
 
int x
 x position in pixels
 
int y
 y position in pixels
 
int width
 widget width in pixels
 
int height
 widget height in pixels
 
int w
 alias of width
 
int h
 alias of height
 
table size
 widget size {width, height}
 
table position
 widget position {x,y}
 
table pos
 alias of position
 
table bounds
 widget bounding rect {x,y,width,height}
 
number alpha
 transparency value between 0.0 and 1.0
 
bool enabled
 boolean flag to enable / disable the widget
 
bool visible
 boolean flag to toggle widget visibility
 
bool interceptsMouseClicks
 boolean flag to toggle mouse handling on widget.
 
bool showLabel
 show widgets label if any
 
bool persistent
 flag to tell if the widget values should be serialized when saving.
 
function changed
 callback function used by child widgets to be notified of changes.
 

Detailed Description

MultiStateButton widget.

creates a multi-state button widget on the user interface. Image properties support Retina @2x variants.

m = MultiStateButton("Multi", {"one", "two", "three"})
m:addItem("four")
m.changed = function(self)
print("multi state changed:", self.value, self.selectedText)
end
string selectedText
selected text (read-only)
Definition ui.cpp:1531
MultiStateButton(string name, table entries, int defaultValue)
creates a menu widget on the user interface.
void setValue(number value, bool callChangedCallback=true)
int value
selected index
Definition ui.cpp:1528
int addItem(string name)
add a menu item.
function changed
callback function used by child widgets to be notified of changes.
Definition ui.cpp:1001

Constructor & Destructor Documentation

◆ MultiStateButton()

MultiStateButton::MultiStateButton ( string name,
table entries,
int defaultValue )

creates a menu widget on the user interface.

Parameters
namethe name to give to the widget
entries(optional) array of strings to be displayed in the menu
defaultValue(optional) 1-based index of the initially selected entry, default is 1

Member Function Documentation

◆ addItem()

int MultiStateButton::addItem ( string name)

add a menu item.

Parameters
namenew menu item text
Returns
index of new menu item

◆ getText()

string MultiStateButton::getText ( int index)
Returns
the text for a given index, or an empty string if there is no such entry. Use selectedText for the text of the current state.
Parameters
index1-based state index

◆ setItem()

void MultiStateButton::setItem ( int index,
string name )

setItem text for given index.

Parameters
indexmenu item index to change
namenew menu item text

◆ setValue()

void MultiStateButton::setValue ( number value,
bool callChangedCallback = true )
Parameters
valuethe new widget's value
callChangedCallbackcall the changed callback function if true

Member Data Documentation

◆ backgroundColour

string MultiStateButton::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

◆ textColour

string MultiStateButton::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