1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-04 03:40:07 +00:00

Changed LassoComponent to draw itself via the LookAndFeel.

This commit is contained in:
jules 2012-07-22 08:28:26 +01:00
parent ad1becb00b
commit 31e1382646
3 changed files with 15 additions and 8 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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 <SelectableItemType> originalSelection;
LassoSource <SelectableItemType>* source;
int outlineThickness;
Point<int> dragStartPos;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LassoComponent);