| @@ -324,12 +324,16 @@ private: | |||||
| //============================================================================== | //============================================================================== | ||||
| struct MenuWindow : public Component | 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"), | : Component ("menu"), | ||||
| parent (parentWindow), | parent (parentWindow), | ||||
| options (opts.withParentComponent (getLookAndFeel().getParentComponentForMenuOptions (opts))), | |||||
| options (opts.withParentComponent (findLookAndFeel (menu, parentWindow)->getParentComponentForMenuOptions (opts))), | |||||
| managerOfChosenCommand (manager), | managerOfChosenCommand (manager), | ||||
| componentAttachedTo (options.getTargetComponent()), | componentAttachedTo (options.getTargetComponent()), | ||||
| dismissOnMouseUp (shouldDismissOnMouseUp), | dismissOnMouseUp (shouldDismissOnMouseUp), | ||||
| @@ -343,8 +347,7 @@ struct MenuWindow : public Component | |||||
| setAlwaysOnTop (true); | setAlwaysOnTop (true); | ||||
| setFocusContainerType (FocusContainerType::focusContainer); | setFocusContainerType (FocusContainerType::focusContainer); | ||||
| setLookAndFeel (parent != nullptr ? &(parent->getLookAndFeel()) | |||||
| : menu.lookAndFeel.get()); | |||||
| setLookAndFeel (findLookAndFeel (menu, parentWindow)); | |||||
| auto& lf = getLookAndFeel(); | 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; | MenuWindow* parent; | ||||
| const Options options; | const Options options; | ||||