1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-20 01:14:20 +00:00

TabbedButtonBar: made sure that when the buttons contain an extra component, the tab's text doesn't overlap it.

This commit is contained in:
jules 2013-10-20 14:29:05 +01:00
parent 286c256eeb
commit 137b50f3a4

View file

@ -93,7 +93,26 @@ void TabBarButton::calcAreas (Rectangle<int>& extraComp, Rectangle<int>& textAre
}
if (extraComponent != nullptr)
{
extraComp = lf.getTabButtonExtraComponentBounds (*this, textArea, *extraComponent);
const TabbedButtonBar::Orientation orientation = owner.getOrientation();
if (orientation == TabbedButtonBar::TabsAtLeft || orientation == TabbedButtonBar::TabsAtRight)
{
if (extraComp.getCentreY() > textArea.getCentreY())
textArea.setBottom (jmin (textArea.getBottom(), extraComp.getY()));
else
textArea.setTop (jmax (textArea.getY(), extraComp.getBottom()));
}
else
{
if (extraComp.getCentreX() > textArea.getCentreX())
textArea.setRight (jmin (textArea.getRight(), extraComp.getX()));
else
textArea.setLeft (jmax (textArea.getX(), extraComp.getRight()));
}
}
}
Rectangle<int> TabBarButton::getTextArea() const