1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Slider: LookAndFeel outline style

This commit is contained in:
Oliver James 2023-03-20 14:52:59 +00:00
parent d264d95595
commit 9d909fc3fe
7 changed files with 31 additions and 6 deletions

View file

@ -465,6 +465,9 @@ void LookAndFeel_V1::drawLinearSlider (Graphics& g,
fill, outline); fill, outline);
} }
} }
if (slider.isBar())
drawLinearSliderOutline (g, x, y, w, h, style, slider);
} }
Button* LookAndFeel_V1::createSliderButton (Slider&, const bool isIncrement) Button* LookAndFeel_V1::createSliderButton (Slider&, const bool isIncrement)

View file

@ -1373,6 +1373,16 @@ void LookAndFeel_V2::drawLinearSliderBackground (Graphics& g, int x, int y, int
g.strokePath (indent, PathStrokeType (0.5f)); g.strokePath (indent, PathStrokeType (0.5f));
} }
void LookAndFeel_V2::drawLinearSliderOutline (Graphics& g, int, int, int width, int height,
const Slider::SliderStyle, Slider& slider)
{
if (slider.getTextBoxPosition() == Slider::NoTextBox)
{
g.setColour (slider.findColour (Slider::textBoxOutlineColourId));
g.drawRect (0, 0, width, height, 1);
}
}
void LookAndFeel_V2::drawLinearSliderThumb (Graphics& g, int x, int y, int width, int height, void LookAndFeel_V2::drawLinearSliderThumb (Graphics& g, int x, int y, int width, int height,
float sliderPos, float minSliderPos, float maxSliderPos, float sliderPos, float minSliderPos, float maxSliderPos,
const Slider::SliderStyle style, Slider& slider) const Slider::SliderStyle style, Slider& slider)
@ -1487,6 +1497,8 @@ void LookAndFeel_V2::drawLinearSlider (Graphics& g, int x, int y, int width, int
baseColour, baseColour,
slider.isEnabled() ? 0.9f : 0.3f, slider.isEnabled() ? 0.9f : 0.3f,
true, true, true, true); true, true, true, true);
drawLinearSliderOutline (g, x, y, width, height, style, slider);
} }
else else
{ {

View file

@ -248,6 +248,10 @@ public:
float sliderPos, float minSliderPos, float maxSliderPos, float sliderPos, float minSliderPos, float maxSliderPos,
const Slider::SliderStyle, Slider&) override; const Slider::SliderStyle, Slider&) override;
void drawLinearSliderOutline (Graphics&, int x, int y, int width, int height,
const Slider::SliderStyle, Slider&) override;
void drawLinearSliderThumb (Graphics&, int x, int y, int width, int height, void drawLinearSliderThumb (Graphics&, int x, int y, int width, int height,
float sliderPos, float minSliderPos, float maxSliderPos, float sliderPos, float minSliderPos, float maxSliderPos,
const Slider::SliderStyle, Slider&) override; const Slider::SliderStyle, Slider&) override;

View file

@ -420,6 +420,8 @@ void LookAndFeel_V3::drawLinearSlider (Graphics& g, int x, int y, int width, int
g.fillRect (fx, sliderPos, fw, 1.0f); g.fillRect (fx, sliderPos, fw, 1.0f);
else else
g.fillRect (sliderPos, fy, 1.0f, fh); g.fillRect (sliderPos, fy, 1.0f, fh);
drawLinearSliderOutline (g, x, y, width, height, style, slider);
} }
else else
{ {

View file

@ -956,6 +956,8 @@ void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int
g.setColour (slider.findColour (Slider::trackColourId)); g.setColour (slider.findColour (Slider::trackColourId));
g.fillRect (slider.isHorizontal() ? Rectangle<float> (static_cast<float> (x), (float) y + 0.5f, sliderPos - (float) x, (float) height - 1.0f) g.fillRect (slider.isHorizontal() ? Rectangle<float> (static_cast<float> (x), (float) y + 0.5f, sliderPos - (float) x, (float) height - 1.0f)
: Rectangle<float> ((float) x + 0.5f, sliderPos, (float) width - 1.0f, (float) y + ((float) height - sliderPos))); : Rectangle<float> ((float) x + 0.5f, sliderPos, (float) width - 1.0f, (float) y + ((float) height - sliderPos)));
drawLinearSliderOutline (g, x, y, width, height, style, slider);
} }
else else
{ {
@ -1038,6 +1040,9 @@ void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int
trackWidth * 2.0f, pointerColour, 3); trackWidth * 2.0f, pointerColour, 3);
} }
} }
if (slider.isBar())
drawLinearSliderOutline (g, x, y, width, height, style, slider);
} }
} }

View file

@ -1242,12 +1242,6 @@ public:
getLinearSliderPos (lastValueMax), getLinearSliderPos (lastValueMax),
style, owner); style, owner);
} }
if ((style == LinearBar || style == LinearBarVertical) && valueBox == nullptr)
{
g.setColour (owner.findColour (Slider::textBoxOutlineColourId));
g.drawRect (0, 0, owner.getWidth(), owner.getHeight(), 1);
}
} }
} }

View file

@ -932,6 +932,11 @@ public:
const Slider::SliderStyle style, const Slider::SliderStyle style,
Slider&) = 0; Slider&) = 0;
virtual void drawLinearSliderOutline (Graphics&,
int x, int y, int width, int height,
const Slider::SliderStyle,
Slider&) = 0;
virtual void drawLinearSliderThumb (Graphics&, virtual void drawLinearSliderThumb (Graphics&,
int x, int y, int width, int height, int x, int y, int width, int height,
float sliderPos, float sliderPos,