optionalSubMenu for PopupMenu::addItem


It will be helpful to have the ability to add sub menu on clickable menu command.
This feature can be simply added by modifing the  PopupMenu::addItem prototype like this:

void PopupMenu::addItem (int itemResultID,
                  const String& itemText,
                  bool isEnabled,
                  bool isTicked,
                  const Image& iconToUse,
                  const juce::PopupMenu* optionalSubMenu = nullptr /** new optionnal parameter */)

    jassert (itemResultID != 0);    // 0 is used as a return value to indicate that the user
                                    // didn't pick anything, so you shouldn't use it as the id
                                    // for an item..

    items.add (new Item (itemResultID, itemText, isActive, isTicked, createDrawableFromImage (iconToUse),
                         Colours::black, false, nullptr, optionalSubMenu /** new optional submenu */, nullptr));


Thanks for your concern about this.


FYI I've just done some long-overdue refactoring that will let you do this now. I've added a PopupMenu::Item class so you can set whatever properties you need on the items that you add.

So great !

I did not expect all of this changes.

Thanks a lot for all this work !

Note that it will be perfect if you can add the missing JUCE_API in juce_PopupMenu.h line 108:

struct JUCE_API Item

This help my Visual Studio Juce DLL build linkage.

Thanks again.

<sigh>.. ah, you DLL people.. Thanks, will add that.

Thanks a lot !