diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp index 2cdf6c444d..c7e6baa3cf 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp @@ -2398,6 +2398,16 @@ void LookAndFeel::drawTableHeaderColumn (Graphics& g, const String& columnName, g.drawFittedText (columnName, textX, 0, rightOfText - textX, height, Justification::centredLeft, 1); } +//============================================================================== +void LookAndFeel::drawLasso (Graphics& g, Component& lassoComp) +{ + const int outlineThickness = 1; + + g.fillAll (lassoComp.findColour (0x1000440 /*lassoFillColourId*/)); + + g.setColour (lassoComp.findColour (0x1000441 /*lassoOutlineColourId*/)); + g.drawRect (lassoComp.getLocalBounds(), outlineThickness); +} //============================================================================== void LookAndFeel::paintToolbarBackground (Graphics& g, int w, int h, Toolbar& toolbar) diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.h b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.h index a0505a1938..2c24bb4103 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.h +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.h @@ -339,6 +339,9 @@ public: float tipX, float tipY, float boxX, float boxY, float boxW, float boxH); + //============================================================================== + virtual void drawLasso (Graphics& g, Component& lassoComp); + //============================================================================== /** Fills the background of a popup menu component. */ virtual void drawPopupMenuBackground (Graphics& g, int width, int height); diff --git a/modules/juce_gui_basics/mouse/juce_LassoComponent.h b/modules/juce_gui_basics/mouse/juce_LassoComponent.h index b6ffb8252d..9cf5377b09 100644 --- a/modules/juce_gui_basics/mouse/juce_LassoComponent.h +++ b/modules/juce_gui_basics/mouse/juce_LassoComponent.h @@ -102,9 +102,7 @@ class LassoComponent : public Component public: //============================================================================== /** Creates a Lasso component. */ - explicit LassoComponent (const int outlineThickness_ = 1) - : source (nullptr), - outlineThickness (outlineThickness_) + LassoComponent() : source (nullptr) { } @@ -212,10 +210,7 @@ public: /** @internal */ void paint (Graphics& g) { - g.fillAll (findColour (lassoFillColourId)); - - g.setColour (findColour (lassoOutlineColourId)); - g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness); + getLookAndFeel().drawLasso (g, *this); // this suggests that you've left a lasso comp lying around after the // mouse drag has finished.. Be careful to call endLasso() when you get a @@ -230,7 +225,6 @@ private: //============================================================================== Array originalSelection; LassoSource * source; - int outlineThickness; Point dragStartPos; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LassoComponent);