Vital
Loading...
Searching...
No Matches
SynthButton Class Reference

A specialized OpenGlToggleButton with additional functionality for the Vital synth. More...

#include <synth_button.h>

Inheritance diagram for SynthButton:
OpenGlToggleButton BypassButton

Classes

class  ButtonListener
 Interface for objects interested in changes to SynthButton state. More...
 

Public Types

enum  MenuId { kCancel = 0 , kArmMidiLearn , kClearMidiLearn }
 Possible menu IDs for popup operations. More...
 

Public Member Functions

 SynthButton (String name)
 
void setStringLookup (const std::string *lookup)
 
const std::string * getStringLookup () const
 
String getTextFromValue (bool value)
 
void handlePopupResult (int result)
 
virtual void mouseDown (const MouseEvent &e) override
 
virtual void mouseUp (const MouseEvent &e) override
 
void addButtonListener (ButtonListener *listener)
 
virtual void clicked () override
 Called when the button is clicked.
 
- Public Member Functions inherited from OpenGlToggleButton
 OpenGlToggleButton (String name)
 
OpenGlButtonComponentgetGlComponent ()
 
void setActive (bool active=true)
 
bool isActive () const
 
void resized () override
 Called when the button is resized, adjusts text size and colors accordingly.
 
void setText (String text)
 
void setPowerButton ()
 Configures the button as a power button.
 
void setNoBackground ()
 Removes the background, showing just text.
 
void setJustification (Justification justification)
 
void setLightenButton ()
 Configures the button as a lighten button.
 
void setShowOnColors (bool show)
 
void setUiButton (bool primary)
 
virtual void enablementChanged () override
 Called when the button enablement changes.
 
void mouseEnter (const MouseEvent &e) override
 
void mouseExit (const MouseEvent &e) override
 
void mouseDown (const MouseEvent &e) override
 
void mouseUp (const MouseEvent &e) override
 

Detailed Description

A specialized OpenGlToggleButton with additional functionality for the Vital synth.

This button supports MIDI learn operations and can display different text or behavior depending on whether it is toggled. It also notifies registered ButtonListeners of changes.

Member Enumeration Documentation

◆ MenuId

Possible menu IDs for popup operations.

Enumerator
kCancel 
kArmMidiLearn 
kClearMidiLearn 

Constructor & Destructor Documentation

◆ SynthButton()

SynthButton::SynthButton ( String name)

Constructor.

Parameters
nameThe name of the button, often tied to a parameter.

SynthButton constructor.

Parameters
nameThe name associated with the button, often a parameter name.

Member Function Documentation

◆ addButtonListener()

void SynthButton::addButtonListener ( SynthButton::ButtonListener * listener)

Adds a button listener to be notified of changes.

Parameters
listenerThe ButtonListener to add.

Adds a listener to be notified of state changes.

Parameters
listenerA pointer to the ButtonListener to add.

◆ clicked()

virtual void SynthButton::clicked ( )
inlineoverridevirtual

Called when the button is clicked.

◆ getStringLookup()

const std::string * SynthButton::getStringLookup ( ) const
inline

Gets the string lookup array.

Returns
The string lookup array set by setStringLookup().

◆ getTextFromValue()

String SynthButton::getTextFromValue ( bool on)

Retrieves the text corresponding to the on/off state.

Parameters
valueTrue for on, false for off.
Returns
The corresponding text string.

Retrieves the text corresponding to the on/off state from the optional string lookup.

Parameters
onTrue for on, false for off.
Returns
The corresponding text.

◆ handlePopupResult()

void SynthButton::handlePopupResult ( int result)

Handles the result of the popup menu selection.

Parameters
resultThe selected menu ID.

Handles the popup menu result.

Parameters
resultThe selected menu ID.

◆ mouseDown()

void SynthButton::mouseDown ( const MouseEvent & e)
overridevirtual

Called when the mouse is pressed down on the button.

Parameters
eThe mouse event.

Called when the mouse is pressed down. Shows a popup menu if right-clicked, otherwise begins a parameter change gesture.

Parameters
eThe mouse event.

◆ mouseUp()

void SynthButton::mouseUp ( const MouseEvent & e)
overridevirtual

Called when the mouse is released from the button.

Parameters
eThe mouse event.

Called when the mouse is released. Ends a parameter change gesture if not a popup menu click.

Parameters
eThe mouse event.

◆ setStringLookup()

void SynthButton::setStringLookup ( const std::string * lookup)
inline

Sets a string lookup array for on/off text.

Parameters
lookupA pointer to an array of two std::string items: [offText, onText].

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