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

A base LookAndFeel class providing default styling for UI elements. More...

#include <default_look_and_feel.h>

Inheritance diagram for DefaultLookAndFeel:
CurveLookAndFeel TextLookAndFeel

Public Member Functions

 ~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 DefaultLookAndFeelinstance ()
 Singleton instance accessor.
 

Static Public Attributes

static constexpr int kPopupMenuBorder = 4
 Border size for popup menus.
 

Protected Member Functions

 DefaultLookAndFeel ()
 Protected constructor to enforce singleton usage.
 

Detailed Description

A base LookAndFeel class providing default styling for UI elements.

This LookAndFeel sets up background colors, borders, popup menus, scrollbars, combo boxes, and tick boxes with a consistent appearance. It also provides default fonts for popup menus and slider popups.

Constructor & Destructor Documentation

◆ ~DefaultLookAndFeel()

DefaultLookAndFeel::~DefaultLookAndFeel ( )
inline

Destructor.

◆ DefaultLookAndFeel()

DefaultLookAndFeel::DefaultLookAndFeel ( )
protected

Protected constructor to enforce singleton usage.

Member Function Documentation

◆ drawButtonBackground()

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

Parameters
gThe Graphics context.
buttonThe button to draw.
background_colorThe base background color.
hoverTrue if mouse is hovering the button.
downTrue if mouse is pressed down on the button.

◆ drawCallOutBoxBackground()

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

Parameters
call_out_boxThe CallOutBox to draw.
gThe Graphics context.
pathThe Path defining the callout shape.
unused_imageUnused parameter.

◆ drawComboBox()

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

Parameters
gThe Graphics context.
widthThe width of the ComboBox.
heightThe height of the ComboBox.
button_downTrue if the mouse is down on the combo box.
button_x,button_y,button_w,button_hThe button bounds within the combo box.
boxThe ComboBox to draw.

◆ drawPopupMenuBackground()

void DefaultLookAndFeel::drawPopupMenuBackground ( Graphics & g,
int width,
int height )
override

Draws the background for a popup menu with a rounded rectangle and border.

Parameters
gThe Graphics context.
widthThe width of the popup menu.
heightThe height of the popup menu.

◆ drawScrollbar()

void DefaultLookAndFeel::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 )
overridevirtual

Draws a custom scrollbar, potentially aligned differently if it's a LeftAlignedScrollBar.

Parameters
gThe Graphics context.
scroll_barThe ScrollBar to draw.
x,y,width,heightThe bounds of the scrollbar.
verticalTrue if vertical scrollbar, false if horizontal.
thumb_positionThe current thumb position.
thumb_sizeThe size of the thumb.
mouse_overTrue if mouse is over the scrollbar.
mouse_downTrue if mouse is clicked down on the scrollbar.

◆ drawTextEditorOutline()

void DefaultLookAndFeel::drawTextEditorOutline ( Graphics & g,
int width,
int height,
TextEditor & text_editor )
inlineoverride

Draws no outline for TextEditors by default.

◆ drawTickBox()

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

Parameters
gThe Graphics context.
componentReference to the parent component.
x,y,w,hThe bounds of the tick box.
tickedTrue if the box is checked.
enabledTrue if the box is enabled.
mouse_overTrue if mouse is hovering.
button_downTrue if mouse is clicked down.

◆ fillTextEditorBackground()

void DefaultLookAndFeel::fillTextEditorBackground ( Graphics & g,
int width,
int height,
TextEditor & text_editor )
override

Fills the background of a TextEditor with a rounded rectangle and border.

Parameters
gThe Graphics context.
widthThe width of the text editor.
heightThe height of the text editor.
text_editorReference to the TextEditor.

◆ getMenuWindowFlags()

int DefaultLookAndFeel::getMenuWindowFlags ( )
inlineoverride

Returns the window flags for menu windows. Defaults to 0.

Returns
The integer flags.

◆ getPopupMenuBorderSize()

virtual int DefaultLookAndFeel::getPopupMenuBorderSize ( )
inlineoverridevirtual

Returns the border size for popup menus.

Returns
The border size in pixels.

◆ getPopupMenuFont()

Font DefaultLookAndFeel::getPopupMenuFont ( )
override

Returns the font to use for popup menus.

Returns
The Font for popup menus.

◆ getSliderPopupFont()

Font DefaultLookAndFeel::getSliderPopupFont ( Slider & slider)
override

Returns the font to use for slider popup text.

Parameters
sliderReference to the slider.
Returns
The Font for the slider popup.

◆ getSliderPopupPlacement()

int DefaultLookAndFeel::getSliderPopupPlacement ( Slider & slider)
override

Gets the popup placement for a slider. Delegates to SynthSlider if present.

Parameters
sliderThe slider in question.
Returns
The popup placement flags.

◆ instance()

static DefaultLookAndFeel * DefaultLookAndFeel::instance ( )
inlinestatic

Singleton instance accessor.

Returns
Pointer to the single DefaultLookAndFeel instance.

Member Data Documentation

◆ kPopupMenuBorder

int DefaultLookAndFeel::kPopupMenuBorder = 4
staticconstexpr

Border size for popup menus.


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