Files
serumalt/Source/GUI/ToggleButton.h
T
biggy 4b0db50271 refactor(source): move every implementation into its module directory
- 36 files move into the module whose AGENTS.md already claimed them:
  Engine/, Synth/, Modulation/, Params/, Plugin/, GUI/, EffectUnits/, Resources/
- Source/engine, modulation, params, plugin and synth become Engine,
  Modulation, Params, Plugin and Synth, matching the directories that already
  hold code
- ExactCompare.h stays at the Source/ root as the one shared header
- SERUMALT_INCLUDE_DIRS adds one include directory per module, so the 31
  parent-relative includes become plain names with no path prefix
- the module AGENTS.md files list owned files instead of describing a move
  that had not happened, and README.md and AGENTS.md describe the real tree

Verified: the harness passes CTest, the Linux VST3 and Standalone link, the
Windows cross-build passes its module checks, each configure exposes only its
own targets, no first-party warning line appears, and the generated Windows
manifest is unchanged.
2026-10-06 09:17:49 +02:00

44 lines
1.4 KiB
C++

#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).
//
// Inherits SettableTooltipClient so setTooltip() works exactly like it does on
// juce::Button / juce::Slider / juce::ComboBox (juce::Component itself has no
// tooltip support).
// ===========================================================================
class ToggleButton : public juce::Component,
public juce::SettableTooltipClient
{
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;
std::unique_ptr<juce::ParameterAttachment> attachment;
std::function<void (bool)> onClick;
juce::Colour onColour = theme::accent;
};
} // namespace serum