/**************************************************************************
Copyright (C) 2019 Arnaud Champenois arthelion@free.fr
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**************************************************************************/
#pragma once
#include "../JuceLibraryCode/JuceHeader.h"
#include <vector>
class MolossI;
/*!
* Class embedded in each GUI component to manage attachment of parameters with each control
*
*/
class GuiAttachment {
public:
/*!
* Constructor of the attachment
* \param processor The processor the parameters belong to
*/
GuiAttachment(MolossI &processor);
/*!
* Destructor of the attachment
* Calls clearAttachment
*/
~GuiAttachment();
/*!
* Attaches a button to an AudioParameter and stores the attachement in "this"
*
* \param param The audio parameter to attach
* \param button The button to attach
*/
void attachButton(RangedAudioParameter*param, Button&button);
/*!
* Attaches a slider to an AudioParameter and stores the attachement in "this"
*
* \param param The audio parameter to attach
* \param slider The button to attach
*/
void attachSlider(RangedAudioParameter*param, Slider&slider);
/*!
* Attaches a combobox to an AudioParameter and stores the attachement in "this"
*
* \param param The audio parameter to attach
* \param combobox The button to attach
*/
void attachCombobox(AudioParameterChoice*param, ComboBox&combo);
/*!
* Clears all the attachements to Gui controllers stored in this parameter
*
*/
void clearAttachements();
void deleteComboAttachement(ComboBox&combo);
private:
std::vector<std::unique_ptr<AudioProcessorValueTreeState::ComboBoxAttachment>> mComboBoxArray;
std::vector<std::unique_ptr<AudioProcessorValueTreeState::SliderAttachment>> mSliderArray;
std::vector<std::unique_ptr<AudioProcessorValueTreeState::ButtonAttachment>> mButtonArray;
MolossI &mProcessor;
};