Browse Source

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

tags/2021-05-28
jules 11 years ago
parent
commit
137b50f3a4
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      modules/juce_gui_basics/layout/juce_TabbedButtonBar.cpp

+ 19
- 0
modules/juce_gui_basics/layout/juce_TabbedButtonBar.cpp 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


Loading…
Cancel
Save