AudioProcessorEditor : private juce::Button::Listener
{
public:
AudioProcessorEditor()
:mButtonPingPong(mPanelControl.getButtonPingPong())
{
mButtonPingPong.addListener(this);
}
private:
juce::Button& mButtonPingPong;
void buttonClicked(juce::Button* inButton) override;
}
The pure virtual function buttonClicked() should display only half of the delay panel.
void buttonClicked(juce::Button* inButton)
{
switch (inButton -> getCommandID())
{
case MyHelper::CmdIdButtons::PingPong:
{
mPanelDelay.setSize(MySize::Panel::Delay::Width,
inButton -> getToggleState() ? MySize::Panel::Delay::Height / 2:
MySize::Panel::Delay::Height );
mPanelDelay.repaint();
break;
}
default: break;
}
}
Using the component's pure virtual function resized(), redraw the delay panel at half-height whenever the ping-pong button is pressed.
EulerDelayAudioProcessorEditor():
{
mPanelPingPong.setVisible(mButtonPingPong.getToggleState());
}
In the constructor, detect the initial state when the plugin loads to decide whether to show the ping-pong panel.
void buttonClicked(juce::Button* inButton)
{
switch (inButton -> getCommandID())
{
case MyHelper::CmdIdButtons::PingPong:
{
mPanelPingPong.setVisible(mButtonPingPong.getToggleState());
break;
}
default: break;
}
}
Naturally, since the ping-pong panel should appear in the space freed by the delay panel when the button is pressed, this behavior is implemented in the buttonClicked() function.