fsh::stk
fantastic spatial holophonic synthesis toolkit
Loading...
Searching...
No Matches
Switch.h
1/***************************************************************************************************
2 ██████ █████ █████ █████
3 ███░░███ ░░███ ░░███ ░░███
4 ░███ ░░░ █████ ░███████ ██ ██ █████ ███████ ░███ █████
5 ███████ ███░░ ░███░░███ ░░ ░░ ███░░ ░░░███░ ░███░░███
6 ░░░███░ ░░█████ ░███ ░███ ░░█████ ░███ ░██████░
7 ░███ ░░░░███ ░███ ░███ ░░░░███ ░███ ███ ░███░░███
8 █████ ██████ ████ █████ ██ ██ ██████ ░░█████ ████ █████
9 ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░ ░░ ░░░░░░ ░░░░░ ░░░░ ░░░░░
10
11 fantastic spatial holophonic synthesis tool kit
12
13 copyright (c) fabian hummel
14 www.github.com/fshstk
15 www.fshstk.com
16
17 this file is part of the fantastic spatial holophonic synthesis toolkit (fsh::stk)
18 fsh::stk is free software: it is provided under the terms of the gnu general public license v3.0
19 www.gnu.org/licenses/gpl-3.0
20***************************************************************************************************/
21
22#pragma once
23#include "Fonts.h"
24#include "StateManager.h"
25#include <juce_gui_basics/juce_gui_basics.h>
26
27namespace fsh::gui
28{
36class Switch : public juce::Button
37{
38public:
40 struct Params
41 {
42 juce::Colour color;
43 juce::Colour highlightColor;
44 };
45
47 explicit Switch(const Params&);
48
50 void attach(plugin::StateManager&, juce::ParameterID);
51
52private:
53 void paintButton(juce::Graphics&, bool isMouseOver, bool isDown) override;
54
55 std::unique_ptr<plugin::StateManager::ButtonAttachment> _attachment;
56 Params _params;
57 Fonts::Instance _fonts;
58};
59} // namespace fsh::gui
Custom Switch component that displays a toggle switch.
Definition Switch.h:37
Switch(const Params &)
Constructor.
Definition Switch.cpp:26
void attach(plugin::StateManager &, juce::ParameterID)
Attach this Switch to a parameter.
Definition Switch.cpp:49
Base class for storing plugin state.
Definition StateManager.h:39
juce::SharedResourcePointer< Fonts > Instance
Add this as a member to your component/editor class to access the fonts.
Definition Fonts.h:58
Parameters for the Switch component.
Definition Switch.h:41
juce::Colour highlightColor
The color of the glyph when selected.
Definition Switch.h:43
juce::Colour color
The color of the glyph when not selected.
Definition Switch.h:42