9TextLookAndFeel::TextLookAndFeel() { }
12 float slider_t,
float start_angle,
float end_angle,
15 static constexpr float kTextPercentage = 0.5f;
18 float text_percentage = kTextPercentage;
20 String text = slider.getTextFromValue(slider.getValue());
22 float font_size = slider.getHeight() * text_percentage;
25 font_size = slider.getHeight() * text_percentage;
30 if (text_percentage == 0.0f)
36 text_color = text_color.withMultipliedAlpha(0.5f);
38 g.setColour(text_color);
39 g.setFont(
Fonts::instance()->proportional_light().withPointHeight(font_size));
40 g.drawText(text, x, y + std::round(offset), width, height, Justification::centred,
false);
45 static constexpr float kTextPercentage = 0.7f;
46 static constexpr float kTextShrinkage = 0.98f;
48 bool toggled = button.getToggleState();
50 const std::string* string_lookup =
nullptr;
56 if (toggled && string_lookup ==
nullptr) {
73 String text = button.getButtonText();
75 int index = toggled ? 1 : 0;
76 text = string_lookup[index];
80 float text_percentage = kTextPercentage;
82 text_percentage *= kTextShrinkage;
84 float font_size = button.getHeight() * text_percentage;
92 g.fillRoundedRectangle(button.getLocalBounds().toFloat(), rounding);
95 g.drawText(text, 0, 0, button.getWidth(), button.getHeight(), Justification::centred);
100 float x,
float y,
float w,
float h,
bool ticked,
101 bool enabled,
bool mouse_over,
bool button_down) {
103 float border_width = 1.5f;
105 g.setColour(Colours::red);
106 g.fillRect(x + 3 * border_width, y + 3 * border_width,
107 w - 6 * border_width, h - 6 * border_width);
114 label.setColour(Label::textColourId, text);
116 DefaultLookAndFeel::drawLabel(g, label);
120 int button_x,
int button_y,
int button_w,
int button_h, ComboBox& box) {
126 box.setColour(ComboBox::backgroundColourId, background);
127 box.setColour(ComboBox::arrowColourId, caret);
128 box.setColour(ComboBox::outlineColourId, Colours::transparentBlack);
129 box.setColour(ComboBox::textColourId, text);
void drawComboBox(Graphics &g, int width, int height, const bool button_down, int button_x, int button_y, int button_w, int button_h, ComboBox &box) override
Draws the background and arrow of a ComboBox.
Definition default_look_and_feel.cpp:66
static Fonts * instance()
Gets the singleton instance of the Fonts class.
Definition fonts.h:52
bool isActive() const
Definition synth_slider.h:172
@ kButtonFontSize
Definition skin.h:88
@ kTextComponentFontSize
Definition skin.h:86
@ kTextComponentOffset
Definition skin.h:85
@ kWidgetRoundedCorner
Definition skin.h:104
@ kIconButtonOff
Definition skin.h:185
@ kIconButtonOn
Definition skin.h:188
@ kIconButtonOffHover
Definition skin.h:186
@ kBodyText
Definition skin.h:133
@ kIconButtonOffPressed
Definition skin.h:187
@ kIconButtonOnPressed
Definition skin.h:190
@ kTextComponentBackground
Definition skin.h:147
@ kTextComponentText
Definition skin.h:148
@ kIconButtonOnHover
Definition skin.h:189
@ kTextEditorCaret
Definition skin.h:202
Base class for all synthesizer sections, providing UI layout, painting, and interaction logic.
Definition synth_section.h:193
float findValue(Skin::ValueId value_id) const
Finds a value in the skin overrides or from the parent if not found locally.
Definition synth_section.cpp:18
A specialized slider with extended functionality for modulation, parameter control,...
Definition synth_slider.h:314
float getTextHeightPercentage()
Definition synth_slider.h:588
float findValue(Skin::ValueId value_id) const override
Definition synth_slider.h:681
String getSliderTextFromValue(double value)
Definition synth_slider.cpp:387
void drawLabel(Graphics &g, Label &label) override
Draws a label with text-focused style.
Definition text_look_and_feel.cpp:111
void drawToggleButton(Graphics &g, ToggleButton &button, bool hover, bool is_down) override
Draws a toggle button with a text-centered style.
Definition text_look_and_feel.cpp:43
void drawComboBox(Graphics &g, int width, int height, bool is_down, int button_x, int button_y, int button_w, int button_h, ComboBox &box) override
Draws a combo box with text styling.
Definition text_look_and_feel.cpp:119
void drawRotarySlider(Graphics &g, int x, int y, int width, int height, float slider_t, float start_angle, float end_angle, Slider &slider) override
Draws a rotary slider using a text-focused design.
Definition text_look_and_feel.cpp:11
void drawTickBox(Graphics &g, Component &component, float x, float y, float w, float h, bool ticked, bool enabled, bool mouse_over, bool button_down) override
Draws a tick box (for checkboxes) with minimal text-focused styling.
Definition text_look_and_feel.cpp:99
Declares the SynthSlider and related classes, providing various slider styles and functionality in th...