mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-21 01:24:21 +00:00
Added LookAndFeel method drawPopupMenuSectionHeader()
This commit is contained in:
parent
44b5f716cb
commit
43d4c1ea2f
4 changed files with 17 additions and 6 deletions
|
|
@ -1001,6 +1001,16 @@ void LookAndFeel_V2::drawPopupMenuItem (Graphics& g, const Rectangle<int>& area,
|
|||
}
|
||||
}
|
||||
|
||||
void LookAndFeel_V2::drawPopupMenuSectionHeader (Graphics& g, const Rectangle<int>& area, const String& sectionName)
|
||||
{
|
||||
g.setFont (getPopupMenuFont().boldened());
|
||||
g.setColour (findColour (PopupMenu::headerTextColourId));
|
||||
|
||||
g.drawFittedText (sectionName,
|
||||
area.getX() + 12, area.getY(), area.getWidth() - 16, (int) (area.getHeight() * 0.8f),
|
||||
Justification::bottomLeft, 1);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
int LookAndFeel_V2::getMenuWindowFlags()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -137,6 +137,9 @@ public:
|
|||
const String& text, const String& shortcutKeyText,
|
||||
const Drawable* icon, const Colour* textColour) override;
|
||||
|
||||
void drawPopupMenuSectionHeader (Graphics&, const Rectangle<int>& area,
|
||||
const String& sectionName) override;
|
||||
|
||||
Font getPopupMenuFont() override;
|
||||
|
||||
void drawPopupMenuUpDownArrow (Graphics&, int width, int height, bool isScrollUpArrow) override;
|
||||
|
|
|
|||
|
|
@ -1216,12 +1216,7 @@ public:
|
|||
|
||||
void paint (Graphics& g) override
|
||||
{
|
||||
g.setFont (getLookAndFeel().getPopupMenuFont().boldened());
|
||||
g.setColour (findColour (PopupMenu::headerTextColourId));
|
||||
|
||||
g.drawFittedText (getName(),
|
||||
12, 0, getWidth() - 16, proportionOfHeight (0.8f),
|
||||
Justification::bottomLeft, 1);
|
||||
getLookAndFeel().drawPopupMenuSectionHeader (g, getLocalBounds(), getName());
|
||||
}
|
||||
|
||||
void getIdealSize (int& idealWidth, int& idealHeight)
|
||||
|
|
|
|||
|
|
@ -562,6 +562,9 @@ public:
|
|||
const Drawable* icon,
|
||||
const Colour* textColour) = 0;
|
||||
|
||||
virtual void drawPopupMenuSectionHeader (Graphics&, const Rectangle<int>& area,
|
||||
const String& sectionName) = 0;
|
||||
|
||||
/** Returns the size and style of font to use in popup menus. */
|
||||
virtual Font getPopupMenuFont() = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue