feat(gui): add GUI components and displays

This commit is contained in:
2026-09-08 14:55:22 +02:00
parent 5a80534a2e
commit a9abca9e15
19 changed files with 898 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
#pragma once
#include <JuceHeader.h>
#include "../Resources.h"
namespace serum
{
// ===========================================================================
// LED-style toggle (power) button that drives a float parameter (0/1) or an
// optional callback (used by RAVE).
// ===========================================================================
class ToggleButton : public juce::Component
{
public:
explicit ToggleButton (const juce::String& label = {});
void attach (juce::AudioProcessorValueTreeState& apvts, const juce::String& paramId);
void setOnClick (std::function<void (bool)> cb) { onClick = std::move (cb); }
void setOnColour (juce::Colour c) { onColour = c; repaint(); }
void setLabel (const juce::String& lbl) { label = lbl; repaint(); }
void setToggleState (bool s);
bool getToggleState() const noexcept { return state; }
void paint (juce::Graphics& g) override;
void mouseDown (const juce::MouseEvent&) override;
private:
bool state = false;
juce::String label;
juce::RangedAudioParameter* param = nullptr;
std::unique_ptr<juce::ParameterAttachment> attachment;
std::function<void (bool)> onClick;
juce::Colour onColour = theme::accent;
};
} // namespace serum