mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-16 00:34:19 +00:00
PopupMenu: Use correct LookAndFeel when computing parent component
This commit is contained in:
parent
8d4b3774b2
commit
e5fc50908e
1 changed files with 20 additions and 6 deletions
|
|
@ -324,12 +324,16 @@ private:
|
|||
//==============================================================================
|
||||
struct MenuWindow : public Component
|
||||
{
|
||||
MenuWindow (const PopupMenu& menu, MenuWindow* parentWindow,
|
||||
Options opts, bool alignToRectangle, bool shouldDismissOnMouseUp,
|
||||
ApplicationCommandManager** manager, float parentScaleFactor = 1.0f)
|
||||
MenuWindow (const PopupMenu& menu,
|
||||
MenuWindow* parentWindow,
|
||||
Options opts,
|
||||
bool alignToRectangle,
|
||||
bool shouldDismissOnMouseUp,
|
||||
ApplicationCommandManager** manager,
|
||||
float parentScaleFactor = 1.0f)
|
||||
: Component ("menu"),
|
||||
parent (parentWindow),
|
||||
options (opts.withParentComponent (getLookAndFeel().getParentComponentForMenuOptions (opts))),
|
||||
options (opts.withParentComponent (findLookAndFeel (menu, parentWindow)->getParentComponentForMenuOptions (opts))),
|
||||
managerOfChosenCommand (manager),
|
||||
componentAttachedTo (options.getTargetComponent()),
|
||||
dismissOnMouseUp (shouldDismissOnMouseUp),
|
||||
|
|
@ -343,8 +347,7 @@ struct MenuWindow : public Component
|
|||
setAlwaysOnTop (true);
|
||||
setFocusContainerType (FocusContainerType::focusContainer);
|
||||
|
||||
setLookAndFeel (parent != nullptr ? &(parent->getLookAndFeel())
|
||||
: menu.lookAndFeel.get());
|
||||
setLookAndFeel (findLookAndFeel (menu, parentWindow));
|
||||
|
||||
auto& lf = getLookAndFeel();
|
||||
|
||||
|
|
@ -1291,6 +1294,17 @@ struct MenuWindow : public Component
|
|||
}));
|
||||
}
|
||||
|
||||
LookAndFeel* findLookAndFeel (const PopupMenu& menu, MenuWindow* parentWindow) const
|
||||
{
|
||||
if (parentWindow != nullptr)
|
||||
return &(parentWindow->getLookAndFeel());
|
||||
|
||||
if (auto* lnf = menu.lookAndFeel.get())
|
||||
return lnf;
|
||||
|
||||
return &getLookAndFeel();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
MenuWindow* parent;
|
||||
const Options options;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue