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

2 states boolean button. More...

+ Inheritance diagram for OnOffButton:

Public Member Functions

 OnOffButton (string name, bool def)
 creates a stateful on/off button widget on the user inteface. More...
 
void setValue (bool value, bool callChangedCallback=true)
 

Public Attributes

number alpha
 transparency value between 0.0 and 1.0
 
string backgroundColourOff
 background colour Off: 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 backgroundColourOn
 background colour On: 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 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
 
bool exported
 default: false, set it to true to export this parameter as an automatable parameter.
 
string font
 path to TrueType font
 
number fontSize
 font size
 
int height
 widget height in pixels
 
bool interceptsMouseClicks
 boolean flag to toggle mouse handling on widget
 
Mapper::Type mapper
 Mapper type, default is Mapper.Linear.
 
string name
 widget name
 
string normalImage
 image path for normal buttonState
 
string overImage
 image path for over buttonState
 
string overPressedImage
 image path for over and pressed buttonState
 
int paramId
 parameter 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}
 
string pressedImage
 image path for pressed buttonState
 
bool showLabel
 show widgets label if any
 
table size
 widget size {width, height}
 
string textColourOff
 textColour Off: 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 textColourOn
 textColour On: 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
 
bool triggeredOnMouseDown
 Sets whether the button click should happen when the mouse is pressed or released. By default the button is only considered to have been clicked when the mouse is released.
 
Unit::Type unit
 Unit type, default is Unit.Generic.
 
bool value
 the button's state
 
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

2 states boolean button.

creates a stateful on/off button widget on the user inteface.

b = OnOffButton("button", false)
b.backgroundColourOff = "darkgrey"
b.backgroundColourOn = "darkred"
b.textColourOff = "white"
b.textColourOn = "white"
b.changed = function(self, mods)
print("button changed state:", self.value, mods.altDown)
end
Examples:
legato.lua.

Constructor & Destructor Documentation

OnOffButton::OnOffButton ( string  name,
bool  def 
)

creates a stateful on/off button widget on the user inteface.

Parameters
namethe name to give to the widget
defdefault value to give to the widget

Member Function Documentation

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