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

Added a virtual getTabButtonFont() method to TabbedButtonBar::LookAndFeelMethods

This commit is contained in:
ed 2017-08-23 11:55:54 +01:00
parent ec368236f8
commit dc8033633c
3 changed files with 8 additions and 1 deletions

View file

@ -311,6 +311,7 @@ public:
virtual Rectangle<int> getTabButtonExtraComponentBounds (const TabBarButton&, Rectangle<int>& textArea, Component& extraComp) = 0;
virtual void drawTabButton (TabBarButton&, Graphics&, bool isMouseOver, bool isMouseDown) = 0;
virtual Font getTabButtonFont (TabBarButton&, float height) = 0;
virtual void drawTabButtonText (TabBarButton&, Graphics&, bool isMouseOver, bool isMouseDown) = 0;
virtual void drawTabbedButtonBarBackground (TabbedButtonBar&, Graphics&) = 0;
virtual void drawTabAreaBehindFrontButton (TabbedButtonBar&, Graphics&, int w, int h) = 0;

View file

@ -2171,6 +2171,11 @@ void LookAndFeel_V2::fillTabButtonShape (TabBarButton& button, Graphics& g, cons
g.strokePath (path, PathStrokeType (isFrontTab ? 1.0f : 0.5f));
}
Font LookAndFeel_V2::getTabButtonFont (TabBarButton&, float height)
{
return { height * 0.6f };
}
void LookAndFeel_V2::drawTabButtonText (TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown)
{
const Rectangle<float> area (button.getTextArea().toFloat());
@ -2181,7 +2186,7 @@ void LookAndFeel_V2::drawTabButtonText (TabBarButton& button, Graphics& g, bool
if (button.getTabbedButtonBar().isVertical())
std::swap (length, depth);
Font font (depth * 0.6f);
Font font (getTabButtonFont (button, depth));
font.setUnderline (button.hasKeyboardFocus (false));
AffineTransform t;

View file

@ -274,6 +274,7 @@ public:
Rectangle<int> getTabButtonExtraComponentBounds (const TabBarButton&, Rectangle<int>& textArea, Component& extraComp) override;
void drawTabButton (TabBarButton&, Graphics&, bool isMouseOver, bool isMouseDown) override;
Font getTabButtonFont (TabBarButton&, float height) override;
void drawTabButtonText (TabBarButton&, Graphics&, bool isMouseOver, bool isMouseDown) override;
void drawTabbedButtonBarBackground (TabbedButtonBar&, Graphics&) override;
void drawTabAreaBehindFrontButton (TabbedButtonBar&, Graphics&, int w, int h) override;