Vital
Loading...
Searching...
No Matches
TextLookAndFeel Class Reference

A custom look and feel class that renders UI elements with text-focused styling. More...

#include <text_look_and_feel.h>

Inheritance diagram for TextLookAndFeel:
DefaultLookAndFeel

Public Member Functions

virtual ~TextLookAndFeel ()
 Destructor.
 
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.
 
void drawToggleButton (Graphics &g, ToggleButton &button, bool hover, bool is_down) override
 Draws a toggle button with a text-centered style.
 
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.
 
void drawLabel (Graphics &g, Label &label) override
 Draws a label with text-focused style.
 
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.
 
- Public Member Functions inherited from DefaultLookAndFeel
 ~DefaultLookAndFeel ()
 Destructor.
 
virtual int getPopupMenuBorderSize () override
 Returns the border size for popup menus.
 
void drawTextEditorOutline (Graphics &g, int width, int height, TextEditor &text_editor) override
 Draws no outline for TextEditors by default.
 
void fillTextEditorBackground (Graphics &g, int width, int height, TextEditor &text_editor) override
 Fills the background of a TextEditor with a rounded rectangle and border.
 
void drawPopupMenuBackground (Graphics &g, int width, int height) override
 Draws the background for a popup menu with a rounded rectangle and border.
 
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.
 
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.
 
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.
 
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.
 
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.
 
int getSliderPopupPlacement (Slider &slider) override
 Gets the popup placement for a slider. Delegates to SynthSlider if present.
 
Font getPopupMenuFont () override
 Returns the font to use for popup menus.
 
Font getSliderPopupFont (Slider &slider) override
 Returns the font to use for slider popup text.
 
int getMenuWindowFlags () override
 Returns the window flags for menu windows. Defaults to 0.
 

Static Public Member Functions

static TextLookAndFeelinstance ()
 Singleton instance access.
 
- Static Public Member Functions inherited from DefaultLookAndFeel
static DefaultLookAndFeelinstance ()
 Singleton instance accessor.
 

Additional Inherited Members

- Static Public Attributes inherited from DefaultLookAndFeel
static constexpr int kPopupMenuBorder = 4
 Border size for popup menus.
 
- Protected Member Functions inherited from DefaultLookAndFeel
 DefaultLookAndFeel ()
 Protected constructor to enforce singleton usage.
 

Detailed Description

A custom look and feel class that renders UI elements with text-focused styling.

This class overrides certain drawing methods to provide a more text-oriented aesthetic for sliders, toggle buttons, and combo boxes. It relies on text and font adjustments rather than heavy graphical elements.

Constructor & Destructor Documentation

◆ ~TextLookAndFeel()

virtual TextLookAndFeel::~TextLookAndFeel ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ drawComboBox()

void TextLookAndFeel::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.

Uses text and simple backgrounds rather than heavy graphics.

Parameters
gGraphics context.
widthWidth of the combo box.
heightHeight of the combo box.
is_downWhether the combo box button is pressed down.
button_xButton region x.
button_yButton region y.
button_wButton region width.
button_hButton region height.
boxThe combo box to draw.

◆ drawLabel()

void TextLookAndFeel::drawLabel ( Graphics & g,
Label & label )
override

Draws a label with text-focused style.

Sets the label's text color to match the general body text color.

Parameters
gGraphics context.
labelThe label to draw.

◆ drawRotarySlider()

void TextLookAndFeel::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.

Instead of showing a traditional rotary arc, this implementation draws text in the center to represent the slider's value.

Parameters
gGraphics context to draw into.
xLeft x-coordinate of slider area.
yTop y-coordinate of slider area.
widthWidth of the slider area.
heightHeight of the slider area.
slider_tCurrent slider value mapped 0.0 to 1.0.
start_angleStarting angle of the slider arc (unused).
end_angleEnding angle of the slider arc (unused).
sliderThe slider to draw.

◆ drawTickBox()

void TextLookAndFeel::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.

By default, only changes appear if toggled (e.g., filling a rectangle).

Parameters
gGraphics context.
componentThe parent component of the tick box.
xLeft x-coordinate of the tick box.
yTop y-coordinate of the tick box.
wWidth of the tick box.
hHeight of the tick box.
tickedWhether the box is ticked.
enabledWhether the box is enabled.
mouse_overWhether the mouse is over the box.
button_downWhetherthe box is pressed.

◆ drawToggleButton()

void TextLookAndFeel::drawToggleButton ( Graphics & g,
ToggleButton & button,
bool hover,
bool is_down )
override

Draws a toggle button with a text-centered style.

The button appearance changes based on toggle state, hover, and pressed states. If associated with a SynthButton, it can lookup display strings from a provided array.

Parameters
gGraphics context.
buttonThe toggle button to draw.
hoverWhether the mouse is hovering over the button.
is_downWhether the button is currently pressed.

◆ instance()

static TextLookAndFeel * TextLookAndFeel::instance ( )
inlinestatic

Singleton instance access.

Returns
A pointer to the TextLookAndFeel instance.

The documentation for this class was generated from the following files: