FahlGrahn Audio v1.0.0
Loading...
Searching...
No Matches
FontAudioLookAndFeel.h
1#pragma once
2
3#include <Fonts.h>
4#include <JuceHeader.h>
5
6class FontAudioLookAndFeel : public juce::LookAndFeel_V4
7{
8 public:
10 : fontAudio(juce::FontOptions(
11 juce::Typeface::createSystemTypefaceFor(BinaryData::fontaudio_ttf, BinaryData::fontaudio_ttfSize)))
12 {
13 }
14
15 juce::Font &getFont()
16 {
17 return fontAudio;
18 }
19
20 void drawButtonText(juce::Graphics &g, juce::TextButton &button, bool /*isMouseOverButton*/,
21 bool /*isButtonDown*/) override
22 {
23 auto font = fontAudio;
24 g.setFont(font.withHeight(static_cast<float>(button.getHeight())));
25
26 juce::Colour textColour;
27 if (button.getClickingTogglesState() && button.getToggleState())
28 textColour = button.findColour(juce::TextButton::textColourOnId);
29 else
30 textColour = button.findColour(juce::TextButton::textColourOffId);
31
32 g.setColour(textColour);
33
34 // juce::Colour backgroundColor;
35 // if (button.getClickingTogglesState() && button.getToggleState())
36 // backgroundColor = button.findColour(juce::TextButton::buttonOnColourId);
37 // else
38 // backgroundColor = button.findColour(juce::TextButton::buttonColourId);
39
40 button.setColour(juce::TextButton::ColourIds::buttonColourId, juce::Colours::black);
41
42 g.drawText(button.getButtonText(), button.getLocalBounds(), juce::Justification::centred, true);
43 }
44
45 // void drawButtonBackground(juce::Graphics &g, juce::Button &button, const juce::Colour &backgroundColour,
46 // bool isMouseOverButton, bool isButtonDown) override
47 // {
48 // // Do nothing, which means no background will be drawn.
49 // }
50
51 private:
52 juce::Font fontAudio;
53};
Definition FontAudioLookAndFeel.h:7