Browse Source

Changed LassoComponent to draw itself via the LookAndFeel.

tags/2021-05-28
jules 13 years ago
parent
commit
31e1382646
3 changed files with 15 additions and 8 deletions
  1. +10
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp
  2. +3
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.h
  3. +2
    -8
      modules/juce_gui_basics/mouse/juce_LassoComponent.h

+ 10
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp 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)


+ 3
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.h 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);


+ 2
- 8
modules/juce_gui_basics/mouse/juce_LassoComponent.h 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);


Loading…
Cancel
Save