upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)

This commit is contained in:
Alex Birch
2019-06-22 20:41:38 +01:00
parent d22c2cd4fa
commit 9ee566b251
1140 changed files with 67534 additions and 105952 deletions

View File

@ -32,7 +32,7 @@ static Typeface::Ptr getTypefaceForFontFromLookAndFeel (const Font& font)
return LookAndFeel::getDefaultLookAndFeel().getTypefaceForFont (font);
}
typedef Typeface::Ptr (*GetTypefaceForFont) (const Font&);
using GetTypefaceForFont = Typeface::Ptr (*)(const Font&);
extern GetTypefaceForFont juce_getTypefaceForFont;
//==============================================================================
@ -147,7 +147,7 @@ void LookAndFeel::setDefaultSansSerifTypefaceName (const String& newName)
{
if (defaultSans != newName)
{
defaultTypeface = {};
defaultTypeface.reset();
Typeface::clearTypefaceCache();
defaultSans = newName;
}

View File

@ -40,7 +40,7 @@ struct JUCE_API ExtraLookAndFeelBaseClasses
/** This abstract base class is implemented by LookAndFeel classes. */
struct JUCE_API LassoComponentMethods
{
virtual ~LassoComponentMethods() {}
virtual ~LassoComponentMethods() = default;
virtual void drawLasso (Graphics&, Component& lassoComp) = 0;
};
@ -49,7 +49,7 @@ struct JUCE_API ExtraLookAndFeelBaseClasses
/** This abstract base class is implemented by LookAndFeel classes. */
struct JUCE_API KeyMappingEditorComponentMethods
{
virtual ~KeyMappingEditorComponentMethods() {}
virtual ~KeyMappingEditorComponentMethods() = default;
virtual void drawKeymapChangeButton (Graphics&, int width, int height, Button&, const String& keyDescription) = 0;
};
@ -58,7 +58,7 @@ struct JUCE_API ExtraLookAndFeelBaseClasses
/** This abstract base class is implemented by LookAndFeel classes. */
struct JUCE_API AudioDeviceSelectorComponentMethods
{
virtual ~AudioDeviceSelectorComponentMethods() {}
virtual ~AudioDeviceSelectorComponentMethods() = default;
virtual void drawLevelMeter (Graphics&, int width, int height, float level) = 0;
};
@ -113,7 +113,7 @@ public:
LookAndFeel();
/** Destructor. */
virtual ~LookAndFeel();
~LookAndFeel() override;
//==============================================================================
/** Returns the current default look-and-feel for a component to use when it

View File

@ -52,7 +52,7 @@ LookAndFeel_V1::~LookAndFeel_V1()
//==============================================================================
void LookAndFeel_V1::drawButtonBackground (Graphics& g, Button& button, const Colour& backgroundColour,
bool isMouseOverButton, bool isButtonDown)
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
{
const int width = button.getWidth();
const int height = button.getHeight();
@ -69,9 +69,9 @@ void LookAndFeel_V1::drawButtonBackground (Graphics& g, Button& button, const Co
Colour bc (backgroundColour.withMultipliedSaturation (0.3f));
if (isMouseOverButton)
if (shouldDrawButtonAsHighlighted)
{
if (isButtonDown)
if (shouldDrawButtonAsDown)
bc = bc.brighter();
else if (bc.getBrightness() > 0.5f)
bc = bc.darker (0.1f);
@ -82,21 +82,21 @@ void LookAndFeel_V1::drawButtonBackground (Graphics& g, Button& button, const Co
g.setColour (bc);
g.fillPath (p);
g.setColour (bc.contrasting().withAlpha ((isMouseOverButton) ? 0.6f : 0.4f));
g.strokePath (p, PathStrokeType ((isMouseOverButton) ? 2.0f : 1.4f));
g.setColour (bc.contrasting().withAlpha ((shouldDrawButtonAsHighlighted) ? 0.6f : 0.4f));
g.strokePath (p, PathStrokeType ((shouldDrawButtonAsHighlighted) ? 2.0f : 1.4f));
}
void LookAndFeel_V1::drawTickBox (Graphics& g, Component& /*component*/,
float x, float y, float w, float h,
const bool ticked,
const bool isEnabled,
const bool /*isMouseOverButton*/,
const bool isButtonDown)
const bool /*shouldDrawButtonAsHighlighted*/,
const bool shouldDrawButtonAsDown)
{
Path box;
box.addRoundedRectangle (0.0f, 2.0f, 6.0f, 6.0f, 1.0f);
g.setColour (isEnabled ? Colours::blue.withAlpha (isButtonDown ? 0.3f : 0.1f)
g.setColour (isEnabled ? Colours::blue.withAlpha (shouldDrawButtonAsDown ? 0.3f : 0.1f)
: Colours::lightgrey.withAlpha (0.1f));
AffineTransform trans (AffineTransform::scale (w / 9.0f, h / 9.0f).translated (x, y));
@ -118,7 +118,7 @@ void LookAndFeel_V1::drawTickBox (Graphics& g, Component& /*component*/,
}
}
void LookAndFeel_V1::drawToggleButton (Graphics& g, ToggleButton& button, bool isMouseOverButton, bool isButtonDown)
void LookAndFeel_V1::drawToggleButton (Graphics& g, ToggleButton& button, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
{
if (button.hasKeyboardFocus (true))
{
@ -132,8 +132,8 @@ void LookAndFeel_V1::drawToggleButton (Graphics& g, ToggleButton& button, bool i
(float) tickWidth, (float) tickWidth,
button.getToggleState(),
button.isEnabled(),
isMouseOverButton,
isButtonDown);
shouldDrawButtonAsHighlighted,
shouldDrawButtonAsDown);
g.setColour (button.findColour (ToggleButton::textColourId));
g.setFont (jmin (15.0f, button.getHeight() * 0.6f));
@ -182,8 +182,8 @@ void LookAndFeel_V1::drawProgressBar (Graphics& g, ProgressBar& progressBar,
void LookAndFeel_V1::drawScrollbarButton (Graphics& g, ScrollBar& bar,
int width, int height, int buttonDirection,
bool isScrollbarVertical,
bool isMouseOverButton,
bool isButtonDown)
bool shouldDrawButtonAsHighlighted,
bool shouldDrawButtonAsDown)
{
if (isScrollbarVertical)
width -= 2;
@ -209,9 +209,9 @@ void LookAndFeel_V1::drawScrollbarButton (Graphics& g, ScrollBar& bar,
width * 0.7f, height * 0.1f,
width * 0.7f, height * 0.9f);
if (isButtonDown)
if (shouldDrawButtonAsDown)
g.setColour (Colours::white);
else if (isMouseOverButton)
else if (shouldDrawButtonAsHighlighted)
g.setColour (Colours::white.withAlpha (0.7f));
else
g.setColour (bar.findColour (ScrollBar::thumbColourId).withAlpha (0.5f));

View File

@ -38,16 +38,18 @@ class JUCE_API LookAndFeel_V1 : public LookAndFeel_V2
{
public:
LookAndFeel_V1();
~LookAndFeel_V1();
~LookAndFeel_V1() override;
//==============================================================================
void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour,
bool isMouseOverButton, bool isButtonDown) override;
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void drawToggleButton (Graphics&, ToggleButton&, bool isMouseOverButton, bool isButtonDown) override;
void drawToggleButton (Graphics&, ToggleButton&,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void drawTickBox (Graphics&, Component&, float x, float y, float w, float h,
bool ticked, bool isEnabled, bool isMouseOverButton, bool isButtonDown) override;
bool ticked, bool isEnabled,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void drawProgressBar (Graphics&, ProgressBar&, int width, int height,
double progress, const String& textToShow) override;
@ -55,7 +57,7 @@ public:
//==============================================================================
void drawScrollbarButton (Graphics&, ScrollBar&, int width, int height,
int buttonDirection, bool isScrollbarVertical,
bool isMouseOverButton, bool isButtonDown) override;
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void drawScrollbar (Graphics&, ScrollBar&, int x, int y, int width, int height,
bool isScrollbarVertical, int thumbStartPosition, int thumbSize,

View File

@ -31,14 +31,14 @@ namespace LookAndFeelHelpers
{
static Colour createBaseColour (Colour buttonColour,
bool hasKeyboardFocus,
bool isMouseOverButton,
bool isButtonDown) noexcept
bool shouldDrawButtonAsHighlighted,
bool shouldDrawButtonAsDown) noexcept
{
const float sat = hasKeyboardFocus ? 1.3f : 0.9f;
const Colour baseColour (buttonColour.withMultipliedSaturation (sat));
if (isButtonDown) return baseColour.contrasting (0.2f);
if (isMouseOverButton) return baseColour.contrasting (0.1f);
if (shouldDrawButtonAsDown) return baseColour.contrasting (0.2f);
if (shouldDrawButtonAsHighlighted) return baseColour.contrasting (0.1f);
return baseColour;
}
@ -239,13 +239,13 @@ LookAndFeel_V2::~LookAndFeel_V2() {}
void LookAndFeel_V2::drawButtonBackground (Graphics& g,
Button& button,
const Colour& backgroundColour,
bool isMouseOverButton,
bool isButtonDown)
bool shouldDrawButtonAsHighlighted,
bool shouldDrawButtonAsDown)
{
const int width = button.getWidth();
const int height = button.getHeight();
const float outlineThickness = button.isEnabled() ? ((isButtonDown || isMouseOverButton) ? 1.2f : 0.7f) : 0.4f;
const float outlineThickness = button.isEnabled() ? ((shouldDrawButtonAsDown || shouldDrawButtonAsHighlighted) ? 1.2f : 0.7f) : 0.4f;
const float halfThickness = outlineThickness * 0.5f;
const float indentL = button.isConnectedOnLeft() ? 0.1f : halfThickness;
@ -255,7 +255,8 @@ void LookAndFeel_V2::drawButtonBackground (Graphics& g,
const Colour baseColour (LookAndFeelHelpers::createBaseColour (backgroundColour,
button.hasKeyboardFocus (true),
isMouseOverButton, isButtonDown)
shouldDrawButtonAsHighlighted,
shouldDrawButtonAsDown)
.withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f));
drawGlassLozenge (g,
@ -280,7 +281,8 @@ int LookAndFeel_V2::getTextButtonWidthToFitText (TextButton& b, int buttonHeight
return getTextButtonFont (b, buttonHeight).getStringWidth (b.getButtonText()) + buttonHeight;
}
void LookAndFeel_V2::drawButtonText (Graphics& g, TextButton& button, bool /*isMouseOverButton*/, bool /*isButtonDown*/)
void LookAndFeel_V2::drawButtonText (Graphics& g, TextButton& button,
bool /*shouldDrawButtonAsHighlighted*/, bool /*shouldDrawButtonAsDown*/)
{
Font font (getTextButtonFont (button, button.getHeight()));
g.setFont (font);
@ -306,16 +308,16 @@ void LookAndFeel_V2::drawTickBox (Graphics& g, Component& component,
float x, float y, float w, float h,
const bool ticked,
const bool isEnabled,
const bool isMouseOverButton,
const bool isButtonDown)
const bool shouldDrawButtonAsHighlighted,
const bool shouldDrawButtonAsDown)
{
const float boxSize = w * 0.7f;
drawGlassSphere (g, x, y + (h - boxSize) * 0.5f, boxSize,
LookAndFeelHelpers::createBaseColour (component.findColour (TextButton::buttonColourId)
.withMultipliedAlpha (isEnabled ? 1.0f : 0.5f),
true, isMouseOverButton, isButtonDown),
isEnabled ? ((isButtonDown || isMouseOverButton) ? 1.1f : 0.5f) : 0.3f);
true, shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown),
isEnabled ? ((shouldDrawButtonAsDown || shouldDrawButtonAsHighlighted) ? 1.1f : 0.5f) : 0.3f);
if (ticked)
{
@ -335,7 +337,7 @@ void LookAndFeel_V2::drawTickBox (Graphics& g, Component& component,
}
void LookAndFeel_V2::drawToggleButton (Graphics& g, ToggleButton& button,
bool isMouseOverButton, bool isButtonDown)
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
{
if (button.hasKeyboardFocus (true))
{
@ -350,8 +352,8 @@ void LookAndFeel_V2::drawToggleButton (Graphics& g, ToggleButton& button,
tickWidth, tickWidth,
button.getToggleState(),
button.isEnabled(),
isMouseOverButton,
isButtonDown);
shouldDrawButtonAsHighlighted,
shouldDrawButtonAsDown);
g.setColour (button.findColour (ToggleButton::textColourId));
g.setFont (fontSize);
@ -377,7 +379,7 @@ void LookAndFeel_V2::changeToggleButtonWidthToFitText (ToggleButton& button)
}
void LookAndFeel_V2::drawDrawableButton (Graphics& g, DrawableButton& button,
bool /*isMouseOverButton*/, bool /*isButtonDown*/)
bool /*shouldDrawButtonAsHighlighted*/, bool /*shouldDrawButtonAsDown*/)
{
bool toggleState = button.getToggleState();
@ -644,8 +646,8 @@ bool LookAndFeel_V2::areScrollbarButtonsVisible()
void LookAndFeel_V2::drawScrollbarButton (Graphics& g, ScrollBar& scrollbar,
int width, int height, int buttonDirection,
bool /*isScrollbarVertical*/,
bool /*isMouseOverButton*/,
bool isButtonDown)
bool /*shouldDrawButtonAsHighlighted*/,
bool shouldDrawButtonAsDown)
{
Path p;
@ -666,7 +668,7 @@ void LookAndFeel_V2::drawScrollbarButton (Graphics& g, ScrollBar& scrollbar,
width * 0.7f, height * 0.1f,
width * 0.7f, height * 0.9f);
if (isButtonDown)
if (shouldDrawButtonAsDown)
g.setColour (scrollbar.findColour (ScrollBar::thumbColourId).contrasting (0.2f));
else
g.setColour (scrollbar.findColour (ScrollBar::thumbColourId));
@ -1132,7 +1134,7 @@ CaretComponent* LookAndFeel_V2::createCaretComponent (Component* keyFocusOwner)
}
//==============================================================================
void LookAndFeel_V2::drawComboBox (Graphics& g, int width, int height, const bool isButtonDown,
void LookAndFeel_V2::drawComboBox (Graphics& g, int width, int height, const bool isMouseButtonDown,
int buttonX, int buttonY, int buttonW, int buttonH, ComboBox& box)
{
g.fillAll (box.findColour (ComboBox::backgroundColourId));
@ -1148,11 +1150,11 @@ void LookAndFeel_V2::drawComboBox (Graphics& g, int width, int height, const boo
g.drawRect (0, 0, width, height);
}
auto outlineThickness = box.isEnabled() ? (isButtonDown ? 1.2f : 0.5f) : 0.3f;
auto outlineThickness = box.isEnabled() ? (isMouseButtonDown ? 1.2f : 0.5f) : 0.3f;
auto baseColour = LookAndFeelHelpers::createBaseColour (box.findColour (ComboBox::buttonColourId),
box.hasKeyboardFocus (true),
false, isButtonDown)
false, isMouseButtonDown)
.withMultipliedAlpha (box.isEnabled() ? 1.0f : 0.5f);
drawGlassLozenge (g,
@ -1199,6 +1201,30 @@ void LookAndFeel_V2::positionComboBoxText (ComboBox& box, Label& label)
label.setFont (getComboBoxFont (box));
}
PopupMenu::Options LookAndFeel_V2::getOptionsForComboBoxPopupMenu (ComboBox& box, Label& label)
{
return PopupMenu::Options().withTargetComponent (&box)
.withItemThatMustBeVisible (box.getSelectedId())
.withMinimumWidth (box.getWidth())
.withMaximumNumColumns (1)
.withStandardItemHeight (label.getHeight());
}
void LookAndFeel_V2::drawComboBoxTextWhenNothingSelected (Graphics& g, ComboBox& box, Label& label)
{
g.setColour (findColour (ComboBox::textColourId).withMultipliedAlpha (0.5f));
auto font = label.getLookAndFeel().getLabelFont (label);
g.setFont (font);
auto textArea = getLabelBorderSize (label).subtractedFrom (label.getLocalBounds());
g.drawFittedText (box.getTextWhenNothingSelected(), textArea, label.getJustificationType(),
jmax (1, (int) (textArea.getHeight() / font.getHeight())),
label.getMinimumHorizontalScale());
}
//==============================================================================
Font LookAndFeel_V2::getLabelFont (Label& label)
{
@ -1217,7 +1243,7 @@ void LookAndFeel_V2::drawLabel (Graphics& g, Label& label)
g.setColour (label.findColour (Label::textColourId).withMultipliedAlpha (alpha));
g.setFont (font);
Rectangle<int> textArea (label.getBorderSize().subtractedFrom (label.getLocalBounds()));
auto textArea = getLabelBorderSize (label).subtractedFrom (label.getLocalBounds());
g.drawFittedText (label.getText(), textArea, label.getJustificationType(),
jmax (1, (int) (textArea.getHeight() / font.getHeight())),
@ -1233,6 +1259,11 @@ void LookAndFeel_V2::drawLabel (Graphics& g, Label& label)
g.drawRect (label.getLocalBounds());
}
BorderSize<int> LookAndFeel_V2::getLabelBorderSize (Label& label)
{
return label.getBorderSize();
}
//==============================================================================
void LookAndFeel_V2::drawLinearSliderBackground (Graphics& g, int x, int y, int width, int height,
float /*sliderPos*/,
@ -1794,9 +1825,9 @@ public:
}
//==============================================================================
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) override
void paintButton (Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
{
float alpha = isMouseOverButton ? (isButtonDown ? 1.0f : 0.8f) : 0.55f;
float alpha = shouldDrawButtonAsHighlighted ? (shouldDrawButtonAsDown ? 1.0f : 0.8f) : 0.55f;
if (! isEnabled())
alpha *= 0.5f;
@ -2624,7 +2655,7 @@ void LookAndFeel_V2::layoutFileBrowserComponent (FileBrowserComponent& browserCo
//==============================================================================
static Drawable* createDrawableFromSVG (const char* data)
{
std::unique_ptr<XmlElement> xml (XmlDocument::parse (data));
auto xml = parseXML (data);
jassert (xml != nullptr);
return Drawable::createFromSVG (*xml);
}

View File

@ -39,25 +39,29 @@ class JUCE_API LookAndFeel_V2 : public LookAndFeel
{
public:
LookAndFeel_V2();
~LookAndFeel_V2();
~LookAndFeel_V2() override;
//==============================================================================
void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour,
bool isMouseOverButton, bool isButtonDown) override;
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
Font getTextButtonFont (TextButton&, int buttonHeight) override;
void drawButtonText (Graphics&, TextButton&, bool isMouseOverButton, bool isButtonDown) override;
void drawButtonText (Graphics&, TextButton&,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
int getTextButtonWidthToFitText (TextButton&, int buttonHeight) override;
void drawToggleButton (Graphics&, ToggleButton&, bool isMouseOverButton, bool isButtonDown) override;
void drawToggleButton (Graphics&, ToggleButton&,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void changeToggleButtonWidthToFitText (ToggleButton&) override;
void drawTickBox (Graphics&, Component&,
float x, float y, float w, float h,
bool ticked, bool isEnabled, bool isMouseOverButton, bool isButtonDown) override;
bool ticked, bool isEnabled,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void drawDrawableButton (Graphics&, DrawableButton&, bool isMouseOverButton, bool isButtonDown) override;
void drawDrawableButton (Graphics&, DrawableButton&,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
//==============================================================================
AlertWindow* createAlertWindow (const String& title, const String& message,
@ -98,7 +102,7 @@ public:
//==============================================================================
bool areScrollbarButtonsVisible() override;
void drawScrollbarButton (Graphics&, ScrollBar&, int width, int height, int buttonDirection,
bool isScrollbarVertical, bool isMouseOverButton, bool isButtonDown) override;
bool isScrollbarVertical, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void drawScrollbar (Graphics&, ScrollBar&, int x, int y, int width, int height,
bool isScrollbarVertical, int thumbStartPosition, int thumbSize,
@ -187,16 +191,19 @@ public:
int getPopupMenuBorderSize() override;
//==============================================================================
void drawComboBox (Graphics&, int width, int height, bool isButtonDown,
void drawComboBox (Graphics&, int width, int height, bool isMouseButtonDown,
int buttonX, int buttonY, int buttonW, int buttonH,
ComboBox&) override;
Font getComboBoxFont (ComboBox&) override;
Label* createComboBoxTextBox (ComboBox&) override;
void positionComboBoxText (ComboBox&, Label&) override;
PopupMenu::Options getOptionsForComboBoxPopupMenu (ComboBox&, Label&) override;
void drawComboBoxTextWhenNothingSelected (Graphics&, ComboBox&, Label&) override;
//==============================================================================
void drawLabel (Graphics&, Label&) override;
Font getLabelFont (Label&) override;
BorderSize<int> getLabelBorderSize (Label&) override;
//==============================================================================
void drawLinearSlider (Graphics&, int x, int y, int width, int height,

View File

@ -125,13 +125,13 @@ static void drawButtonShape (Graphics& g, const Path& outline, Colour baseColour
}
void LookAndFeel_V3::drawButtonBackground (Graphics& g, Button& button, const Colour& backgroundColour,
bool isMouseOverButton, bool isButtonDown)
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
{
Colour baseColour (backgroundColour.withMultipliedSaturation (button.hasKeyboardFocus (true) ? 1.3f : 0.9f)
.withMultipliedAlpha (button.isEnabled() ? 0.9f : 0.5f));
if (isButtonDown || isMouseOverButton)
baseColour = baseColour.contrasting (isButtonDown ? 0.2f : 0.1f);
if (shouldDrawButtonAsDown || shouldDrawButtonAsHighlighted)
baseColour = baseColour.contrasting (shouldDrawButtonAsDown ? 0.2f : 0.1f);
const bool flatOnLeft = button.isConnectedOnLeft();
const bool flatOnRight = button.isConnectedOnRight();
@ -158,7 +158,7 @@ void LookAndFeel_V3::drawButtonBackground (Graphics& g, Button& button, const Co
void LookAndFeel_V3::drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header)
{
Rectangle<int> r (header.getLocalBounds());
auto r = header.getLocalBounds();
auto outlineColour = header.findColour (TableHeaderComponent::outlineColourId);
g.setColour (outlineColour);
@ -353,7 +353,7 @@ int LookAndFeel_V3::getTreeViewIndentSize (TreeView&)
return 20;
}
void LookAndFeel_V3::drawComboBox (Graphics& g, int width, int height, const bool /*isButtonDown*/,
void LookAndFeel_V3::drawComboBox (Graphics& g, int width, int height, const bool /*isMouseButtonDown*/,
int buttonX, int buttonY, int buttonW, int buttonH, ComboBox& box)
{
g.fillAll (box.findColour (ComboBox::backgroundColourId));
@ -536,7 +536,7 @@ public:
{
}
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) override
void paintButton (Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
{
Colour background (Colours::grey);
@ -544,7 +544,7 @@ public:
background = rw->getBackgroundColour();
const float cx = getWidth() * 0.5f, cy = getHeight() * 0.5f;
const float diam = jmin (cx, cy) * (isButtonDown ? 0.60f : 0.65f);
const float diam = jmin (cx, cy) * (shouldDrawButtonAsDown ? 0.60f : 0.65f);
g.setColour (background);
g.fillEllipse (cx - diam, cy - diam, diam * 2.0f, diam * 2.0f);
@ -553,7 +553,7 @@ public:
if (! isEnabled())
c = c.withAlpha (0.6f);
else if (isMouseOverButton)
else if (shouldDrawButtonAsHighlighted)
c = c.brighter();
g.setColour (c);

View File

@ -38,11 +38,11 @@ class JUCE_API LookAndFeel_V3 : public LookAndFeel_V2
{
public:
LookAndFeel_V3();
~LookAndFeel_V3();
~LookAndFeel_V3() override;
//==============================================================================
void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour,
bool isMouseOverButton, bool isButtonDown) override;
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void drawTableHeaderBackground (Graphics&, TableHeaderComponent&) override;

View File

@ -115,7 +115,7 @@ public:
{
}
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) override
void paintButton (Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
{
auto background = Colours::grey;
@ -125,10 +125,10 @@ public:
g.fillAll (background);
g.setColour ((! isEnabled() || isButtonDown) ? colour.withAlpha (0.6f)
g.setColour ((! isEnabled() || shouldDrawButtonAsDown) ? colour.withAlpha (0.6f)
: colour);
if (isMouseOverButton)
if (shouldDrawButtonAsHighlighted)
{
g.fillAll();
g.setColour (background);
@ -284,8 +284,8 @@ Font LookAndFeel_V4::getTextButtonFont (TextButton&, int buttonHeight)
void LookAndFeel_V4::drawButtonBackground (Graphics& g,
Button& button,
const Colour& backgroundColour,
bool isMouseOverButton,
bool isButtonDown)
bool shouldDrawButtonAsHighlighted,
bool shouldDrawButtonAsDown)
{
auto cornerSize = 6.0f;
auto bounds = button.getLocalBounds().toFloat().reduced (0.5f, 0.5f);
@ -293,8 +293,8 @@ void LookAndFeel_V4::drawButtonBackground (Graphics& g,
auto baseColour = backgroundColour.withMultipliedSaturation (button.hasKeyboardFocus (true) ? 1.3f : 0.9f)
.withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f);
if (isButtonDown || isMouseOverButton)
baseColour = baseColour.contrasting (isButtonDown ? 0.2f : 0.05f);
if (shouldDrawButtonAsDown || shouldDrawButtonAsHighlighted)
baseColour = baseColour.contrasting (shouldDrawButtonAsDown ? 0.2f : 0.05f);
g.setColour (baseColour);
@ -324,7 +324,7 @@ void LookAndFeel_V4::drawButtonBackground (Graphics& g,
}
void LookAndFeel_V4::drawToggleButton (Graphics& g, ToggleButton& button,
bool isMouseOverButton, bool isButtonDown)
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
{
auto fontSize = jmin (15.0f, button.getHeight() * 0.75f);
auto tickWidth = fontSize * 1.1f;
@ -333,8 +333,8 @@ void LookAndFeel_V4::drawToggleButton (Graphics& g, ToggleButton& button,
tickWidth, tickWidth,
button.getToggleState(),
button.isEnabled(),
isMouseOverButton,
isButtonDown);
shouldDrawButtonAsHighlighted,
shouldDrawButtonAsDown);
g.setColour (button.findColour (ToggleButton::textColourId));
g.setFont (fontSize);
@ -352,10 +352,10 @@ void LookAndFeel_V4::drawTickBox (Graphics& g, Component& component,
float x, float y, float w, float h,
const bool ticked,
const bool isEnabled,
const bool isMouseOverButton,
const bool isButtonDown)
const bool shouldDrawButtonAsHighlighted,
const bool shouldDrawButtonAsDown)
{
ignoreUnused (isEnabled, isMouseOverButton, isButtonDown);
ignoreUnused (isEnabled, shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown);
Rectangle<float> tickBounds (x, y, w, h);
@ -1152,8 +1152,6 @@ void LookAndFeel_V4::drawConcertinaPanelHeader (Graphics& g, const Rectangle<int
p.addRoundedRectangle (bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(),
cornerSize, cornerSize, isTopPanel, isTopPanel, false, false);
auto bkg = Colours::grey;
g.setGradientFill (ColourGradient::vertical (Colours::white.withAlpha (isMouseOver ? 0.4f : 0.2f), static_cast<float> (area.getY()),
Colours::darkgrey.withAlpha (0.1f), static_cast<float> (area.getBottom())));
g.fillPath (p);

View File

@ -95,7 +95,7 @@ public:
LookAndFeel_V4 (ColourScheme);
/** Destructor. */
~LookAndFeel_V4();
~LookAndFeel_V4() override;
//==============================================================================
void setColourScheme (ColourScheme);
@ -115,12 +115,14 @@ public:
Font getTextButtonFont (TextButton&, int buttonHeight) override;
void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour,
bool isMouseOverButton, bool isButtonDown) override;
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void drawToggleButton (Graphics&, ToggleButton&, bool isMouseOverButton, bool isButtonDown) override;
void drawToggleButton (Graphics&, ToggleButton&,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void drawTickBox (Graphics&, Component&,
float x, float y, float w, float h,
bool ticked, bool isEnabled, bool isMouseOverButton, bool isButtonDown) override;
bool ticked, bool isEnabled,
bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override;
void changeToggleButtonWidthToFitText (ToggleButton&) override;