Classes | Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
ControlButton Class Referenceabstract

Represents a button on a block device. More...

Classes

struct  Listener
 A listener that can be attached to a ControlButton object so that it gets called when the button is pushed or released. More...
 

Public Types

enum  ButtonFunction {
  mode, volume, up, down,
  scale, chord, arp, sustain,
  octave, love, click, snap,
  back, playOrPause, record, learn,
  button0, button1, button2, button3,
  button4, button5, button6, button7,
  velocitySensitivity, glideSensitivity, slideSensitivity, pressSensitivity,
  liftSensitivity, fixedVelocity, glideLock, pianoMode
}
 These are all known types of control buttons. More...
 

Public Member Functions

 ControlButton (Block &)
 
virtual ~ControlButton ()
 Destructor. More...
 
virtual ButtonFunction getType () const =0
 Returns the button's type. More...
 
virtual String getName () const =0
 Returns the button's description. More...
 
virtual float getPositionX () const =0
 Returns the position of this button on the device, in device units. More...
 
virtual float getPositionY () const =0
 Returns the position of this button on the device, in device units. More...
 
virtual bool hasLight () const =0
 Returns true if this button has a controllable light. More...
 
virtual bool setLightColour (LEDColour newColour)=0
 If the button can light-up, this sets its colour. More...
 
void addListener (Listener *)
 Adds a listener to the control button. More...
 
void removeListener (Listener *)
 Removes a listener from the control button. More...
 

Public Attributes

Blockblock
 The control block that this button belongs to. More...
 

Protected Attributes

ListenerList< Listenerlisteners
 

Detailed Description

Represents a button on a block device.

Member Enumeration Documentation

◆ ButtonFunction

These are all known types of control buttons.

You can find out which buttons a device has by calling getButtons(), and can get the name of a button type with getButtonName().

Enumerator
mode 

The side button on a lightpad block and the first button on a live/loop block.

volume 

The volume button on a live/loop block.

up 

The up button on a control block.


down 

The down button on a control block.

scale 

The scale button on a live block.


chord 

The chord button on a live block.


arp 

The arp button on a live block.


sustain 

The sustain button on a live block.

octave 

The octave button on a live block.


love 

The love button on a live block.


click 

The click button on a loop block.


snap 

The snap button on a loop block.


back 

The back button on a loop block.


playOrPause 

The play or pause button on a loop block.

record 

The record button on a loop block.


learn 

The learn button on a loop block.


button0 

Button 0 on a developer block.

button1 

Button 1 on a developer block.

button2 

Button 2 on a developer block.

button3 

Button 3 on a developer block.

button4 

Button 4 on a developer block.

button5 

Button 5 on a developer block.

button6 

Button 6 on a developer block.

button7 

Button 7 on a developer block.

velocitySensitivity 

The velocity sensitivity button on a touch block.

glideSensitivity 

The glide sensitivity button on a touch block.


slideSensitivity 

The slide sensitivity button on a touch block.


pressSensitivity 

The press sensitivity button on a touch block.


liftSensitivity 

The lift sensitivity button on a touch block.


fixedVelocity 

The fixed velocity button on a touch block.


glideLock 

The glide lock button on a touch block.


pianoMode 

The piano mode button on a touch block.


Constructor & Destructor Documentation

◆ ControlButton()

ControlButton::ControlButton ( Block )

◆ ~ControlButton()

virtual ControlButton::~ControlButton ( )
virtual

Destructor.

Member Function Documentation

◆ getType()

virtual ButtonFunction ControlButton::getType ( ) const
pure virtual

Returns the button's type.

◆ getName()

virtual String ControlButton::getName ( ) const
pure virtual

Returns the button's description.

◆ getPositionX()

virtual float ControlButton::getPositionX ( ) const
pure virtual

Returns the position of this button on the device, in device units.

For buttons that are on the side of the device, this may want to return a value that is beyond the physical block size.

◆ getPositionY()

virtual float ControlButton::getPositionY ( ) const
pure virtual

Returns the position of this button on the device, in device units.

For buttons that are on the side of the device, this may want to return a value that is beyond the physical block size.

◆ hasLight()

virtual bool ControlButton::hasLight ( ) const
pure virtual

Returns true if this button has a controllable light.

◆ setLightColour()

virtual bool ControlButton::setLightColour ( LEDColour  newColour)
pure virtual

If the button can light-up, this sets its colour.

◆ addListener()

void ControlButton::addListener ( Listener )

Adds a listener to the control button.

◆ removeListener()

void ControlButton::removeListener ( Listener )

Removes a listener from the control button.

Member Data Documentation

◆ block

Block& ControlButton::block

The control block that this button belongs to.

◆ listeners

ListenerList<Listener> ControlButton::listeners
protected

The documentation for this class was generated from the following file: