feat(gui): add GUI components and displays
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user