Browse Source

Tab button fix and minor clean-ups.

tags/2021-05-28
jules 13 years ago
parent
commit
b8f557b201
6 changed files with 16 additions and 22 deletions
  1. +3
    -4
      modules/juce_graphics/effects/juce_DropShadowEffect.cpp
  2. +0
    -2
      modules/juce_gui_basics/buttons/juce_ArrowButton.h
  3. +3
    -3
      modules/juce_gui_basics/buttons/juce_ShapeButton.cpp
  4. +1
    -4
      modules/juce_gui_basics/buttons/juce_ShapeButton.h
  5. +3
    -1
      modules/juce_gui_basics/layout/juce_TabbedButtonBar.cpp
  6. +6
    -8
      modules/juce_gui_basics/misc/juce_BubbleComponent.cpp

+ 3
- 4
modules/juce_graphics/effects/juce_DropShadowEffect.cpp View File

@@ -124,10 +124,9 @@ void DropShadow::drawForPath (Graphics& g, const Path& path) const
{
jassert (radius > 0);
const Rectangle<int> area (path.getBounds().translated ((float) offset.x, (float) offset.y)
.getSmallestIntegerContainer()
.getIntersection (g.getClipBounds())
.expanded (radius + 1, radius + 1));
const Rectangle<int> area ((path.getBounds().getSmallestIntegerContainer() + offset)
.getIntersection (g.getClipBounds())
.expanded (radius + 1, radius + 1));
if (area.getWidth() > 2 && area.getHeight() > 2)
{


+ 0
- 2
modules/juce_gui_basics/buttons/juce_ArrowButton.h View File

@@ -53,8 +53,6 @@ public:
/** Destructor. */
~ArrowButton();
protected:
/** @internal */
void paintButton (Graphics&, bool isMouseOverButton, bool isButtonDown);


+ 3
- 3
modules/juce_gui_basics/buttons/juce_ShapeButton.cpp View File

@@ -89,9 +89,9 @@ void ShapeButton::paintButton (Graphics& g, bool isMouseOverButton, bool isButto
isButtonDown = false;
}
g.setColour ((isButtonDown) ? downColour
: (isMouseOverButton) ? overColour
: normalColour);
g.setColour (isButtonDown ? downColour
: isMouseOverButton ? overColour
: normalColour);
int w = getWidth();
int h = getHeight();


+ 1
- 4
modules/juce_gui_basics/buttons/juce_ShapeButton.h View File

@@ -87,11 +87,8 @@ public:
float outlineStrokeWidth);
protected:
/** @internal */
void paintButton (Graphics& g,
bool isMouseOverButton,
bool isButtonDown);
void paintButton (Graphics&, bool isMouseOverButton, bool isButtonDown);
private:
//==============================================================================


+ 3
- 1
modules/juce_gui_basics/layout/juce_TabbedButtonBar.cpp View File

@@ -152,7 +152,10 @@ void TabBarButton::setExtraComponent (Component* comp, ExtraComponentPlacement p
void TabBarButton::childBoundsChanged (Component* c)
{
if (c == extraComponent)
{
owner.resized();
resized();
}
}
void TabBarButton::resized()
@@ -434,7 +437,6 @@ void TabbedButtonBar::resized()
for (int i = 0; i < tabs.size(); ++i)
{
TabBarButton* const tb = tabs.getUnchecked(i)->button;
const int newLength = totalLength + tb->getBestTabLength (depth);
if (i > 0 && newLength * minimumScale > tabsButtonPos)


+ 6
- 8
modules/juce_gui_basics/misc/juce_BubbleComponent.cpp View File

@@ -32,9 +32,7 @@ BubbleComponent::BubbleComponent()
setComponentEffect (&shadow);
}
BubbleComponent::~BubbleComponent()
{
}
BubbleComponent::~BubbleComponent() {}
//==============================================================================
void BubbleComponent::paint (Graphics& g)
@@ -43,13 +41,12 @@ void BubbleComponent::paint (Graphics& g)
(float) content.getX(), (float) content.getY(),
(float) content.getWidth(), (float) content.getHeight());
g.reduceClipRegion (content);
g.setOrigin (content.getX(), content.getY());
g.reduceClipRegion (0, 0, content.getWidth(), content.getHeight());
paintContent (g, content.getWidth(), content.getHeight());
}
//==============================================================================
void BubbleComponent::setAllowedPlacement (const int newPlacement)
{
allowablePlacements = newPlacement;
@@ -82,9 +79,8 @@ void BubbleComponent::setPosition (const Rectangle<int>& rectangleToPointTo)
content.setBounds (edgeSpace, edgeSpace, contentW, contentH);
}
int totalW = content.getWidth() + edgeSpace * 2;
int totalH = content.getHeight() + edgeSpace * 2;
int targetX, targetY;
const int totalW = content.getWidth() + edgeSpace * 2;
const int totalH = content.getHeight() + edgeSpace * 2;
const Rectangle<int> availableSpace (getParentComponent() != nullptr ? getParentComponent()->getLocalBounds()
: getParentMonitorArea());
@@ -106,6 +102,8 @@ void BubbleComponent::setPosition (const Rectangle<int>& rectangleToPointTo)
spaceAbove = spaceBelow = 0;
}
int targetX, targetY;
if (jmax (spaceAbove, spaceBelow) >= jmax (spaceLeft, spaceRight))
{
targetX = rectangleToPointTo.getCentre().x;


Loading…
Cancel
Save