mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
PopupMenu: Move section header size calculation into LookAndFeel methods.
This fixes a bug introduced in the previous commit that caused all menu items to be sized too large.
This commit is contained in:
parent
e360d83057
commit
98e21c6ad8
5 changed files with 30 additions and 9 deletions
|
|
@ -899,7 +899,20 @@ void LookAndFeel_V2::getIdealPopupMenuItemSizeWithOptions (const String& text,
|
|||
standardMenuItemHeight,
|
||||
idealWidth,
|
||||
idealHeight);
|
||||
}
|
||||
|
||||
void LookAndFeel_V2::getIdealPopupMenuSectionHeaderSizeWithOptions (const String& text,
|
||||
int standardMenuItemHeight,
|
||||
int& idealWidth,
|
||||
int& idealHeight,
|
||||
const PopupMenu::Options& options)
|
||||
{
|
||||
getIdealPopupMenuItemSizeWithOptions (text,
|
||||
false,
|
||||
standardMenuItemHeight,
|
||||
idealWidth,
|
||||
idealHeight,
|
||||
options);
|
||||
idealHeight += idealHeight / 2;
|
||||
idealWidth += idealWidth / 4;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,6 +207,12 @@ public:
|
|||
int& idealHeight,
|
||||
const PopupMenu::Options&) override;
|
||||
|
||||
void getIdealPopupMenuSectionHeaderSizeWithOptions (const String& text,
|
||||
int standardMenuItemHeight,
|
||||
int& idealWidth,
|
||||
int& idealHeight,
|
||||
const PopupMenu::Options&) override;
|
||||
|
||||
int getMenuWindowFlags() override;
|
||||
void preparePopupMenuWindow (Component&) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -884,9 +884,6 @@ void LookAndFeel_V4::getIdealPopupMenuItemSize (const String& text, const bool i
|
|||
idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : roundToInt (font.getHeight() * 1.3f);
|
||||
idealWidth = GlyphArrangement::getStringWidthInt (font, text) + idealHeight * 2;
|
||||
}
|
||||
|
||||
idealHeight += idealHeight / 2;
|
||||
idealWidth += idealWidth / 4;
|
||||
}
|
||||
|
||||
void LookAndFeel_V4::drawMenuBarBackground (Graphics& g, int width, int height,
|
||||
|
|
|
|||
|
|
@ -84,12 +84,11 @@ struct HeaderItemComponent final : public PopupMenu::CustomComponent
|
|||
|
||||
void getIdealSize (int& idealWidth, int& idealHeight) override
|
||||
{
|
||||
getLookAndFeel().getIdealPopupMenuItemSizeWithOptions (getName(),
|
||||
false,
|
||||
-1,
|
||||
idealWidth,
|
||||
idealHeight,
|
||||
options);
|
||||
getLookAndFeel().getIdealPopupMenuSectionHeaderSizeWithOptions (getName(),
|
||||
-1,
|
||||
idealWidth,
|
||||
idealHeight,
|
||||
options);
|
||||
}
|
||||
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override
|
||||
|
|
|
|||
|
|
@ -997,6 +997,12 @@ public:
|
|||
int& idealHeight,
|
||||
const Options&) = 0;
|
||||
|
||||
virtual void getIdealPopupMenuSectionHeaderSizeWithOptions (const String& text,
|
||||
int standardMenuItemHeight,
|
||||
int& idealWidth,
|
||||
int& idealHeight,
|
||||
const Options&) = 0;
|
||||
|
||||
virtual int getMenuWindowFlags() = 0;
|
||||
|
||||
virtual void drawMenuBarBackground (Graphics&, int width, int height,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue