Browse Source

Slider: LookAndFeel outline style

v7.0.9
Oliver James 2 years ago
parent
commit
9d909fc3fe
7 changed files with 31 additions and 6 deletions
  1. +3
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V1.cpp
  2. +12
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp
  3. +4
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.h
  4. +2
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp
  5. +5
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp
  6. +0
    -6
      modules/juce_gui_basics/widgets/juce_Slider.cpp
  7. +5
    -0
      modules/juce_gui_basics/widgets/juce_Slider.h

+ 3
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V1.cpp View File

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


+ 12
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp View File

@@ -1373,6 +1373,16 @@ void LookAndFeel_V2::drawLinearSliderBackground (Graphics& g, int x, int y, int
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,
float sliderPos, float minSliderPos, float maxSliderPos,
const Slider::SliderStyle style, Slider& slider)
@@ -1487,6 +1497,8 @@ void LookAndFeel_V2::drawLinearSlider (Graphics& g, int x, int y, int width, int
baseColour,
slider.isEnabled() ? 0.9f : 0.3f,
true, true, true, true);
drawLinearSliderOutline (g, x, y, width, height, style, slider);
}
else
{


+ 4
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.h View File

@@ -248,6 +248,10 @@ public:
float sliderPos, float minSliderPos, float maxSliderPos,
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,
float sliderPos, float minSliderPos, float maxSliderPos,
const Slider::SliderStyle, Slider&) override;


+ 2
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp 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);
else
g.fillRect (sliderPos, fy, 1.0f, fh);
drawLinearSliderOutline (g, x, y, width, height, style, slider);
}
else
{


+ 5
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp 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.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)));
drawLinearSliderOutline (g, x, y, width, height, style, slider);
}
else
{
@@ -1038,6 +1040,9 @@ void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int
trackWidth * 2.0f, pointerColour, 3);
}
}
if (slider.isBar())
drawLinearSliderOutline (g, x, y, width, height, style, slider);
}
}


+ 0
- 6
modules/juce_gui_basics/widgets/juce_Slider.cpp View File

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


+ 5
- 0
modules/juce_gui_basics/widgets/juce_Slider.h View File

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


Loading…
Cancel
Save