28 lines
790 B
C++
28 lines
790 B
C++
#pragma once
|
|
|
|
#include <JuceHeader.h>
|
|
#include "../Resources.h"
|
|
|
|
namespace serum
|
|
{
|
|
|
|
// ===========================================================================
|
|
// Rotary knob — a juce::Slider styled by SerumLookAndFeel. The value readout is
|
|
// formatted by a user-provided function via getTextFromValue().
|
|
// ===========================================================================
|
|
class Knob : public juce::Slider
|
|
{
|
|
public:
|
|
explicit Knob (const juce::String& name,
|
|
std::function<juce::String (float)> formatter = {});
|
|
|
|
void setFormatter (std::function<juce::String (float)> f) { formatter = std::move (f); }
|
|
|
|
juce::String getTextFromValue (double value) override;
|
|
|
|
private:
|
|
std::function<juce::String (float)> formatter;
|
|
};
|
|
|
|
} // namespace serum
|