JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::ComboBoxParameterAttachment Class Reference

An object of this class maintains a connection between a ComboBox and a plug-in parameter. More...

#include <juce_ParameterAttachments.h>

Inheritance diagram for juce::ComboBoxParameterAttachment:
Collaboration diagram for juce::ComboBoxParameterAttachment:

Public Member Functions

 ComboBoxParameterAttachment (RangedAudioParameter &parameter, ComboBox &combo, UndoManager *undoManager=nullptr)
 Creates a connection between a plug-in parameter and a ComboBox. More...
 
 ~ComboBoxParameterAttachment () override
 Destructor. More...
 
void sendInitialUpdate ()
 Call this after setting up your combo box in the case where you need to do extra setup after constructing this attachment. More...
 

Private Member Functions

void comboBoxChanged (ComboBox *) override
 Called when a ComboBox has its selected item changed. More...
 
void setValue (float newValue)
 

Private Attributes

ParameterAttachment attachment
 
ComboBoxcomboBox
 
bool ignoreCallbacks = false
 
RangedAudioParameterstoredParameter
 

Detailed Description

An object of this class maintains a connection between a ComboBox and a plug-in parameter.

ComboBox items will be spaced linearly across the range of the parameter. For example if the range is specified by NormalisableRange<float> (-0.5f, 0.5f, 0.5f) and you add three items then the first will be mapped to a value of -0.5, the second to 0, and the third to 0.5.

During the lifetime of this object it keeps the two things in sync, making it easy to connect a combo box to a parameter. When this object is deleted, the connection is broken. Make sure that your parameter and ComboBox are not deleted before this object!

@tags{Audio}

Constructor & Destructor Documentation

◆ ComboBoxParameterAttachment()

juce::ComboBoxParameterAttachment::ComboBoxParameterAttachment ( RangedAudioParameter parameter,
ComboBox combo,
UndoManager undoManager = nullptr 
)

Creates a connection between a plug-in parameter and a ComboBox.

Parameters
parameterThe parameter to use
comboThe ComboBox to use
undoManagerAn optional UndoManager

◆ ~ComboBoxParameterAttachment()

juce::ComboBoxParameterAttachment::~ComboBoxParameterAttachment ( )
override

Destructor.

Member Function Documentation

◆ comboBoxChanged()

void juce::ComboBoxParameterAttachment::comboBoxChanged ( ComboBox comboBoxThatHasChanged)
overrideprivatevirtual

Called when a ComboBox has its selected item changed.

Implements juce::ComboBox::Listener.

◆ sendInitialUpdate()

void juce::ComboBoxParameterAttachment::sendInitialUpdate ( )

Call this after setting up your combo box in the case where you need to do extra setup after constructing this attachment.

◆ setValue()

void juce::ComboBoxParameterAttachment::setValue ( float  newValue)
private

Member Data Documentation

◆ attachment

ParameterAttachment juce::ComboBoxParameterAttachment::attachment
private

◆ comboBox

ComboBox& juce::ComboBoxParameterAttachment::comboBox
private

◆ ignoreCallbacks

bool juce::ComboBoxParameterAttachment::ignoreCallbacks = false
private

◆ storedParameter

RangedAudioParameter& juce::ComboBoxParameterAttachment::storedParameter
private

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