Vital
Loading...
Searching...
No Matches
default_look_and_feel.h
Go to the documentation of this file.
1#pragma once
2
3#include "JuceHeader.h"
4
5class SynthSlider;
6
14class LeftAlignedScrollBar : public ScrollBar {
15public:
20 LeftAlignedScrollBar(bool vertical) : ScrollBar(vertical) { }
21};
22
31class DefaultLookAndFeel : public juce::LookAndFeel_V4 {
32public:
33 static constexpr int kPopupMenuBorder = 4;
34
37
42 virtual int getPopupMenuBorderSize() override { return kPopupMenuBorder; }
43
47 void drawTextEditorOutline(Graphics& g, int width, int height, TextEditor& text_editor) override { }
48
56 void fillTextEditorBackground(Graphics& g, int width, int height, TextEditor& text_editor) override;
57
64 void drawPopupMenuBackground(Graphics& g, int width, int height) override;
65
77 virtual void drawScrollbar(Graphics& g, ScrollBar& scroll_bar, int x, int y, int width, int height,
78 bool vertical, int thumb_position, int thumb_size,
79 bool mouse_over, bool mouse_down) override;
80
90 void drawComboBox(Graphics& g, int width, int height, const bool button_down,
91 int button_x, int button_y, int button_w, int button_h, ComboBox& box) override;
92
103 void drawTickBox(Graphics& g, Component& component,
104 float x, float y, float w, float h, bool ticked,
105 bool enabled, bool mouse_over, bool button_down) override;
106
114 void drawCallOutBoxBackground(CallOutBox& call_out_box, Graphics& g, const Path& path, Image&) override;
115
124 void drawButtonBackground(Graphics& g, Button& button, const Colour& background_color,
125 bool hover, bool down) override;
126
132 int getSliderPopupPlacement(Slider& slider) override;
133
138 Font getPopupMenuFont() override;
139
145 Font getSliderPopupFont(Slider& slider) override;
146
151 int getMenuWindowFlags() override { return 0; }
152
159 return &instance;
160 }
161
162protected:
165
166 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DefaultLookAndFeel)
167};
A base LookAndFeel class providing default styling for UI elements.
Definition default_look_and_feel.h:31
static DefaultLookAndFeel * instance()
Singleton instance accessor.
Definition default_look_and_feel.h:157
DefaultLookAndFeel()
Protected constructor to enforce singleton usage.
Definition default_look_and_feel.cpp:8
static constexpr int kPopupMenuBorder
Border size for popup menus.
Definition default_look_and_feel.h:33
virtual void drawScrollbar(Graphics &g, ScrollBar &scroll_bar, int x, int y, int width, int height, bool vertical, int thumb_position, int thumb_size, bool mouse_over, bool mouse_down) override
Draws a custom scrollbar, potentially aligned differently if it's a LeftAlignedScrollBar.
Definition default_look_and_feel.cpp:41
virtual int getPopupMenuBorderSize() override
Returns the border size for popup menus.
Definition default_look_and_feel.h:42
void drawCallOutBoxBackground(CallOutBox &call_out_box, Graphics &g, const Path &path, Image &) override
Draws the background of a CallOutBox with a simple rounded rectangle and stroke.
Definition default_look_and_feel.cpp:91
int getSliderPopupPlacement(Slider &slider) override
Gets the popup placement for a slider. Delegates to SynthSlider if present.
Definition default_look_and_feel.cpp:105
int getMenuWindowFlags() override
Returns the window flags for menu windows. Defaults to 0.
Definition default_look_and_feel.h:151
void drawPopupMenuBackground(Graphics &g, int width, int height) override
Draws the background for a popup menu with a rounded rectangle and border.
Definition default_look_and_feel.cpp:34
Font getSliderPopupFont(Slider &slider) override
Returns the font to use for slider popup text.
Definition default_look_and_feel.cpp:117
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 (check box) with a filled rectangle if ticked.
Definition default_look_and_feel.cpp:78
void drawTextEditorOutline(Graphics &g, int width, int height, TextEditor &text_editor) override
Draws no outline for TextEditors by default.
Definition default_look_and_feel.h:47
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
~DefaultLookAndFeel()
Destructor.
Definition default_look_and_feel.h:36
void drawButtonBackground(Graphics &g, Button &button, const Colour &background_color, bool hover, bool down) override
Draws the background of a generic button, using a rounded rectangle.
Definition default_look_and_feel.cpp:99
void fillTextEditorBackground(Graphics &g, int width, int height, TextEditor &text_editor) override
Fills the background of a TextEditor with a rounded rectangle and border.
Definition default_look_and_feel.cpp:19
Font getPopupMenuFont() override
Returns the font to use for popup menus.
Definition default_look_and_feel.cpp:113
A ScrollBar variant that is aligned to the left side when vertical.
Definition default_look_and_feel.h:14
LeftAlignedScrollBar(bool vertical)
Constructs a LeftAlignedScrollBar.
Definition default_look_and_feel.h:20
A specialized slider with extended functionality for modulation, parameter control,...
Definition synth_slider.h:314