Browse Source

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

tags/2021-05-28
ed 8 years ago
parent
commit
dc8033633c
3 changed files with 8 additions and 1 deletions
  1. +1
    -0
      modules/juce_gui_basics/layout/juce_TabbedButtonBar.h
  2. +6
    -1
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp
  3. +1
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.h

+ 1
- 0
modules/juce_gui_basics/layout/juce_TabbedButtonBar.h 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;


+ 6
- 1
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp 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;


+ 1
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.h 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;


Loading…
Cancel
Save